comp.lang.ada
 help / color / mirror / Atom feed
* gnat: symbolic traceback on exceptions
@ 2005-05-23 10:48 Manuel Collado
  2005-05-23 11:03 ` Ludovic Brenta
                   ` (2 more replies)
  0 siblings, 3 replies; 9+ messages in thread
From: Manuel Collado @ 2005-05-23 10:48 UTC (permalink / raw)


Using gnat 3.15p on WindowsXP. Wanted symbolic traceback automatically 
generated on unhandled exceptions. Mainly for student programs.

The following recipe can produce the wanted info, as suggested by the 
gnat user's guide:

...> gnatmake -g main_program -bargs -E

...> main_program
Execution terminated by unhandled exception
Exception name: CONSTRAINT_ERROR
Message: main_program.adb:5 explicit raise
Call stack traceback locations:
0x404a69 0x401bdf 0x4012f3 0x40130b 0x40131c 0x4012bb 0x401103

...>addr2line --exe=main_progam.exe 0x404a69 0x401bdf 0x4012f3 0x40130b 
0x40131c 0x4012bb 0x401103
00404A69 at c:/manual/build-kiev/src/ada/rts/a-except.adb:1320
00401BDF at c:/manual/build-kiev/src/ada/rts/a-except.adb:592
004012F3 at E:/.../main_program.adb:5
0040130B at E:/.../main_program.adb:10
0040131C at E:/.../main_program.adb:14
004012BB at E:/...//b~main_program.adb:109
00401103 at fake:0

This is an unfriendly way of doing things. The list of binary addresses 
must be manually grabbed from the exception message and pasted in the 
addr2line command.

Is there a different set of gnat switches that could be used to have the 
symbolic traceback directly listed in the exception message?

Or can it be programmatically generated, by explicitly invoking the 
message generation from the main program? Something like:

   procedure main_program is
   begin
     ...
   exception
     when others => Trace_Exception;
  end main_program;

Where Trace_Exception is a general trace routine that uses gnat specific 
features and library routines. (which ones?)

Thanks in advance.
-- 
To reply by e-mail, please remove the extra dot
in the given address:  m.collado -> mcollado



^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2005-05-25  9:53 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-05-23 10:48 gnat: symbolic traceback on exceptions Manuel Collado
2005-05-23 11:03 ` Ludovic Brenta
2005-05-23 15:23 ` Björn Lundin
2005-05-24 12:37   ` Manuel Collado
2005-05-24 19:41     ` Björn Lundin
2005-05-23 18:20 ` Bernd Specht
2005-05-24 11:05   ` Manuel Collado
2005-05-25  7:42     ` gautier_niouzes
2005-05-25  9:53       ` Manuel Collado

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox