__builtin_return_address question

Neal D. Becker nbecker@hns.com
Wed Aug 21 09:05:00 GMT 2002


>>>>> "Andrew" == Andrew Haley <aph@cambridge.redhat.com> writes:

    Andrew> Neal D. Becker writes:
    >> I'm trying to make a stack trace function.  Use of
    >> __builtin_return_address looks promising, but the arg has to be a
    >> constant expression.  Because the arg can't be a variable, I don't see
    >> how I can traceback more than one level of the stack.  Any ideas?

    Andrew> It depends on the architecture.  With some ABIs unwinding is trivial
    Andrew> pointer chasing, but with others it can be very difficult.  See
    Andrew> backtrace() in the glibc source.

Thanks for the info on backtrace.  What if I want to demangle the
result?




More information about the Gcc mailing list