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
The function return address is placed on the stack by the x86 CALL instruction, which stores the current value of the EIP register. Then, the frame pointer that is the previous value of the EBP register is placed on the stack.
__builtin_frame_address, __builtin_return_addressReturns the address of the stack frame, or return address, of the current function, or of one of its callers.
In assembly language, the call instruction handles passing the return address for you, and ret handles using that address to return back to where you called the function from. return value. The return value is the main method of transferring data back to the main program.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With