backtrace/2548: gdb - backtrace fails on embedded Linux version 2.4.21-pmppc440-V02

odedr@voltaire.com odedr@voltaire.com
Wed Nov 5 17:48:00 GMT 2008


>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 <return> to continue, or q <return> 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  <signal handler called>
#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 <return> to continue, or q <return> 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 ?? ()



More information about the Gdb-prs mailing list