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 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’];