From: Jerry <list_email@icloud.com>
Subject: Re: Extra information in the message string of exceptions.
Date: Mon, 6 Jun 2022 16:17:37 -0700 (PDT) [thread overview]
Message-ID: <368dd024-8697-42bd-bb9c-4239cbe8fca1n@googlegroups.com> (raw)
In-Reply-To: <629e6842$0$24796$426a74cc@news.free.fr>
On Monday, June 6, 2022 at 1:49:08 PM UTC-7, DrPi wrote:
> Le 06/06/2022 à 14:59, Rod Kay a écrit :
> > Hi all,
> >
> > Any thoughts on pro's/con's of having the Ada standard packages
> > runtime provide extra information in the message string of exceptions ?
> >
> > For instance, a Constraint_Error message might provide details on
> > the variable name, the legal range and the erroneous value which caused
> > the exception.
> >
> +1
>
> >
> > Regards.
This is not responsive to the OP but here is a bit of code that I find extremely useful to get a symbolic traceback for unhandled exceptions. Here is an example:
with Common; use Common;
with Ada.Exceptions;
procedure CE_2 is
i : Positive;
j : Integer := 1;
procedure A_Subroutine is
begin
i := -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 =>
Common.Print_Traceback_For_Unhandled_Exception(Error);
end CE_2;
It provides this output:
==========================================================
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)
==========================================================
I can post the code that does this if anyone is interested. The gist is calling Ada.Exceptions.Exception_Information, massaging that information, and calling atos. (Is atos macOS-specific?)
Jerry
next prev parent reply other threads:[~2022-06-06 23:17 UTC|newest]
Thread overview: 31+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-06-06 12:59 Extra information in the message string of exceptions Rod Kay
2022-06-06 13:40 ` Fabien Chouteau
2022-06-06 18:40 ` G.B.
2022-06-06 19:24 ` Dmitry A. Kazakov
2022-06-07 11:26 ` Rod Kay
2022-06-07 15:55 ` Fabien Chouteau
2022-06-07 16:41 ` Anh Vo
2022-06-08 7:31 ` Jerry
2022-06-08 8:04 ` Dmitry A. Kazakov
2022-06-09 2:39 ` Jerry
2022-06-08 9:08 ` Dmitry A. Kazakov
2022-10-27 11:56 ` Rod Kay
2022-10-29 0:35 ` Jerry
2022-10-29 3:10 ` Rod Kay
2022-10-29 6:30 ` Gautier write-only address
2022-10-29 8:59 ` G.B.
2022-11-01 0:05 ` Jerry
2022-06-06 14:31 ` Gautier write-only address
2022-06-07 2:33 ` Randy Brukardt
2022-06-07 11:47 ` Rod Kay
2022-06-07 11:29 ` Rod Kay
2022-06-06 20:14 ` Luke A. Guest
2022-06-07 11:51 ` Rod Kay
2022-06-07 21:06 ` Luke A. Guest
2022-06-06 20:49 ` DrPi
2022-06-06 23:17 ` Jerry [this message]
2022-06-07 1:53 ` Gautier write-only address
2022-06-07 2:35 ` Randy Brukardt
2022-06-07 8:07 ` Simon Wright
2022-06-08 7:14 ` Jerry
2022-06-09 8:21 ` Robin Vowels
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox