https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71951
Icenowy Zheng <icenowy at aosc dot io> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |icenowy at aosc dot io --- Comment #10 from Icenowy Zheng <icenowy at aosc dot io> --- In my environment (glibc 2.25, and both the building scripts of glibc and gcc have -fomit-frame-pointer automatically enabled), this bug is not fully resolved yet. With GCC upgraded to 6.4.0, GDB debugger started to work correctly. (With GCC 6.3.0 GDB cannot even work and segfault at unwind code in libgcc). However, if I still build GCC with -fomit-frame-pointer in CFLAGS, the backtrace() function of glibc cannot work, and segfault at line 240 of libgcc/unwind-dw2.c . By reading the source code, I think the unwind code is still trying to get CFA from the register x29, and when debugging I found that the x29 register in the unwind context is 0 (because of -fomit-frame-pointer), so line 240 is dereferencing a NULL pointer, so it segfaulted. Maybe the behavior that accessing x29 register to get CFA is not correct?