comp.lang.ada
 help / color / mirror / Atom feed
From: Martin Kristensson <d95krima@dtek.chalmers.se>
Subject: Re: GNAT exception traceback
Date: 1997/06/14
Date: 1997-06-14T00:00:00+00:00	[thread overview]
Message-ID: <33A287A6.7C16@dtek.chalmers.se> (raw)
In-Reply-To: 339EFAE3.26C@ccis.adisys.com.au


Steve Gibson wrote:
(snip)
> My question is, without running gdb or adding additional exception
> handlers, is it possible to generate traceback information to determine
> which line of code in which package generated the exception, and if so
> how ?
> 
> For example:
>     CONSTRAINT_ERROR exception raised in package XXX line i
>     CONSTRAINT_ERROR exception propagated out of package YYY line j
>     CONSTRAINT_ERROR exception propagated out of package Main line k
(snip)

Why not simply add an exception handler to each subprogram, which will
store the name of the subprogram (or simply echo the name to the
terminal) and then re-raise the exception.

...
exception
   when others => Trace_Exception(Package_Name, 
                                  Subprogram_Name);
                  raise;
end Subprogram;

The final handler (i.e. the main program) can print/store the name of
the raised exception (using Ada.Exceptions.Name), together with a
message to the user.

If it seems like to much work, use a script to insert the extra lines,
or only add the handler to routines that are "at the start of" the call
chain.

We use this approach at work, since our customers use classified
(military) input files, so we generally can't recreate the error.
The exception trace file provides at least a clue to what went wrong.

/Martin.




  parent reply	other threads:[~1997-06-14  0:00 UTC|newest]

Thread overview: 47+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1997-06-11  0:00 GNAT exception traceback Steve Gibson
1997-06-12  0:00 ` Robert Dewar
1997-06-13  0:00   ` Mats.Weber
1997-06-14  0:00     ` Robert Dewar
1997-06-16  0:00       ` Mats.Weber
1997-06-16  0:00         ` Fergus Henderson
1997-06-16  0:00         ` Robert Dewar
1997-06-16  0:00     ` Gautier
1997-06-17  0:00       ` Robert Dewar
1997-06-14  0:00   ` Aaron Metzger
1997-06-14  0:00     ` Robert Dewar
1997-06-14  0:00       ` Robert A Duff
1997-06-16  0:00       ` Spam Hater
1997-06-17  0:00         ` Robert Dewar
1997-06-17  0:00         ` Robert Dewar
1997-06-16  0:00       ` Corey Minyard
1997-06-16  0:00     ` Spam Hater
1997-06-17  0:00       ` Robert Dewar
1997-06-19  0:00         ` Geert Bosch
1997-06-18  0:00       ` Samuel Tardieu
1997-06-18  0:00       ` Richard Kenner
1997-06-14  0:00 ` Martin Kristensson [this message]
1997-06-14  0:00   ` Robert Dewar
  -- strict thread matches above, loose matches on Subject: below --
1997-06-19  0:00 Chris Sparks (Mr. Ada)
1997-06-16  0:00 Chris Sparks (Mr. Ada)
1997-06-16  0:00 ` Robert Dewar
1997-06-13  0:00 Huy Vo
1997-06-13  0:00 ` Robert Dewar
1997-06-16  0:00   ` wiljan
1997-06-17  0:00     ` Robert Dewar
1997-06-17  0:00       ` Spam Hater
1997-06-17  0:00         ` Corey Minyard
1997-06-17  0:00           ` Spam Hater
1997-06-18  0:00             ` Corey Minyard
1997-06-18  0:00               ` Spam Hater
1997-06-18  0:00                 ` Tom Moran
1997-06-20  0:00                   ` Robert Dewar
1997-06-19  0:00                 ` Corey Minyard
1997-06-20  0:00                 ` Robert Dewar
1997-06-20  0:00                 ` Richard Kenner
1997-06-18  0:00         ` Richard Kenner
1997-06-17  0:00       ` Robert A Duff
1997-06-19  0:00         ` Michael F Brenner
1997-06-23  0:00   ` Geert Bosch
1997-06-27  0:00     ` Michael F Brenner
1997-07-02  0:00     ` Robert Dewar
     [not found] <82@pluto.win-uk.net>
1996-02-17  0:00 ` GNAT : Exception traceback Robert Dewar
replies disabled

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