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

Bug#414606: Stacktraces and deadlocked threads.



Package: libc6
Version: 2.3.6.ds1-11

If a thread is involved in a deadlock, gdb reports a corrupt stack trace
for that thread.  This problem has been fixed in 2.5-0exp6, but it
sounds like 2.5 won't make it into etch.  Until then, libc6-dbg can be
used as a workaround since debugging versions of 2.3.6 use an older
pthreads implementation.

Can debugging in libc6 2.3.6 be fixed in time for etch?  If not,
libc6-dbg's package description probably should document the problem.
Doing so also would also (partially) address bug #399035 in time for
etch.  Replace:

Most people will not need this package.

with:

This package also contains a older, less efficient, version of pthreads
with better debugging support.


Example session:

$ cat deadlock.c
#include <pthread.h>

int main(int argc, char** argv) {
   pthread_mutex_t lock = PTHREAD_MUTEX_INITIALIZER;
   pthread_mutex_lock(&lock);
   pthread_mutex_lock(&lock);
}

$ gcc -g -O0 deadlock.c -o deadlock -lpthread
$ gdb ./deadlock
...
(gdb) run
Starting program: /home/sears/deadlock/deadlock
Failed to read a valid object file image from memory.
[Thread debugging using libthread_db enabled]
[New Thread -1209542976 (LWP 9659)]

// program hangs as expected, hit ^C

Program received signal SIGINT, Interrupt.
[Switching to Thread -1209542976 (LWP 9659)]
0xb7fd5410 in ?? ()
(gdb) where
#0  0xb7fd5410 in ?? ()
#1  0xbfee9698 in ?? ()
#2  0x00000002 in ?? ()
#3  0x00000000 in ?? ()
(gdb)

libc6-dbg fixes the problem:

$ export LD_LIBRARY_PATH=/usr/lib/debug/
$ gdb ./deadlock
...
(gdb) run
^C
Program received signal SIGINT, Interrupt.
[Switching to Thread 16384 (LWP 10826)]
0xb7f63b64 in __pthread_sigsuspend (set=0xbfa040f8) at
../linuxthreads/sysdeps/unix/sysv/linux/pt-sigsuspend.c:54
54      ../linuxthreads/sysdeps/unix/sysv/linux/pt-sigsuspend.c: No such
file or directory.
        in ../linuxthreads/sysdeps/unix/sysv/linux/pt-sigsuspend.c
(gdb) where
#0  0xb7f63b64 in __pthread_sigsuspend (set=0xbfa040f8)
    at ../linuxthreads/sysdeps/unix/sysv/linux/pt-sigsuspend.c:54
#1  0xb7f62728 in __pthread_wait_for_restart_signal (self=0x804a8c0) at
pthread.c:1224
#2  0xb7f64fe6 in __pthread_alt_lock (lock=0xbfa04204, self=0x804a8c0)
at restart.h:34
#3  0xb7f621dc in *__GI___pthread_mutex_lock (mutex=0xbfa041f4) at
mutex.c:123
#4  0x080483ff in main () at deadlock.c:6



Reply to: