comp.lang.ada
 help / color / mirror / Atom feed
From: brbarkstrom@gmail.com
Subject: Re: How to get nice with GNAT?
Date: Sun, 23 Nov 2014 09:41:08 -0800 (PST)
Date: 2014-11-23T09:41:08-08:00	[thread overview]
Message-ID: <dda292cb-97ac-4ab5-b29d-b3c0ec232c5b@googlegroups.com> (raw)
In-Reply-To: <slrnm6u97f.nrc.lithiumcat@nat.rebma.instinctive.eu>

On Friday, November 21, 2014 6:41:45 AM UTC-5, Natasha Kerensikova wrote:
> Hello,
> 
> I happen to have found a situation in which symbolic traceback is a
> great help, but I have been a bit surprise by the (lack of) support in
> the platform to which I have access.
> 
> I have been using GNAT.Traceback.Symbolic.Symbolic_Traceback, is there a
> more portable way?
> 
> In FreeBSD, with GNAT 4.9.0, I get an output like the following, with
> the first line actually repeated about a hundred times:
> > BFD: Dwarf Error: found dwarf version '4', this reader only handles version 2 information.
> > 0x7e7773 in asis.gela.contexts.open at ??:0
> > 0x78cb43 in asis.ada_environments.open at ??:0
> > 0x46a7da in adactl at ??:0
> > 0x40690e in main at ??:0
> > 0x4069df in <_start> at ??:0
> > 0x800da3ffe in ?? at ??:0
> 
> In Debian/kFreeBSD, with GNAT 4.6, it looks like the following, which is
> what I consider as perfect:
> > 0x7fa993 in asis.ada_environments.open at asis-ada_environments.adb:241
> > 0x481a57 in adactl at adactl.adb:90
> > 0x417029 in main at b~adactl.adb:817
> > 0x8015a4347 in ?? at ??:0
> > 0x41706e in <_start> at ??:0
> 
> In Fedora 20, with GNAT 4.8.3, it looks like the following, which I find
> the worst:
> > 0x000000000069307D
> > 0x00000000004733BD
> > 0x0000000000410824
> > 0x0000003CC5A21D63
> > 0x000000000041086F
> > 0xFFFFFFFFFFFFFFFE
> 
> Considering the versions, I doubt that's the cause for the discrepancy.
> I would rather wager on something related to addr2line.
> 
> As a user, is there something I can do to improve the traceback
> representation on those platforms?
> Or is it completely in the hands of the GNAT packager/maintainer?
> 
> 
> Thanks in advance for your help,
> Natasha

I'm working in GNAT GPL, so my suggestion may not work with every
compiler.

On the other hand, in my code, the if following the exception in the
procedure is picked up and executed properly.  The code doesn't act
like the program has to fail if any exception is raised.

It may be that the sensible approach is to try this solution on the
compiler you have at hand.  If it doesn't work, you'll need to do something
else.  If it does, I think it can be helpful in diagnosing problems,
particularly if you have conditions where the system exceptions (like
those in the IO_Exceptions package) are not the only ones a particular 
algorithm might raise.

I'm often doing debugging on sequential algorithms.  However, sending out
a Bounded_String to print may not work well in a concurrent environment.
An approach that may be useful (at least for GNAT) would be to assign
a numerical code value to the error message.  In that case, a procedure
might act like a C subroutine that returns a numerical value of 0 if 
there were no exceptions or some other value if there was one.

With some careful system design, it would be possible to arrange for an 
exception classification.  Thus, some exceptions could be classified as fatal 
and lead to shutdown.  Other exceptions could be classified as "nuisances" 
and logged.  The difficulty in dealing with error classification early in 
the design process is that the design is malleable.  Thus, one could either 
spend a fair amount of development time pinning down the structure of the 
exceptions or do the formalization after there's some experience.

