Exception Hierarchy [WAS: Re: Top 5]

Brad Roberts braddr at bellevue.puremagic.com
Fri Oct 17 18:39:15 PDT 2008


On Fri, 17 Oct 2008, Benji Smith wrote:

> Sean Kelly wrote:
> > Benji Smith wrote:
> > > Sean Kelly wrote:
> > > > Denis Koroskin wrote:
> > > > > Will we still be able to throw Object? Is Throwable an interface or a
> > > > > class?
> > > > 
> > > > Throwable is a class, and contains all the stuff that Exception once
> > > > contained: message, file, line, a "next" reference, and trace info.
> > > 
> > > Really???
> > > 
> > > Trace info? On all throwables?
> > > 
> > > That would be fantastic!!!
> > 
> > Throwable only provides a callback for trace info to be generated. You'll
> > still need to link a package that actually generates the trace. I used to
> > use flectioned for this purpose, but it's too stale now and no longer works.
> > However, this is exactly why tracing is supported via a plugin :-)
> 
> Gotcha. Well, I suppose that's okay. Do you know if there are any stacktracing
> libraries that currently work with D1?
> 
> For Sean, Walter & Andrei: any opinions about including stack tracing in the
> core runtime?
> 
> --benji

For anything running on top of glibc (ie, every linux distribution) it's 
fairly trivial via backtrace() and backtrace_symbols() found in 
execinfo.h.  The symbols are the mangled form, but that's a simple matter 
of code to translate back to more meaningful names.  An incomplete version 
of that is available in phobos already (and probably somewhere in Tango 
too) -- and it should really be in the core runtime, probably.

Given the 2 or 3 implementations floating around, I imagine it wouldn't be 
hard to integrate for both windows and linux.

Later,
Brad



More information about the Digitalmars-d mailing list