1#include <Core/Utils/StackTrace.hpp>
2#include <radium_backtrace.h>
11 const int nMaxFrames =
sizeof( callstack ) /
sizeof( callstack[0] );
13 int nFrames = backtrace( callstack, nMaxFrames );
16 for (
int i = skip; i < nFrames; i++ ) {
18 if ( dladdr( callstack[i], &info ) ) {
19 char* demangled =
nullptr;
21 demangled = abi::__cxa_demangle( info.dli_sname, NULL, 0, &status );
24 "%-3d %*0p %s + %td\n",
26 int( 2 +
sizeof(
void* ) * 2 ),
28 status == 0 ? demangled : info.dli_sname,
29 (
char*)callstack[i] - (
char*)info.dli_saddr );
37 int( 2 +
sizeof(
void* ) * 2 ),
42 if ( nFrames == nMaxFrames ) trace_buf <<
" [truncated]\n";
43 return trace_buf.
str();
45 return "Execution stack trace not available.";
hepler function to manage enum as underlying types in VariableSet