Re: Does __builtin_frame_address() work with C++ code?
|[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]|
On Mon, Jul 30, 2012 at 3:50 AM, Sam Varshavchik <mrsam@xxxxxxxxxxxxxxx> wrote: > I suspect that the answer is no. I don't seem to have much difficulty in > getting __builtin_frame_address() to segfault when using C++ code, in gcc > 4.7, like with the following example (on x86-64). __builtin_frame_address works just as well for C++ as it does for C. But in both cases whether it works with non-zero arguments depends on the target and the compilation options. It should normally work if you compile with -fno-omit-frame-pointer. > I'm looking at all the work that glibc's backtrace() does, and it's a far > cry from what I see that __builtin_frame_address() generates. Yes, the backtrace function is far more reliable. __builtin_frame_address is intended to be a quick and dirty function for debugging purposes. Ian