comp.lang.ada
 help / color / mirror / Atom feed
From: gautier_niouzes@hotmail.com
Subject: Re: gnat: symbolic traceback on exceptions
Date: 25 May 2005 00:42:05 -0700
Date: 2005-05-25T00:42:05-07:00	[thread overview]
Message-ID: <1117006925.684308.317230@f14g2000cwb.googlegroups.com> (raw)
In-Reply-To: 42930a9b@news.upm.es

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!




  reply	other threads:[~2005-05-25  7:42 UTC|newest]

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