libunwind-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Libunwind-devel] Signal SIGSEGV clears Callstack


From: Carsten Edenfeld
Subject: Re: [Libunwind-devel] Signal SIGSEGV clears Callstack
Date: Thu, 14 Jun 2012 12:57:10 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:12.0) Gecko/20120421 Thunderbird/12.0

On 14.06.2012 03:54, Paul Pluzhnikov wrote:
On Wed, Jun 13, 2012 at 9:18 AM, Carsten Edenfeld<address@hidden>  wrote:

I am trying to use the libunwind library for getting a callstack while my
application crashes with a segmentation fault signal.
But, if the app crashes, I do not get a correct callstack, but always this
output:


_ZL13check_sys_sigi

__restore_rt



If I am using the unwind code without a (forced) exception, but instead
directly calling the following function, everything works as expected:
I don't see anything immediately wrong with your code, and it is expected
to work (and does work here).

Please post a complete compilable test case, and also tell us what OS, what
processor, which version of libunwind and which version of GCC you are using.

One other possibly useful test is to run the program under GDB, set a
breakpoint on show_backtrace, wait for SIGSEGV and continue with "signal
SIGSEGV". At that point you should hit the breakpoint in GDB. What does
the GDB backtrace command show?



Hi,

Thanks for the answers.
I have now attached a repro case, which outputs the same results here. I have also forgotten to post a perhaps relevant function in my last mail (if you want to have a direct look at it without compiling...):


static sighandler_t sys_signal_add (int sig_nr, sighandler_t signalhandler)
{
    struct sigaction add_sig;

    if (sigaction (sig_nr, NULL, &add_sig) < 0) return SIG_ERR;

    add_sig.sa_handler = signalhandler;
    sigaddset (&add_sig.sa_mask, sig_nr);
    add_sig.sa_flags = SA_RESTART;

    if (sigaction (sig_nr, &add_sig, NULL) < 0) return SIG_ERR;
    return add_sig.sa_handler;
}


I am using gcc 4.6.2 on a x64 suse 12.1 system with libunwind version 0.98.6-39.1.2, QT Version 4.7.4 and Kernel Version 3.1.10-1.9-desktop #1 SMP PREEMPT Thu Apr 5 18:48:38 UTC 2012 (4a97ec8) x86_64 x86_64 x86_64 GNU/Linux



If I am just running my executable with gdb, I got the following output:
(Interestingly, the given callstack here is also the correct one.)



GNU gdb (GDB) SUSE (7.3-41.1.2)
Copyright (C) 2011 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-suse-linux".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>...
Reading symbols from /home/carsten/ExceptionRepro/ExceptionRepro...done.
(gdb) run
Starting program: /home/carsten/ExceptionRepro/ExceptionRepro
Missing separate debuginfo for /lib64/ld-linux-x86-64.so.2
Try: zypper install -C "debuginfo(build-id)=f20c99249f5a5776e1377d3bd728502e3f455a3f"
Missing separate debuginfo for /lib64/libunwind.so.7
Try: zypper install -C "debuginfo(build-id)=b3dfa390276ecba7fe44ecd6683e19da371abfd0"
Missing separate debuginfo for /usr/lib64/libunwind-x86_64.so.7
Try: zypper install -C "debuginfo(build-id)=1ac98809fd83cb317bf422528aafd29a0ae63444"
Missing separate debuginfo for /lib64/libpthread.so.0
Try: zypper install -C "debuginfo(build-id)=1f368f83b776815033caab6e389d7030bba4593e"
[Thread debugging using libthread_db enabled]
Missing separate debuginfo for /usr/lib64/libstdc++.so.6
Try: zypper install -C "debuginfo(build-id)=9642fa8658fd6cc04fd33d55ad2d95658bb7360b"
Missing separate debuginfo for /lib64/libm.so.6
Try: zypper install -C "debuginfo(build-id)=8ee6418257efac9e7fbadc657c30c62e0a002d57"
Missing separate debuginfo for /lib64/libgcc_s.so.1
Try: zypper install -C "debuginfo(build-id)=04626951231c50274a41cb283a3a41208ac47efe"
Missing separate debuginfo for /lib64/libc.so.6
Try: zypper install -C "debuginfo(build-id)=7b169b1db50384b70e3e4b4884cd56432d5de796"
Missing separate debuginfo for /lib64/libz.so.1
Try: zypper install -C "debuginfo(build-id)=f5011618a4da73cd48cd503403ef6c6bc6b16fc8"
Missing separate debuginfo for /lib64/libdl.so.2
Try: zypper install -C "debuginfo(build-id)=8d32fdb9682242cc2ebc1d9e6d717c6eaa51714e"
Missing separate debuginfo for /usr/lib64/libgthread-2.0.so.0
Try: zypper install -C "debuginfo(build-id)=726132cc660b46e6762990c41610a991e033d798"
Missing separate debuginfo for /lib64/librt.so.1
Try: zypper install -C "debuginfo(build-id)=b38afcf428f2107c56c0939b59ef737a5571348c"
Missing separate debuginfo for /usr/lib64/libglib-2.0.so.0
Try: zypper install -C "debuginfo(build-id)=1684af5007b4586de35609d69c79676b57fdd3e2"
Missing separate debuginfo for /lib64/libpcre.so.0
Try: zypper install -C "debuginfo(build-id)=fd3d7de0c30920f167970d38874643e0ae4ac637"
Missing separate debuginfo for /usr/lib64/gconv/UTF-16.so
Try: zypper install -C "debuginfo(build-id)=da190967b4f242573065a61fcbaa066d238305fb"

Program received signal SIGSEGV, Segmentation fault.
0x0000000000400b6f in main ()
(gdb)

Not sure, how I should debug the program with gdb though as you have described it.
If I am entering ...

'gdb ExceptionRepro'
'break show_backtrace()'
'run'


...I am already getting the exception and thus are not able to

"wait for SIGSEGV and continue with "signal SIGSEGV"

as the signal is already being handled at this position ?

Thanks and Regards,
Carsten Edenfeld





Attachment: ExceptionRepro.pro
Description: Text document

Attachment: main.cpp
Description: Text Data

Attachment: Makefile
Description: Text document


reply via email to

[Prev in Thread] Current Thread [Next in Thread]