This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: ARM Linux EABI: unwinding through a segfault handler
- From: mads_bn <madsbn at mail dot dk>
- To: gcc at gcc dot gnu dot org
- Date: Tue, 3 Feb 2015 15:41:30 -0700 (MST)
- Subject: Re: ARM Linux EABI: unwinding through a segfault handler
- Authentication-results: sourceware.org; auth=none
- References: <4E563F58 dot 2060006 at redhat dot com> <4E5BADCC dot 4060809 at linaro dot org> <CAN9gPaHOOuNmNwN04jx5CkFNwPUiwjn9R_1H=XLJ06T3fMnYKw at mail dot gmail dot com> <201110270215 dot 09012 dot paul at codesourcery dot com> <4EA918D0 dot 3000009 at redhat dot com> <201110271253 dot 14077 dot paul at codesourcery dot com> <4EA94748 dot 1050702 at redhat dot com> <201110271354 dot 26961 dot paul at codesourcery dot com>
Paul, do you know of any progress on this since 2011?
I cannot find any attempt to use your suggested ".personality
__gnu_personality_sigframe" in prologue for "__default_sa_restorer_v2".
I still need to learn more about this syntax...
I'm not building the glibc myself, but can probably let a friend try it if
we believe it is the right fix.
We hope to be able to make some poor man's backtrace's in syslog, when fatal
signals occurs in embedded systems (SIGSEGV, abort->SIGABRT etc).
This was quite useful on x86 targets in the past.
We are currently upgrading from EGLIBC 2.16 to 2.19 (yocto builds) and I
also tried to browse the regular GLIBC head.
With EGLIBC 2.16 I made a small test program and the backtrace always
stopped at gsignal(),
but if my signal_handler then triggered a coredump using raise(SIGQUIT) then
gdb was able to backtrace beyond the signal handler (see below).
http://www.eglibc.org/cgi-bin/viewvc.cgi/branches/eglibc-2_19/libc/ports/sysdeps/unix/sysv/linux/arm/sigrestorer.S?view=markup
<http://www.eglibc.org/cgi-bin/viewvc.cgi/branches/eglibc-2_19/libc/ports/sysdeps/unix/sysv/linux/arm/sigrestorer.S?view=markup>
https://sourceware.org/git/?p=glibc.git;a=history;f=sysdeps/unix/sysv/linux/arm/sigrestorer.S;h=71f9e25804bedb58cb06396834e8cea05dedc191;hb=refs/heads/master
<https://sourceware.org/git/?p=glibc.git;a=history;f=sysdeps/unix/sysv/linux/arm/sigrestorer.S;h=71f9e25804bedb58cb06396834e8cea05dedc191;hb=refs/heads/master>
arm7$ ./test
# backtrace before signal raised
backtrace() returned 6 addresses
libdemo.so(_Z11doBacktracePKci+0x44) [0xb6f3ae38]
libdemo.so(_Z2f3v+0x1c) [0xb6f3af24]
libdemo.so(_Z2f2v+0x20) [0xb6f3af54]
libdemo.so(_Z2f1v+0x28) [0xb6f3af8c]
./test() [0x8740]
/lib/libc.so.6(__libc_start_main+0x110) [0x444b7ea8]
abort
# backtrace after signal raised, signal_handler dumps backtrace and raise
SIGQUIT to core dump
--8<-------------------- Stack --------------------8<--
Error: signal 6:
libdemo.so(_ZN14doBacktraceEi+0x30)[0xb6f3b4f8]
libdemo.so(_ZN14signal_handlerEi+0x134)[0xb6f3b3b4]
/lib/libc.so.6(__default_sa_restorer_v2+0x0)[0x444ce1d0]
/lib/libc.so.6(gsignal+0x3c)[0x444ccf28]
--8<-----------------------------------------------8<--
Quit (core dumped)
===========
$ gdb test core
...
Program terminated with signal 3, Quit.
#0 0x444ccf28 in raise () from /lib/libc.so.6
(gdb) bt
#0 0x444ccf28 in raise () from /lib/libc.so.6
#1 0xb6f3b488 in signal_handler (sig=6) at mysignalhandler.cpp:176
#2 <signal handler called>
#3 0x444ccf28 in raise () from /lib/libc.so.6
#4 0x444d09a8 in abort () from /lib/libc.so.6
#5 0xb6f3afc0 in f1 () at foo.cpp:57
#6 0x00008740 in main ()
--
View this message in context: http://gcc.1065356.n5.nabble.com/ARM-Linux-EABI-unwinding-through-a-segfault-handler-tp692287p1117716.html
Sent from the gcc - Dev mailing list archive at Nabble.com.