backtrace
Win32 – Backtrace from C code
Alright, now I got it. : ) The problem was in the SYMBOL_INFO structure. It needs to be allocated on the heap, reserving space for the symbol name, and initialized properly. Here’s the final code: void printStack( void ); void printStack( void ) { unsigned int i; void * stack[ 100 ]; unsigned short frames; … Read more
How can I get PHP to produce a backtrace upon errors?
Xdebug prints a backtrace table on errors, and you don’t have to write any PHP code to implement it. Downside is you have to install it as a PHP extension.
How to make backtrace()/backtrace_symbols() print the function names?
The symbols are taken from the dynamic symbol table; you need the -rdynamic option to gcc, which makes it pass a flag to the linker which ensures that all symbols are placed in the table. (See the Link Options page of the GCC manual, and / or the Backtraces page of the glibc manual.)
How do I get the backtrace for all the threads in GDB?
Generally, the backtrace is used to get the stack of the current thread, but if there is a necessity to get the stack trace of all the threads, use the following command. thread apply all bt
How to get name of calling function/method in PHP? [duplicate]
The simplest way is: echo debug_backtrace()[1][‘function’]; As noted in the comments below, this can be further optimized by passing arguments to: omit both the object and args indices limit the number of stack frames returned echo debug_backtrace(!DEBUG_BACKTRACE_PROVIDE_OBJECT|DEBUG_BACKTRACE_IGNORE_ARGS,2)[1][‘function’];