Bug in GNAT.Traceback.Symbolic? 
Author Message
 Bug in GNAT.Traceback.Symbolic?

Hello all,

I have a problem using Gnat.Traceback.Symbolic (Win2000).
A stream based read procedure shall do a 2 step error handling.

First when an error is encountered the reason is appended to
an Exception_Occurrence by Ada.Exceptions.Raise_Exception.
On a higher level were the file object is known a local handler
shall append the filename and the file index to the message by first
retrieving the information including the symbolic stack by

Ada.Exceptions.Exception_Information(E) &
Gnat.Traceback.Symbolic.Symbolic_Traceback(E)

and then appending the file info and calling Raise_Exception again.

The problem is:
The first call to Symbolic_Traceback does not contain the symbolic
information.

Appended info:
- Code excerpts
- Stacktrace output using Symbolic_Traceback(E) in the main
- gcc and gnatmake options (gnat.ago)

Is there something else then "-bargs -E" necessary???

----------------------------------------------------------------
   exception
     when Error : others => Add_Info_Close_Reraise(Error, File);
   end Read;

----------------------------------------------------------------

procedure Add_Info_Close_Reraise
            (Error : in     Ada.Exceptions.Exception_Occurrence;
             File  : in out Ada.Streams.Stream_Io.File_Type) is

begin
   if Ada.Streams.Stream_Io.Is_Open(File) then
     declare
       Name  : constant String  := Ada.Streams.Stream_Io.Name(File);
       Index : constant Natural :=
Natural(Ada.Streams.Stream_Io.Index(File));
       Info  : constant String  :=
Portable.Utils.Exception_Information(Error);
       begin
         Ada.Streams.Stream_Io.Close(File);

         Ada.Exceptions.Raise_Exception
           (E       => Ada.Exceptions.Exception_Identity(Error),
            Message => Info & Os.New_Line &
                       "File: " & Name & ", Index: " &
Natural'Image(Index));
       end;
     else
       Ada.Exceptions.Reraise_Occurrence(Error);
     end if;
   end Add_Info_Close_Reraise;

----------------------------------------------------------------------------

with Gnat.Traceback.Symbolic;

package body Portable.Utils is

----------------------------------------------------------------------------

   function Exception_Information(E : in
Ada.Exceptions.Exception_Occurrence)
            return String is
   begin
     return Ada.Exceptions.Exception_Information(E) &
            Gnat.Traceback.Symbolic.Symbolic_Traceback(E);
   end Exception_Information;

----------------------------------------------------------------------------

end Portable.Utils;

----------------------------------------------------------------------------
******** First traceback without symbolic info!!!

C:\Ada95\source\Projects\MST_SA\Geo>test_dted_io
E:\dted\DTED\E000\N46.dt1
Exception name: GEO.DTED.IO.DTED_FILE_ERROR

Message: Exception name: GEO.DTED.IO.DTED_FILE_ERROR

Message: unexpected string, '  D' read, expected 'DSI'

File: E:\dted\DTED\E000\N46.dt1, Index:  82

Call stack traceback locations:
0x4488c3 0x44e140 0x4

Call stack traceback locations:
0x449be6 0x450a21 0x410ae0 0x410bc6 0x401401 0x401103 0x77e8ca8e
00449BE6 in geo.dted.io.add_info_close_reraise at geo-dted-io.adb:570
00450A21 in geo.dted.io.read at geo-dted-io.adb:1088
00410AE0 in test_dted_io.test_dted at test_dted_io.adb:86
00410BC6 in test_dted_io at test_dted_io.adb:103
00401401 in ?? at crt1.c:0
00401103 in ?? at crt1.c:0
77E8CA8E in ?? at fake:0
----------------------------------------------------------------------------
******** Only one exception occurrence!!!

C:\Ada95\source\Projects\MST_SA\Geo>test_dted_io
E:\dted\DTED\E000\N46.dt1
Exception name: GEO.DTED.IO.DTED_FILE_ERROR
Message: unexpected string, '  D' read, expected 'DSI'
File: E:\dted\DTED\E000\N46.dt1, Index:  82
Call stack traceback locations:
0x4488c3 0x44e140 0x450a9e 0x410ae0 0x410bc6 0x401401 0x401103 0x77e8ca8e
004488C3 in geo.dted.io.check at geo-dted-io.adb:400
0044E140 in geo.dted.io.read.read at geo-dted-io.adb:937
00450A9E in geo.dted.io.read at geo-dted-io.adb:1082
00410AE0 in test_dted_io.test_dted at test_dted_io.adb:86
00410BC6 in test_dted_io at test_dted_io.adb:103
00401401 in ?? at crt1.c:0
00401103 in ?? at crt1.c:0
77E8CA8E in ?? at fake:0
----------------------------------------------------------------------------
***** gnat options

-O3 -I\ada95\source\lib\math -I\ada95\source\lib\math\arrays
-I\ada95\source\lib\utilities -I\ada95\source\lib\portable
-I\ada95\source\lib\portable\posix-win\src
-I\ada95\compiler\gnat\bindings\win32ada -I\ada95\compiler\gnat\asis
-I\ada95\source\projects\asis -I\ada95\bin\gnat -I..\mst

-cargs -O3 -bargs -f -E -largs \ada95\compiler\gnat\asis\libasis.a
\ada95\compiler\gnat\lib\libopengl32.a
\ada95\compiler\gnat\lib\libglu32.a \ada95\compiler\gnat\lib\libglut32.a
\ada95\compiler\gnat\lib\libgdi32.a
\ada95\compiler\gnat\lib\libwsock32.a -I\ada95\source\lib\math
-I\ada95\source\lib\math\arrays -I\ada95\source\lib\utilities
-I\ada95\source\lib\portable -I\ada95\source\lib\portable\posix-win\src
-I\ada95\compiler\gnat\bindings\win32ada -I\ada95\compiler\gnat\asis
-I\ada95\source\projects\asis -I\ada95\bin\gnat -I..\mst

WINDOWS_TARGET
-----------------------------------------------------------------------------

Thanks for any help
   J. Schr?er



Sat, 12 Feb 2005 20:29:42 GMT  
 Bug in GNAT.Traceback.Symbolic?

Quote:

> Is there something else then "-bargs -E" necessary???

We use
  gnatmake -g spark -cargs -funwind-tables -bargs -E
which works fine for us using GNAT Pro 3.15
 - Rod Chapman, SPARK Team


Sun, 13 Feb 2005 04:36:52 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Problem using Gnat.Traceback.Symbolic.Symbolic_Traceback()

2. problem with Gnat.Traceback.Symbolic on linux with Gnat 3.14p ?

3. Traceback on Gnat/Linux

4. How to get a traceback in Gnat 3.14p

5. GNAT.Traceback is back...

6. Tracebacks, GNAT

7. using package GNAT.Traceback

8. GNAT/Ada Traceback Information?

9. GNAT exception traceback

10. perl script for GNAT tracebacks

11. GNAT : Exception traceback

12. Symbolic debugger for Ada95 Gnat 3.05

 

 
Powered by phpBB® Forum Software