From: "Björn Lundin" <bnl@spray.se>
To: Manuel Collado <m.collado@lml.ls.fi.upm.es>
Cc: comp.lang.ada@ada-france.org
Subject: Re: gnat: symbolic traceback on exceptions
Date: Mon, 23 May 2005 17:23:12 +0200
Date: 2005-05-23T17:23:12+02:00 [thread overview]
Message-ID: <mailman.123.1116861820.24457.comp.lang.ada@ada-france.org> (raw)
In-Reply-To: <4291b4ed@news.upm.es>
2005-05-23 kl. 12.48 skrev Manuel Collado:
>
> ..> gnatmake -g main_program -bargs -E
This is a requirement below as well
> 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?)
Not compiled, not tested, but should work
You could put it in a separate package if you like.
/Björn
-----------
with Ada.Exceptions;
with Text_Io; use Text_Io;
with Gnat.Traceback;
procedure A_Test is
A : String (1..1);
procedure Tracebackinfo(E : Ada.Exceptions.Exception_Occurrence) is
Last_Exception_Name : constant String :=
Ada.Exceptions.Exception_Name(E);
Last_Exception_Messsage : constant String:=
Ada.Exceptions.Exception_Message(E);
Last_Exception_Info : constant String:=
Ada.Exceptions.Exception_Information(E);
begin
Put("Exception raised : "); Put_Line(Last_Exception_Name);
New_Line;
Put_Line("Message : " & Last_Exception_Messsage);
Put_Line(Last_Exception_Info);
Put_Line("...................................................");
New_Line;
Put_Line("Hex Subprogram name and file");
Put_Line("----- ------------------------");
Put_Line(Gnat.Traceback.Symbolic.Symbolic_Traceback(E));
Put_Line("-------------------------------------------------");
end Tracebackinfo;
begin
A := "Hello, this raises Constraint_Error";
exception
when E: others =>
Tracebackinfo(E);
end A_Test;
Björn Lundin
bnl at spray dot se
next prev parent reply other threads:[~2005-05-23 15:23 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 [this message]
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
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