From: gautier_niouzes@hotmail.com
Subject: Re: Re-write a file in Ada
Date: Tue, 19 Jan 2016 08:52:02 -0800 (PST)
Date: 2016-01-19T08:52:02-08:00 [thread overview]
Message-ID: <87175c10-f8fc-4550-856c-6577f1e4acae@googlegroups.com> (raw)
In-Reply-To: <n7l9u3$p95$1@dont-email.me>
On Tuesday, January 19, 2016 at 1:27:22 PM UTC+1, Brian Drummond wrote:
> Agreed. Traceback would be very helpful. Because I can never remember
> how, I'll outline it here, partly in the hope of memorising it. From
>
> https://gcc.gnu.org/onlinedocs/gnat_ugn/Non-Symbolic-Traceback.html#Non-
> Symbolic-Traceback
There is a way that doesn't need calling post-mortem addr2line: wrap your main procedure with the TB_Wrap generic procedure below, by instanciating the wrapper like this:
with TB_Wrap, To_BMP;
pragma Elaborate_All(TB_Wrap);
procedure TB_To_BMP is new TB_Wrap(To_BMP);
_________________________
Gautier's Ada programming
http://www.openhub.net/accounts/gautier_bd
-----------------------------------------------------------------------
-- 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(Standard_Error);
Put_Line(Standard_Error,
"------------------[ Unhandled exception ]---------------");
Put_Line(Standard_Error, " > Name of exception . . . . .: " &
Ada.Exceptions.Exception_Name(E) );
Put_Line(Standard_Error, " > Message for exception . . .: " &
Ada.Exceptions.Exception_Message(E) );
Put_Line(Standard_Error, " > Trace-back of call stack: " );
Put_Line(Standard_Error, GNAT.Traceback.Symbolic.Symbolic_Traceback(E) );
end TB_Wrap;
next prev parent reply other threads:[~2016-01-19 16:52 UTC|newest]
Thread overview: 34+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-01-06 15:55 Re-write a file in Ada comicfanzine
2016-01-07 13:02 ` comicfanzine
2016-01-08 20:35 ` comicfanzine
2016-01-09 9:50 ` Brian Drummond
2016-01-08 21:22 ` Randy Brukardt
2016-01-08 22:08 ` Anh Vo
2016-01-10 16:54 ` comicfanzine
2016-01-10 18:59 ` Björn Lundin
2016-01-11 17:16 ` Brian Drummond
2016-01-18 15:05 ` gautier_niouzes
2016-01-19 12:24 ` Brian Drummond
2016-01-19 16:52 ` gautier_niouzes [this message]
2016-01-21 12:26 ` Brian Drummond
2016-01-10 22:57 ` comicfanzine
2016-01-11 1:59 ` Anh Vo
2016-01-11 10:09 ` Björn Lundin
2016-01-18 0:22 ` comicfanzine
2016-01-18 9:50 ` AdaMagica
2016-01-18 17:27 ` Björn Lundin
2016-01-18 11:52 ` Brian Drummond
2016-01-18 17:30 ` Björn Lundin
2016-01-18 17:25 ` comicfanzine
2016-01-18 17:49 ` J-P. Rosen
2016-01-18 18:37 ` Simon Wright
2016-01-19 12:33 ` Brian Drummond
2016-01-19 14:40 ` Simon Wright
2016-01-21 12:31 ` Brian Drummond
2016-01-19 12:04 ` comicfanzine
2016-01-19 14:29 ` Anh Vo
2016-01-19 14:35 ` Simon Wright
2016-01-19 16:54 ` Jeffrey R. Carter
2016-01-19 17:32 ` Anh Vo
2016-01-19 16:53 ` Stephen Davies
2016-01-20 1:12 ` comicfanzine
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox