Subject: Re: [boost] [thread] thread_proxy's catch(...) destroys my stack info for unhandled exceptions
From: Neil Groves (neil_at_[hidden])
Date: 2008-12-29 12:15:21
On Mon, Dec 29, 2008 at 5:03 PM, Roberto Gimenez <chilabot_at_[hidden]> wrote:
> Dmitry Goncharov <dgoncharov <at> unison.com> writes:
> > >
> > On linux you can save your call stack in an exception object and read it
> > in a catch block.
> > Have a look at execinfo.h (usually /usr/include/execinfo.h). backtrace()
> > is to obtain the backtrace.
> > backtrace_symbols() is to get the function names of the addresses
> > returned by backtrace().
> > backtrace_symbols() returns manged names, so you'll want to demangle the
> > names with __cxa_demangle() (from cxxabi.h).
> > Br, Dmitry
> > _______________________________________________
> > Unsubscribe & other changes:
> This is very interesting, unfortunately backtrace() is not available on all
> systems (including mine, Solaris). Even if it was avaiable in mine,
> I don't think I would want to use it since I aim writing portable code in
> general. It would be great if a general, portable, standard way of
> the stacktrace was available, in the form of a library, since working
> with core-dumps is sometimes very impractical.
A library of this type that wraps the numerous platform specific
implementations would definitely be useful. IIRC you can use printstack()
and walkcontext() functions on Solaris 9 and above.
See http://docs.sun.com/app/docs/doc/817-0710/6mgg8q939?a=view for more
Are you volunteering to submit a stacktrace library to Boost? ;-)
> Unsubscribe & other changes:
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk