
On Mon, Dec 29, 2008 at 5:03 PM, Roberto Gimenez <chilabot@gmail.com> 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: http://lists.boost.org/mailman/listinfo.cgi/boost
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 retrieving 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 information. Are you volunteering to submit a stacktrace library to Boost? ;-) Regards, Neil Groves
_______________________________________________ Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost