From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM autolearn=unavailable autolearn_force=no version=3.4.4 X-Received: by 10.50.4.106 with SMTP id j10mr18541784igj.13.1453222322344; Tue, 19 Jan 2016 08:52:02 -0800 (PST) X-Received: by 10.182.104.163 with SMTP id gf3mr364717obb.5.1453222322320; Tue, 19 Jan 2016 08:52:02 -0800 (PST) Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!news.eternal-september.org!mx02.eternal-september.org!feeder.eternal-september.org!news.glorb.com!o2no4478144iga.0!news-out.google.com!l1ni1015igd.0!nntp.google.com!h5no6745386igh.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail Newsgroups: comp.lang.ada Date: Tue, 19 Jan 2016 08:52:02 -0800 (PST) In-Reply-To: Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=57.79.21.1; posting-account=gRqrnQkAAAAC_02ynnhqGk1VRQlve6ZG NNTP-Posting-Host: 57.79.21.1 References: <77e47c8b-7dcc-4e86-8f89-1f348cdf08dd@googlegroups.com> <888e0bed-6d19-4ab6-84e7-67dd2f227407@googlegroups.com> <73c2bbe1-15fc-4c29-b500-fb0a637abd91@googlegroups.com> User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: <87175c10-f8fc-4550-856c-6577f1e4acae@googlegroups.com> Subject: Re: Re-write a file in Ada From: gautier_niouzes@hotmail.com Injection-Date: Tue, 19 Jan 2016 16:52:02 +0000 Content-Type: text/plain; charset=ISO-8859-1 Xref: news.eternal-september.org comp.lang.ada:29166 Date: 2016-01-19T08:52:02-08:00 List-Id: 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;