I'm curious why __builtin_return_address() doesn't supports other arguments than 0 in ARM ?
It's a problem that somehow you can't deduce calling function address from the stack of ARM ?
Or something else ?
Thanks
According to this post <http://codingrelic.geekhold.com/2009/05/pre-mortem-backtracing.html>,
Also on some architectures, including my beloved MIPS, only
__builtin_return_address(0)works. MIPS has no frame pointer, making it difficult to walk back up the stack. Frame 0 can use the return address register directly. If ARM also does not have a frame pointer, this would explain the limitation.
See also http://gcc.gnu.org/onlinedocs/gcc/Return-Address.html.
R14, and it is the duty of the callee to save it when calling another function. So even with a frame pointer, there is no guarantee that the return address is ever stored on the stack.__builtin_return_address to be a call to a heavy weight unwind library call rather than a trivial builtin...no_instrument_function attribute where max speed of call is required...)Backtrace on ARM is hard. The Glibc backtrace function does work these days, but you need an up to date compiler/glibc, and you need to have built everything with -funwind-tables. GDB also has trouble without debug info.