From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: 103376,d202b19275ae293,start X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Date: Mon, 23 May 2005 12:48:09 +0200 From: Manuel Collado User-Agent: Mozilla Thunderbird 1.0 (Windows/20041206) X-Accept-Language: es-ar, es, en-us, en MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: gnat: symbolic traceback on exceptions Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit NNTP-Posting-Host: 138.100.10.20 Message-ID: <4291b4ed@news.upm.es> X-Trace: 23 May 2005 12:48:13 +0100, 138.100.10.20 Path: g2news1.google.com!news4.google.com!newsfeed.stanford.edu!bloom-beacon.mit.edu!news.rediris.es!news.upm.es!138.100.10.20 Xref: g2news1.google.com comp.lang.ada:11121 Date: 2005-05-23T12:48:09+02:00 List-Id: 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