@@ -34,14 +34,19 @@ void print_stacktrace(FILE* output, int start_idx, bool demangling, int maxdepth
3434 // 32 vs. 64bit
3535#define ADDRESSDISPLAYLENGTH ((sizeof (long )==8 )?12 :8 )
3636 void *callstackArray[32 ]= {nullptr }; // the less resources the better...
37+ fputs (" backtrace\n " , output);
3738 const int currentdepth = backtrace (callstackArray, static_cast <int >(getArrayLength (callstackArray)));
39+ fprintf (output, " currentdepth %d" , currentdepth);
3840 // set offset to 1 to omit the printing function itself
3941 int offset=start_idx+1 ; // some entries on top are within our own exception handling code or libc
42+ fprintf (output, " offset %d" , offset);
4043 if (maxdepth<0 )
4144 maxdepth=currentdepth-offset;
4245 else
4346 maxdepth = std::min (maxdepth, currentdepth);
47+ fprintf (output, " maxdepth %d" , maxdepth);
4448
49+ fputs (" backtrace_symbols\n " , output);
4550 char **symbolStringList = backtrace_symbols (callstackArray, currentdepth);
4651 if (!symbolStringList) {
4752 fputs (" Callstack could not be obtained\n " , output);
@@ -53,6 +58,7 @@ void print_stacktrace(FILE* output, int start_idx, bool demangling, int maxdepth
5358 char demangle_buffer[2048 ]= {0 };
5459 for (int i = offset; i < maxdepth; ++i) {
5560 const char * const symbolString = symbolStringList[i];
61+ fprintf (output, " symbolString %p" , symbolString);
5662 // skip all leading libc symbols so the first symbol is our code
5763 if (omit_above_own && !own_code) {
5864 if (strstr (symbolString, " /libc.so.6" ) != nullptr )
0 commit comments