[categories] [index] [all (552)] [latest]
void x() { void *returnAddress = __builtin_return_address(0); printf("%p\n", returnAddress); }
The level argument is number of frames to scan up the call stack.
See http://gcc.gnu.org/onlinedocs/gcc/Return-Address.html.