Re: __builtin_return_address : warkaround need

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Jan 3, 2013 at 10:16 AM, Sergey Ivanov <icegood1980@xxxxxxxxx> wrote:
> Help me to find appropriate worlaround for __builtin_return_address().
>
> and __builtin_return_address(3) returns 0x80568ed
> __builtin_return_address(4) returns  0xb7c8fc7c
> and __builtin_return_address(5) - segmentation fault.
> It would be nice to have same functionality as gdb has for "where" command

As you've discovered, and as is documented, __builtin_return_address
with an argument > 0 is unreliable and can only be used for debugging
purposes.

The mainline version of GCC includes libbacktrace that may suffice for
your purposes.  It requires that you compile with -g, and the current
implementation only works when using ELF, as on GNU/Linux.

Ian


[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux