29 size_t size = ::backtrace( array, arraySize );
32 char ** messages = ::backtrace_symbols( array, size );
35 static const size_t first = 1;
36 for (
size_t i = first; i < size; ++i )
38 char * mangled_name = 0;
39 char * offset_begin = 0;
40 char * offset_end = 0;
43 for (
char * p = messages[i]; *p; ++p )
64 if ( mangled_name && offset_begin && offset_end && mangled_name < offset_begin )
66 *mangled_name++ =
'\0';
67 *offset_begin++ =
'\0';
71 char * real_name = ::abi::__cxa_demangle( mangled_name, 0, 0, &status );
76 stream_r <<
"[bt]: (" << i <<
") " << messages[i] <<
" : "
77 << real_name <<
"+" << offset_begin << offset_end;
83 stream_r <<
"[bt]: (" << i <<
") " << messages[i] <<
" : "
84 << mangled_name <<
"+" << offset_begin << offset_end;
91 stream_r <<
"[bt]: (" << i <<
") " << messages[i];
std::ostream & dumpBacktrace(std::ostream &stream_r)
Dump current stack trace to a stream.