43 PID = syscall(SYS_gettid);
46 const size_t maxStackSize = 20;
47 void * functionStack[maxStackSize];
52 stackSize = backtrace(functionStack,maxStackSize);
55 char ** functionNames = backtrace_symbols(functionStack,stackSize);
56 if(functionNames == NULL)
58 fprintf(stderr,
"Error in exBase::GenerateStackTrace(). backtrace_symbols failed\n");
62 char * demangledName = NULL;
64 for(
size_t iFunction = 3; iFunction < stackSize; iFunction++)
68 if(functionNames[iFunction] == NULL)
70 AppendStackLine(
"Unknown");
74 char * mangledStart = NULL;
75 char * offsetStart = NULL;
76 char * offsetEnd = NULL;
79 char * bufferEnd = functionNames[iFunction] + strlen(functionNames[iFunction]);
80 for(
char * buffer = functionNames[iFunction];buffer != bufferEnd;buffer++)
84 mangledStart = buffer;
86 else if(*buffer ==
'+')
89 else if( (*buffer ==
')') && (offsetStart != NULL))
97 if( (mangledStart != NULL) &&
98 (offsetStart != NULL) &&
99 (offsetEnd != NULL) &&
100 (mangledStart < offsetStart)
114 size_t demangledSize = 0;
115 int demangledRet = 0;
116 char * retName = abi::__cxa_demangle(mangledStart,
121 if((demangledRet == 0) && (retName != NULL))
124 demangledName = retName;
125 AppendStackLine(demangledName);
129 AppendStackLine(mangledStart);
134 AppendStackLine(functionNames[iFunction]);
138 if(demangledName != NULL)