comp.lang.ada
 help / color / mirror / Atom feed
From: Manuel Collado <m.collado@lml.ls.fi.upm.es>
Subject: gnat: symbolic traceback on exceptions
Date: Mon, 23 May 2005 12:48:09 +0200
Date: 2005-05-23T12:48:09+02:00	[thread overview]
Message-ID: <4291b4ed@news.upm.es> (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



             reply	other threads:[~2005-05-23 10:48 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-05-23 10:48 Manuel Collado [this message]
2005-05-23 11:03 ` gnat: symbolic traceback on exceptions 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
replies disabled

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