Bug#165992: gcc: __builtin_return_address doesn't work properly
Greg Stark <gsstark@mit.edu> writes:
> Well, that's not what my documentation from GCC 2.95 says:
>
> On some machines it may be impossible to determine the return
> address of any function other than the current one; in such cases,
> or when the top of the stack has been reached, this function will
> return `0'.
So you have found a bug in the 2.95 documentation. Just imagine it
would have the same text as the 3.2 documentation.
> I'm puzzled why I can use __builtin_frame_address to determine if
> the top of the stack has been reached but gcc's builtin can't do the
> same for me. I must be missing something, how do gdb and other tools
> happily decode stack traces all the time without crashing?
They are not very happy in doing so :-) They use lots of heuristics
which are unavailable to __builtin_return_address.
Regards,
Martin
Reply to: