Use -fno-omit-frame-pointer or -fasynchronous-unwind-tables options to make backtraces work better
With GCC, the implicit or explicit use of the "omit-frame-pointer" optimization can interfere with generating backtraces on some architectures. According to cypherpunks on legacy/trac#9299 (moved):
Stack trace unreadable if FPO enabled in general or used optimization options (then FPO applied selectively by compiler depends function's code) for x86 platform. It's not problem for x86_64 because GCC generates unwind tables there by default. If to enable unwind tables by "-fasynchronous-unwind-tables" then stack trace readable with any optimizations.
cypherpunks also notes that starting with GCC 4.6, -fomit-frame-pointer is on by default on several optimization levels.