glibc: Enable backtrace from abort on ARM
PATCH 1/1 glibc: Enable backtrace from abort on ARM
From: Yuanjie Huang <[email protected]>
ARM stack frames for abort and raise were limited to the the actual abort and raise call, such as:
Obtained 4 stack frames. ./test-app(print_trace+0x1c) [0x10a08] ./test-app() [0x10b3c] /lib/libc.so.6(__default_sa_restorer+0) [0x4adae1e0] /lib/libc.so.6(gsignal+0xa0) [0x4adacf74]
This is not terribly useful when trying to figure out what function may have called called the abort, especially when using pthreads.
After the change the trace would now look like:
Obtained 8 stack frames. ./test-app(print_trace+0x1c) [0x10a08] ./test-app() [0x10b3c] /lib/libc.so.6(__default_sa_restorer+0) [0x4befe1e0] /lib/libc.so.6(gsignal+0xa0) [0x4befcf74] /lib/libc.so.6(abort+0x134) [0x4befe358] ./test-app(dummy_function+0x50) [0x10adc] ./test-app(main+0xd4) [0x10c24] /lib/libc.so.6(__libc_start_main+0x114) [0x4bee7a58]
--- meta/recipes-core/glibc/glibc.inc | 6 ++++++ 1 file changed, 6 insertions(+)
meta/recipes-core/glibc/glibc.inc +6 -0
@@ -78,3 +78,9 @@ do_configure_prepend() { } GLIBC_ADDONS ?= "nptl,libidn" + +# Enable backtrace from abort() +do_configure_append_arm () { + echo "CFLAGS-abort.c = -funwind-tables" >> ${B}/configparms + echo "CFLAGS-raise.c = -funwind-tables" >> ${B}/configparms +}
Signature · 1 line
2.11.0.rc1
Forgot to mention, also applicable to Morty.
--Mark
Quoted 47 lines · Mark Hatle
From: Yuanjie Huang <[email protected]>
ARM stack frames for abort and raise were limited to the the actual abort and raise call, such as:
Obtained 4 stack frames. ./test-app(print_trace+0x1c) [
0x10a08] ./test-app() [0x10b3c] /lib/libc.so.6(__default_sa_restorer+0) [0x4adae1e0] /lib/libc.so.6(gsignal+0xa0) [0x4adacf74]This is not terribly useful when trying to figure out what function may have called called the abort, especially when using pthreads.
After the change the trace would now look like:
Obtained 8 stack frames. ./test-app(print_trace+0x1c) [
0x10a08] ./test-app() [0x10b3c] /lib/libc.so.6(__default_sa_restorer+0) [0x4befe1e0] /lib/libc.so.6(gsignal+0xa0) [0x4befcf74] /lib/libc.so.6(abort+0x134) [0x4befe358] ./test-app(dummy_function+0x50) [0x10adc] ./test-app(main+0xd4) [0x10c24] /lib/libc.so.6(__libc_start_main+0x114) [0x4bee7a58]Signed-off-by Yuanjie Huang <[email protected]>Signed-off-by Mark Hatle <[email protected]>--- meta/recipes-core/glibc/glibc.inc | 6 ++++++ 1 file changed, 6 insertions(+)meta/recipes-core/glibc/glibc.inc +6
-0@@ -78,3 +78,9 @@ do_configure_prepend() { } GLIBC_ADDONS ?= "nptl,libidn" + +# Enable backtrace from abort() +do_configure_append_arm () { + echo "CFLAGS-abort.c = -funwind-tables" >> ${B}/configparms + echo "CFLAGS-raise.c = -funwind-tables" >> ${B}/configparms +}
meta/recipes-core/glibc/glibc.inc do_configure_prepend() { · line 86
Quoted 4 lines · Mark Hatle
meta/recipes-core/glibc/glibc.inc +4
-0+do_configure_append_arm () { + echo "CFLAGS-abort.c = -funwind-tables" >> ${B}/configparms + echo "CFLAGS-raise.c = -funwind-tables" >> ${B}/configparms +}
perhaps using -fasynchronous-unwind-tables is better. can you try that out ?
Quoted 8 lines · Khem Raj
meta/recipes-core/glibc/glibc.inc do_configure_prepend() { · line 86
Quoted 4 lines · Mark Hatle
meta/recipes-core/glibc/glibc.inc +4
-0+do_configure_append_arm () { + echo "CFLAGS-abort.c = -funwind-tables" >> ${B}/configparms + echo "CFLAGS-raise.c = -funwind-tables" >> ${B}/configparms +}perhaps using -fasynchronous-unwind-tables is better. can you try that out ?
This passed my internal test with the same results.
So either one is fine with me. What is the difference between the options?
--Mark
Quoted 10 lines · Mark Hatle
Quoted 8 lines · Khem Raj
meta/recipes-core/glibc/glibc.inc do_configure_prepend() { · line 86
Quoted 4 lines · Mark Hatle
meta/recipes-core/glibc/glibc.inc +4
-0+do_configure_append_arm () { + echo "CFLAGS-abort.c = -funwind-tables" >> ${B}/configparms + echo "CFLAGS-raise.c = -funwind-tables" >> ${B}/configparms +}perhaps using -fasynchronous-unwind-tables is better. can you try that out ?
Quoted 3 lines
This passed my internal test with the same results.
So either one is fine with me. What is the difference between the options?
-fasynchronous-unwind-tables when used with -g emits the static data in dward2 into .debug_frame
sections so your binaries dont bloat. funwind-tables is for generating static data that is needed for exception handing into .eh_frame.
Quoted 2 lines
--Mark