From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on ip-172-31-65-14.ec2.internal X-Spam-Level: X-Spam-Status: No, score=-1.9 required=3.0 tests=BAYES_00,FREEMAIL_FROM, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Received: by 2002:a05:620a:248f:b0:6a6:ee8e:712e with SMTP id i15-20020a05620a248f00b006a6ee8e712emr7121400qkn.690.1654742357320; Wed, 08 Jun 2022 19:39:17 -0700 (PDT) X-Received: by 2002:a25:6744:0:b0:65d:46d6:d9a0 with SMTP id b65-20020a256744000000b0065d46d6d9a0mr37925564ybc.467.1654742357141; Wed, 08 Jun 2022 19:39:17 -0700 (PDT) Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!news.mixmin.net!proxad.net!feeder1-2.proxad.net!209.85.160.216.MISMATCH!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail Newsgroups: comp.lang.ada Date: Wed, 8 Jun 2022 19:39:16 -0700 (PDT) In-Reply-To: Injection-Info: google-groups.googlegroups.com; posting-host=174.26.236.234; posting-account=x5rpZwoAAABMN2XPwcebPWPkebpwQNJG NNTP-Posting-Host: 174.26.236.234 References: <3bc7a99c-d541-497b-b3fd-7a6db0ee0de9n@googlegroups.com> <574017e3-d354-41b9-87a1-1f3aa6edf4a2n@googlegroups.com> User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: <80571cfa-d4d0-4ea3-8587-8b9dbc5f8725n@googlegroups.com> Subject: Re: Extra information in the message string of exceptions. From: Jerry Injection-Date: Thu, 09 Jun 2022 02:39:17 +0000 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Xref: reader02.eternal-september.org comp.lang.ada:63955 List-Id: On Wednesday, June 8, 2022 at 1:04:32 AM UTC-7, Dmitry A. Kazakov wrote: > On 2022-06-08 09:31, Jerry wrote:=20 > > On Tuesday, June 7, 2022 at 8:56:00 AM UTC-7, Fabien Chouteau wrote:=20 > >> On Monday, June 6, 2022 at 3:40:38 PM UTC+2, Fabien Chouteau wrote:=20 > >>> But this feature could be activated with a switch only when needed.= =20 > >> Well, it turns our this is already implemented in GNAT ^^=20 > >>=20 > >> Example here: https://godbolt.org/z/fcTEaq3xP=20 > > Indeed. The switch is -GNATeE. It provides additional information for t= he program at that page,=20 > >=20 > > procedure Main is=20 > > procedure Test (A : Integer) is=20 > > type T is range 0 .. 42;=20 > > begin=20 > > Ada.Text_IO.Put_Line (T (A)'Img);=20 > > end;=20 > > begin=20 > > Test (-1);=20 > > end Main;=20 > >=20 > > But has no effect on this program;=20 > >=20 > > procedure CE_2 is=20 > > i : Positive;=20 > > j : Integer :=3D 1;=20 > > begin=20 > > i :=3D -j;=20 > > end CE_2; > The switches are -E for binder and -g for everything else. Try this:=20 >=20 > --- test_ce.gpr ----------------------------------------=20 > project Test_CE is=20 > for Source_Files use ("test_ce.adb");=20 > for Main use ("test_ce.adb");=20 >=20 > package Binder is=20 > for Default_Switches ("ada") use ("-E");=20 > end Binder;=20 >=20 > package Builder is=20 > for Default_Switches ("ada") use ("-g");=20 > end Builder;=20 >=20 > package Compiler is=20 > for Default_Switches ("ada") use ("-g");=20 > end Compiler;=20 >=20 > package Linker is=20 > for Default_Switches ("ada") use ("-g");=20 > end Linker;=20 >=20 > end Test_CE;=20 > --- test_ce.adb ----------------------------------------=20 > with System.Exception_Traces; use System.Exception_Traces;=20 > with System.Traceback.Symbolic;=20 >=20 > procedure Test_CE is > i : Positive;=20 > j : Integer :=3D 1;=20 > begin > Trace_On (System.Exception_Traces.Unhandled_Raise);=20 > Set_Trace_Decorator=20 > ( System.Traceback.Symbolic.Symbolic_Traceback'Access=20 > );=20 > i :=3D -j;=20 > end Test_CE;=20 >=20 > Notes:=20 >=20 > 1. You can just use Symbolic_Traceback whenever you want. E.g. you can=20 > set an exception handler and dump traceback at the raising point. It is= =20 > slow as hell, of course.=20 >=20 > 2. There are problems getting symbolic traceback working on ARM.=20 >=20 > 3. This becomes pretty much useless with relocated libraries. I do not=20 > know how to make it work with them.=20 >=20 > 4. Under Windows you will not get traceback from non-GCC compiled stuff= =20 > because it does not understand *.pdb files. > --=20 > Regards,=20 > Dmitry A. Kazakov=20 > http://www.dmitry-kazakov.de Hmm.... I get the same "Message" i.e. no extra information and only hex tra= ceback info. Docs say -E is the same as -Ea meaning hex traceback, plus my = set-up rejects -Ea (and -Es) as illegal switches. (Not sure at this point i= f we're chasing symbolic traceback or extra compiler information.)