From c14f1b04861c08d1030e076c586e84c99e92cec5 Mon Sep 17 00:00:00 2001 From: Balazs Kezes Date: Sat, 15 Feb 2014 22:21:23 +0000 Subject: [PATCH] Build glibc with unwind tables Without debug symbols or this you cannot have reliable backtraces in gdb. For instance this is on a Raspberry Pi without the unwind tables: $ gcc -x c <(echo 'void abort(); int main() { abort(); }') $ gdb ./a.out <<< $'r\nbt' ... #1 0xb6eb2e44 in abort () from /usr/lib/libc.so.6 #2 0x00000020 in ?? () Backtrace stopped: previous frame identical to this frame (corrupt stack?) ... Here's with the unwind tables enabled: $ gcc -x c <(echo 'void abort(); int main() { abort(); }') $ gdb ./a.out <<< $'r\nbt' ... #1 0xb6eade44 in abort () from /usr/lib/libc.so.6 #2 0x000084e0 in main () ... The upside of the unwind tables compared to the debug symbols is that they don't take up a lot of space. --- core/glibc/PKGBUILD | 3 +++ 1 file changed, 3 insertions(+) diff --git a/core/glibc/PKGBUILD b/core/glibc/PKGBUILD index 8b0d20a5b..84b46255a 100644 --- a/core/glibc/PKGBUILD +++ b/core/glibc/PKGBUILD @@ -71,6 +71,9 @@ build() { CFLAGS=${CFLAGS/-fstack-protector/} CPPFLAGS=${CPPFLAGS/-D_FORTIFY_SOURCE=2/} + # enable unwinding tables so that gdb can unwind the standard functions + CFLAGS+=" -funwind-tables" + ${srcdir}/${pkgname}-${pkgver}/configure --prefix=/usr \ --libdir=/usr/lib --libexecdir=/usr/lib \ --with-headers=/usr/include \