Some kinds of exceptions, such as equipment failures, may be difficult to
handle regardless.  If the CPU that's executing the procedural code fails
in the middle of the procedure (because of a power outage caused by a a failure
of the UPS), it's obvious that there won't be an exception handling message
coming out of the procedure.  However, algorithmic exceptions don't necessarily
have that kind of critical character.

Bruce B.

  parent reply	other threads:[~2014-11-23 17:41 UTC|newest]

Thread overview: 59+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-11-21 11:41 How to get nice with GNAT? Natasha Kerensikova
2014-11-21 12:42 ` Björn Lundin
2014-11-21 22:55 ` Randy Brukardt
2014-11-21 23:13   ` Björn Lundin
2014-11-22  9:45   ` How to get nice traceback " Natasha Kerensikova
2014-11-22  9:57     ` Dmitry A. Kazakov
2014-11-24 22:35     ` Randy Brukardt
2014-11-22 10:11 ` How to get nice " gautier_niouzes
2014-11-22 10:40   ` Natasha Kerensikova
2014-11-22 22:44 ` brbarkstrom
2014-11-22 23:24   ` Jeffrey Carter
2014-11-23 18:06   ` Björn Lundin
2014-11-23 16:13 ` brbarkstrom
2014-11-23 16:18   ` J-P. Rosen
2014-11-23 17:02   ` Jeffrey Carter
2014-11-23 17:41 ` brbarkstrom [this message]
2014-11-23 19:22   ` Simon Wright
2014-11-23 20:49   ` Jeffrey Carter
2014-11-24  3:05     ` brbarkstrom
2014-11-24  6:25       ` Jeffrey Carter
2014-11-24 14:39         ` brbarkstrom
2014-11-24 17:42       ` Dennis Lee Bieber
2014-11-25 13:45         ` brbarkstrom
2014-11-25 15:07           ` ake.ragnar.dahlgren
2014-11-25 15:51             ` brbarkstrom
2014-11-25 16:52             ` Jeffrey Carter
2014-11-25 19:18             ` G.B.
2014-11-25 20:47               ` brbarkstrom
2014-11-25 22:12             ` Randy Brukardt
2014-11-25 23:30               ` Simon Wright
2014-11-26  1:25                 ` G.B.
2014-11-26  7:35                   ` Simon Wright
2014-11-26 11:55                     ` Georg Bauhaus
2014-11-26 13:06                       ` Dmitry A. Kazakov
2014-11-26 13:36                         ` brbarkstrom
2014-11-26 21:27                         ` Randy Brukardt
2014-11-26 22:38                           ` brbarkstrom
2014-11-27  9:01                             ` Dmitry A. Kazakov
2014-11-27 13:53                               ` brbarkstrom
2014-11-27 17:19                                 ` Dmitry A. Kazakov
2014-12-01 22:25                                   ` Randy Brukardt
2014-12-02  8:42                                     ` Dmitry A. Kazakov
2014-12-03 21:41                                       ` Randy Brukardt
2014-12-06 12:02                                         ` Dmitry A. Kazakov
2014-12-08 22:45                                           ` Randy Brukardt
2014-12-09  8:51                                             ` Dmitry A. Kazakov
2014-12-09 23:14                                               ` Brad Moore
2014-12-09 17:59                                                 ` Dmitry A. Kazakov
2014-11-27  8:52                           ` Dmitry A. Kazakov
2014-11-26  6:18                 ` J-P. Rosen
2014-11-26  7:37                   ` Simon Wright
2014-11-26  8:41               ` Dmitry A. Kazakov
2014-11-25 18:33           ` Dennis Lee Bieber
2014-11-26  1:27             ` Dennis Lee Bieber
2014-11-26  3:29               ` brbarkstrom
2014-11-23 18:55 ` brbarkstrom
2014-11-23 19:30 ` brbarkstrom
2014-11-23 22:38   ` Simon Wright
2014-11-24  2:47     ` brbarkstrom
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox