From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 30005 invoked by alias); 5 Nov 2008 17:48:02 -0000 Received: (qmail 29924 invoked by uid 71); 5 Nov 2008 17:48:01 -0000 Resent-Date: 5 Nov 2008 17:48:01 -0000 Resent-Message-ID: <20081105174801.29922.qmail@sourceware.org> Resent-From: gdb-gnats@sources.redhat.com (GNATS Filer) Resent-To: nobody@sources.redhat.com Resent-Cc: gdb-prs@sources.redhat.com Resent-Reply-To: gdb-gnats@sources.redhat.com, odedr@voltaire.com Received: (qmail 18013 invoked by uid 48); 5 Nov 2008 17:38:20 -0000 Message-Id: <20081105173820.18010.qmail@sourceware.org> Date: Wed, 05 Nov 2008 17:48:00 -0000 From: odedr@voltaire.com Reply-To: odedr@voltaire.com To: gdb-gnats@sources.redhat.com X-Send-Pr-Version: gnatsweb-2.9.3 (1.1.1.1.2.31) Subject: backtrace/2548: gdb - backtrace fails on embedded Linux version 2.4.21-pmppc440-V02 Mailing-List: contact gdb-prs-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-prs-owner@sourceware.org X-SW-Source: 2008-q4/txt/msg00034.txt.bz2 >Number: 2548 >Category: backtrace >Synopsis: gdb - backtrace fails on embedded Linux version 2.4.21-pmppc440-V02 >Confidential: no >Severity: serious >Priority: medium >Responsible: unassigned >State: open >Class: sw-bug >Submitter-Id: net >Arrival-Date: Wed Nov 05 17:48:01 UTC 2008 >Closed-Date: >Last-Modified: >Originator: GNU gdb 5.2.1 >Release: unknown-1.0 >Organization: >Environment: Linux ISR9288D-120c 2.4.21-pmppc440-V02 gcc version 2.95.4 20010319 (prerelease/franzo/20011204)) >Description: hey, i encountered a problem with my software while changing the signal handling. i used to catch the signals with sigaction mechanism but without the SA_SIGINFO meaning the prototype for the handler function was the same as with the signal() mechanism which is: void handler(int x) this handler function (my implementation) would get into an infinite loop so the programmer will have time to work on the problem (obviously if an error signal occurs something went wrong) using GDB. anyway the GDB backtrace worked just fine, you can see the example in the file attached - the problem started when i started to use the SA_SIGINFO flag, meaning the handler function protype changed to: void __sigaction_handler(int signo, siginfo_t *info, void *context) - this is the newer,better way to catch signals. now with this small change the backtrace encountered error, and could not back trace from phread_sighandler_rt() which is the internal kernel function which called right after a signal occured (this is the function the actually call the handler function i defined with sigaction() ). i tested 2 cases that differ only by the SA_SIGINFO flag above - and the results are in the attached file. i attached both example the working one, and the unworking one. my guess is that the implementation of the SA_SIGINFO function use the stuck diffrently than the old one. ill be glad if you could help me with this problem, regards. >How-To-Repeat: just write a simple program that register on signals (lets say SIGABRT) with sigaction mechanism, make sure that both handler functions are getting into an infinite loop. do it one time without SA_SIGINFO flag, your handler prototype should be: void handler(int x) . the second time do it with the flag, your handler prototype should be: void __sigaction_handler(int signo, siginfo_t *info, void *context) try to backtrace them both using GDB-bt you will see that the second one cannot backtrace properly. >Fix: >Release-Note: >Audit-Trail: >Unformatted: ----gnatsweb-attachment---- Content-Type: text/plain; name="gdb-sigaction.txt" Content-Disposition: inline; filename="gdb-sigaction.txt" ********************************************************************* * sigaction without SA_SIGINFO flag, backtrace work * ********************************************************************* # gdb vsm 7167 GNU gdb 5.2.1 Copyright 2002 Free Software Foundation, Inc. GDB is free software, covered by the GNU General Public License, and you are welcome to change it and/or distribute copies of it under certain conditions. Type "show copying" to see the conditions. There is absolutely no warranty for GDB. Type "show warranty" for details. This GDB was configured as "powerpc-linux"... Attaching to program: /usr/voltaire/bin/vsm, process 7167 Reading symbols from /usr/voltaire/lib/libcomplib.so.0.0...done. Loaded symbols for /usr/voltaire/lib/libcomplib.so.0.0 Reading symbols from /usr/voltaire/lib/librmpplib.so.0.0...done. Loaded symbols for /usr/voltaire/lib/librmpplib.so.0.0 Reading symbols from /usr/voltaire/lib/libsysport.so.0.0...done. Loaded symbols for /usr/voltaire/lib/libsysport.so.0.0 Reading symbols from /usr/voltaire/lib/libmad.so.0.0...done. Loaded symbols for /usr/voltaire/lib/libmad.so.0.0 Reading symbols from /usr/voltaire/lib/libmsg.so.0.0...done. Loaded symbols for /usr/voltaire/lib/libmsg.so.0.0 Reading symbols from /usr/voltaire/lib/libcommonlib.so.0.0...done. Loaded symbols for /usr/voltaire/lib/libcommonlib.so.0.0 Reading symbols from /usr/voltaire/lib/libreplicator.so.0.0...done. Loaded symbols for /usr/voltaire/lib/libreplicator.so.0.0 Reading symbols from /lib/libpthread.so.0...done. Loaded symbols for /lib/libpthread.so.0 Reading symbols from /lib/libdl.so.2...done. Loaded symbols for /lib/libdl.so.2 Reading symbols from /usr/voltaire/lib/libapisqlite3db.so.0.0...done. Loaded symbols for /usr/voltaire/lib/libapisqlite3db.so.0.0 Reading symbols from /lib/libcrypto.so.2...done. Loaded symbols for /lib/libcrypto.so.2 Reading symbols from /lib/libstdc++-libc6.1-2.so.3...done. Loaded symbols for /lib/libstdc++-libc6.1-2.so.3 Reading symbols from /usr/voltaire/lib/libsqlite3.so.0...done. Loaded symbols for /usr/voltaire/lib/libsqlite3.so.0 Reading symbols from /lib/libc.so.6...done. Loaded symbols for /lib/libc.so.6 Reading symbols from /lib/libm.so.6...done. Loaded symbols for /lib/libm.so.6 Reading symbols from /lib/ld.so.1...done. Loaded symbols for /lib/ld.so.1 ---Type to continue, or q to quit--- 0x0fa8e444 in kill () from /lib/libc.so.6 (gdb) bt #0 0x0fa8e444 in kill () from /lib/libc.so.6 #1 0x0fa8e300 in killpg () from /lib/libc.so.6 #2 0x10013d1c in handler2 (x=4) at main.c:611 #3 0x0fea97cc in pthread_sighandler () from /lib/libpthread.so.0 #4 #5 0x0fa8f78c in __syscall_rt_sigsuspend () from /lib/libc.so.6 #6 0x0fa8e484 in sigsuspend () from /lib/libc.so.6 #7 0x0fea9378 in __pthread_wait_for_restart_signal () from /lib/libpthread.so.0 #8 0x0fea53b8 in pthread_cond_wait () from /lib/libpthread.so.0 #9 0x0ff9b65c in rmpp_timer_prov_cb (context=0x4) at rmpp-timer.c:285 #10 0x0fea6448 in pthread_start_thread () from /lib/libpthread.so.0 #11 0x0fb35c6c in clone () from /lib/libc.so.6 (gdb) ********************************************************************* * sigaction with SA_SIGINFO flag, backtrace doesnt work * ********************************************************************* # gdb vsm 12267 GNU gdb 5.2.1 Copyright 2002 Free Software Foundation, Inc. GDB is free software, covered by the GNU General Public License, and you are welcome to change it and/or distribute copies of it under certain conditions. Type "show copying" to see the conditions. There is absolutely no warranty for GDB. Type "show warranty" for details. This GDB was configured as "powerpc-linux"... Attaching to program: /usr/voltaire/bin/vsm, process 12267 Reading symbols from /usr/voltaire/lib/libcomplib.so.0.0...done. Loaded symbols for /usr/voltaire/lib/libcomplib.so.0.0 Reading symbols from /usr/voltaire/lib/librmpplib.so.0.0...done. Loaded symbols for /usr/voltaire/lib/librmpplib.so.0.0 Reading symbols from /usr/voltaire/lib/libsysport.so.0.0...done. Loaded symbols for /usr/voltaire/lib/libsysport.so.0.0 Reading symbols from /usr/voltaire/lib/libmad.so.0.0...done. Loaded symbols for /usr/voltaire/lib/libmad.so.0.0 Reading symbols from /usr/voltaire/lib/libmsg.so.0.0...done. Loaded symbols for /usr/voltaire/lib/libmsg.so.0.0 Reading symbols from /usr/voltaire/lib/libcommonlib.so.0.0...done. Loaded symbols for /usr/voltaire/lib/libcommonlib.so.0.0 Reading symbols from /usr/voltaire/lib/libreplicator.so.0.0...done. Loaded symbols for /usr/voltaire/lib/libreplicator.so.0.0 Reading symbols from /lib/libpthread.so.0...done. Loaded symbols for /lib/libpthread.so.0 Reading symbols from /lib/libdl.so.2...done. Loaded symbols for /lib/libdl.so.2 Reading symbols from /usr/voltaire/lib/libapisqlite3db.so.0.0...done. Loaded symbols for /usr/voltaire/lib/libapisqlite3db.so.0.0 Reading symbols from /lib/libcrypto.so.2...done. Loaded symbols for /lib/libcrypto.so.2 Reading symbols from /lib/libstdc++-libc6.1-2.so.3...done. Loaded symbols for /lib/libstdc++-libc6.1-2.so.3 Reading symbols from /usr/voltaire/lib/libsqlite3.so.0...done. Loaded symbols for /usr/voltaire/lib/libsqlite3.so.0 Reading symbols from /lib/libc.so.6...done. Loaded symbols for /lib/libc.so.6 Reading symbols from /lib/libm.so.6...done. Loaded symbols for /lib/libm.so.6 Reading symbols from /lib/ld.so.1...done. Loaded symbols for /lib/ld.so.1 ---Type to continue, or q to quit--- 0x0fa8e444 in kill () from /lib/libc.so.6 (gdb) bt #0 0x0fa8e444 in kill () from /lib/libc.so.6 #1 0x0fa8e300 in killpg () from /lib/libc.so.6 #2 0x10013e44 in __sigaction_handler (signo=270437232, info=0x9, context=0x36) at main.c:740 #3 0x0fea98f8 in pthread_sighandler_rt () from /lib/libpthread.so.0 /* notice that this kernel function is diffrent from pthread_sighandler () from the previous example */ #4 0x7edff928 in ?? () (gdb) #0 0x0fa8e444 in kill () from /lib/libc.so.6 #1 0x0fa8e300 in killpg () from /lib/libc.so.6 #2 0x10013e44 in __sigaction_handler (signo=270437232, info=0x9, context=0x36) at main.c:740 #3 0x0fea98f8 in pthread_sighandler_rt () from /lib/libpthread.so.0 #4 0x7edff928 in ?? ()