Strangely I am unable to reproduce either of the bugs in gprbuild,
namely the mishandling of exceptions and the exception inside
GNAT.Expect. The following program runs successfully on kfreebsd-i386.
This suggests that something really fishy is going on in the way GNAT
compiles gprbuild but not in a "normal" program.
I see that some of the executables in gprbuild use tasking but gprconfig
does not. I suspect this may cause trouble: some of the compilation
units in gprconfig might use tasking (or cause some tasking
initialization to take place at elaboration) while the main program does
not.
I will try to change debian/rules so that each executable gets built in
its own directory and report back.
with Ada.Exceptions;
with Ada.Text_IO;
with GNAT.Expect;
with GNAT.OS_Lib; use GNAT.OS_Lib;
procedure Hello is
The_Arguments : GNAT.OS_Lib.Argument_List :=
(1 => new String'("gcc"),
2 => new String'("-dumpversion"));
Status : aliased Integer;
The_Output : constant String :=
GNAT.Expect.Get_Command_Output (Command => "gcc",
Arguments => The_Arguments,
Input => "",
Status => Status'Access,
Err_To_Out => False);
begin
Ada.Text_IO.Put_Line ("Executing ./hello...");
Ada.Text_IO.Put_Line ("Output: " & The_Output & "; status:" & Integer'Image
(Status));
Status := Integer'Value ("hello");
exception
when E : others =>
Ada.Text_IO.Put_Line ("Exception handled successfully: " &
Ada.Exceptions.Exception_Information (E));
end Hello;
$ gnatmake -g -O2 hello; ./hello
gcc-4.9 -c -g -O2 hello.adb
gnatbind -x hello.ali
gnatlink hello.ali -g -O2
Executing ./hello...
Output: 4.9.1; status: 0
Exception handled successfully: Exception name: CONSTRAINT_ERROR
Message: bad input for 'Value: "hello"
--
Ludovic Brenta.
--
To UNSUBSCRIBE, email to [email protected]
with a subject of "unsubscribe". Trouble? Contact [email protected]