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=-0.0 required=3.0 tests=BAYES_40,FREEMAIL_FROM, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Received: by 2002:a05:620a:570:b0:6a6:ccb6:3083 with SMTP id p16-20020a05620a057000b006a6ccb63083mr2884299qkp.408.1654557458153; Mon, 06 Jun 2022 16:17:38 -0700 (PDT) X-Received: by 2002:a81:106:0:b0:2d0:e682:8a7a with SMTP id 6-20020a810106000000b002d0e6828a7amr28933028ywb.257.1654557458013; Mon, 06 Jun 2022 16:17:38 -0700 (PDT) Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!weretis.net!feeder8.news.weretis.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: Mon, 6 Jun 2022 16:17:37 -0700 (PDT) In-Reply-To: <629e6842$0$24796$426a74cc@news.free.fr> Injection-Info: google-groups.googlegroups.com; posting-host=174.26.236.234; posting-account=x5rpZwoAAABMN2XPwcebPWPkebpwQNJG NNTP-Posting-Host: 174.26.236.234 References: <629e6842$0$24796$426a74cc@news.free.fr> User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: <368dd024-8697-42bd-bb9c-4239cbe8fca1n@googlegroups.com> Subject: Re: Extra information in the message string of exceptions. From: Jerry Injection-Date: Mon, 06 Jun 2022 23:17:38 +0000 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Xref: reader02.eternal-september.org comp.lang.ada:63938 List-Id: On Monday, June 6, 2022 at 1:49:08 PM UTC-7, DrPi wrote: > Le 06/06/2022 =C3=A0 14:59, Rod Kay a =C3=A9crit :=20 > > Hi all,=20 > >=20 > > Any thoughts on pro's/con's of having the Ada standard packages=20 > > runtime provide extra information in the message string of exceptions ?= =20 > >=20 > > For instance, a Constraint_Error message might provide details on=20 > > the variable name, the legal range and the erroneous value which caused= =20 > > the exception.=20 > > > +1=20 >=20 > >=20 > > Regards. This is not responsive to the OP but here is a bit of code that I find extr= emely useful to get a symbolic =EF=BB=BFtraceback for unhandled exceptions.= Here is an example: with Common; use Common; with Ada.Exceptions; procedure CE_2 is i : Positive; j : Integer :=3D 1; =20 procedure A_Subroutine is begin i :=3D -j; end A_Subroutine; begin A_Subroutine; -- Print a traceback for all unhandled exceptions. -- See http://www.adacore.com/adaanswers/gems/gem-142-exceptions/. exception when Error : others =3D> Common.Print_Traceback_For_Unhandled_Exception(Error); end CE_2; It provides this output: =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D Exception name: CONSTRAINT_ERROR Message: ce_2.adb:10 range check failed Load address: 0x100000000 Call stack traceback locations: 0x1000013ac 0x1000013cd 0x100001c36 <<<<<< Symbolic Traceback >>>>>> If incomplete, compile with -O0. ce_2__a_subroutine.3035 (in run) (ce_2.adb:10) _ada_ce_2 (in run) (ce_2.adb:14) main (in run) (b__ce_2.adb:354) =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D I can post the code that does this if anyone is interested. The gist is cal= ling Ada.Exceptions.Exception_Information, massaging that information, and = calling atos. (Is atos macOS-specific?) Jerry