Re: gnat: symbolic traceback on exceptions
- From: gautier_niouzes@xxxxxxxxxxx
- Date: 25 May 2005 00:42:05 -0700
Manuel Collado:
> > Did you try it with AdaGide with switch "Trace exception" set? Compile F3,
> > run F4.
>
> No, I din't. But I've done it now without success. It seems that the
> "Trace exceptions" option lets AdaGide to run the program through an
> "AD" utility that interfaces with GDB. In my machine AD itself seems to
> crash. Example:
(...)
This AD should disappear one day - I don't know if it even sometimes
works...
The solution to your problem ("the GNAT 3.13+ way") is, generically
written:
------------------------------------------------------------------------------
-- File: TB_Wrap.ads
-- Description: Trace-back wrapper for GNAT 3.13p+ (spec.)
------------------------------------------------------------------------------
generic
with procedure My_main_procedure;
procedure TB_Wrap;
------------------------------------------------------------------------------
-- File: TB_Wrap.adb
-- Description: Trace-back wrapper for GNAT 3.13p+ (body)
------------------------------------------------------------------------------
with GNAT.Traceback.Symbolic, Ada.Exceptions, Ada.Text_IO;
use Ada.Exceptions, Ada.Text_IO;
procedure TB_Wrap is
pragma Compiler_options("-g");
pragma Binder_options("-E");
begin
My_main_procedure;
exception
when E: others =>
New_Line;
Put_Line("---------------[ Unhandled exception ]------------");
Put_Line(" > Name of exception . . . . .: " &
Ada.Exceptions.Exception_Name(E) );
Put_Line(" > Message for exception . . .: " &
Ada.Exceptions.Exception_Message(E) );
Put_Line(" > Trace-back of call stack: " );
Put_Line( GNAT.Traceback.Symbolic.Symbolic_Traceback(E) );
end TB_Wrap;
-----------
with TB_Wrap, Test;
procedure Test_TB_Wrap is new TB_Wrap(Test);
-----------
Of course you can do it without the generic wrapper, just paste
the exception part at the end of your main procedure.
The switches mentioned in the above code correspond to the compiler
switches "debug info" and "trace-back" in the "Debugging" group
of AdaGIDE's "Project settings" -> "Debug/Release settings".
HTH
______________________________________________________________
Gautier -- http://www.mysunrise.ch/users/gdm/index.htm
Ada programming -- http://www.mysunrise.ch/users/gdm/gsoft.htm
NB: For a direct answer, e-mail address on the Web site!
.
- Follow-Ups:
- Re: gnat: symbolic traceback on exceptions
- From: Manuel Collado
- Re: gnat: symbolic traceback on exceptions
- References:
- gnat: symbolic traceback on exceptions
- From: Manuel Collado
- Re: gnat: symbolic traceback on exceptions
- From: Bernd Specht
- Re: gnat: symbolic traceback on exceptions
- From: Manuel Collado
- gnat: symbolic traceback on exceptions
- Prev by Date: Gnat STORAGE_ERROR
- Next by Date: Re: SPARK and Interfaces.C
- Previous by thread: Re: gnat: symbolic traceback on exceptions
- Next by thread: Re: gnat: symbolic traceback on exceptions
- Index(es):
Relevant Pages
|