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 X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII Date: Tue, 24 May 2005 14:37:33 +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: Re: gnat: symbolic traceback on exceptions References: <4291b4ed@news.upm.es> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 8bit NNTP-Posting-Host: 138.100.10.20 Message-ID: <42932011@news.upm.es> X-Trace: 24 May 2005 14:37:37 +0100, 138.100.10.20 Path: g2news1.google.com!news4.google.com!news.glorb.com!solnet.ch!solnet.ch!news-zh.switch.ch!irazu.switch.ch!switch.ch!news.rediris.es!news.upm.es!138.100.10.20 Xref: g2news1.google.com comp.lang.ada:11137 Date: 2005-05-24T14:37:33+02:00 List-Id: Bj�rn Lundin escribi�: > ... > Not compiled, not tested, but should work > You could put it in a separate package if you like. > > ----------- > with Ada.Exceptions; > with Text_Io; use Text_Io; > with Gnat.Traceback; > ...[snipped]... > begin > A := "Hello, this raises Constraint_Error"; > exception > when E: others => > Tracebackinfo(E); > end A_Test; Thank you very much. Your code worked almost immediatly (after correcting a minor omission in a with clause). After putting the reporting routine in a separate compilation unit, the user's code is really simple: ------------------------------ with Trace_Exception; procedure New_Test is A : String (1..1); begin A := "Hello, this raises Constraint_Error"; exception when E: others => Trace_Exception( E ); end New_Test; ------------------------------ ..>new_test Exception raised : CONSTRAINT_ERROR Message : new_test.adb:8 length check failed Call chain traceback : Address Subprogram name and source code location -------- ---------------------------------------- 0040536D in ada.exceptions.process_raise_exception at a-except.adb:1320 00402537 in <__gnat_rcheck_07> at a-except.adb:607 00401BEA in new_test at new_test.adb:8 004013D3 in main at b~new_test.adb:168 00401103 in ?? at fake:0 ------------------------------ I've adapted your code to my own taste. The user's code is simple enough to be used by our students. I wonder why the gnat compiler doesn't provide a -gnat.. switch to turn on the symbolic call stack reporting at the user's request. Thanks again, -- To reply by e-mail, please remove the extra dot in the given address: m.collado -> mcollado