[Xorp-hackers] Runtime diagnostics and callbacks in backtraces

Bruce Simpson bms at incunabulum.net
Tue Nov 17 08:35:16 PST 2009


Bruce Simpson wrote:
> [1] P.S. I reckon a backtrace dumper for production builds could be 
> knocked up really quickly.

This guy has the magic:
    http://idlebox.net/2008/0901-stacktrace-demangled/

... so I guess a SCons check is needed for backtrace() and 
backtrace_symbols() in libexecinfo (the *BSD port of the GLIBC 
backtrace() module) and libc, __cxa_demangle() in libstdc++, plus header 
checks on <execinfo.h> and <cxxabi.h>.

I'd probably add an XLOG_BACKTRACE() macro to xlog.h, and omit the 
time/date prologue appropriately using something similar to 
XLOG_LEVEL_RTRMGR_ONLY_NO_PREAMBLE.

I'd introduce the backtrace wrapper code to xorp_backtrace() in 
libxorp/debug.c. We can't really get away from using heap storage in 
this situation (because of all the string processing), so if the heap is 
toasted, all bets are off.

XLOG_FATAL() and XLOG_ASSERT() could then be taught to xorp_backtrace() 
in most situations.

I'm off out the door now today. If I hadn't been stuck on C++0x template 
aliases, this would probably be done now.

cheers,
BMS



More information about the Xorp-hackers mailing list