Re: gnat: symbolic traceback on exceptions
- From: Manuel Collado <m.collado@xxxxxxxxxxxxxxxx>
- Date: Tue, 24 May 2005 14:37:33 +0200
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 .
- Follow-Ups:
- Re: gnat: symbolic traceback on exceptions
- From: Björn Lundin
- Re: gnat: symbolic traceback on exceptions
- References:
- gnat: symbolic traceback on exceptions
- From: Manuel Collado
- Re: gnat: symbolic traceback on exceptions
- From: Björn Lundin
- gnat: symbolic traceback on exceptions
- Prev by Date: Re: gnat: symbolic traceback on exceptions
- Next by Date: Implementing Ada.Asynchronous_Task_Control in GNAT
- Previous by thread: Re: gnat: symbolic traceback on exceptions
- Next by thread: Re: gnat: symbolic traceback on exceptions
- Index(es):
Relevant Pages
|