gdb not working for multiple threads

Daniel Ng daniel.ng1234 at gmail.com
Mon Aug 15 01:54:33 UTC 2011


GDB doesn't seem to be working for me in debugging a simple multi-threaded
application. The application just creates 20 threads, each of which sits in an
empty while(1) loop. The application just seems to freeze after creating the
first 2 threads. I also get a 'error initializing thread_db library: generic
error' from gdbserver. Also, why would I get a SIG32 Real-time event?

I have seen similar posts which suggest ensuring everything is compiled with
debugging symbols and that libthread_db.so.1 is also built. I have done this,
but obviously something else is amiss.

Details below...

-GDB output:
(gdb) file /tftpboot/192.168.1.74/rootfs/root/thread_test 
(gdb) target remote 192.168.1.74:1234
[New Thread 158]
0x48000b00 in _start () from /tftpboot/192.168.1.74/rootfs/lib/ld-uClibc.so.0
(gdb) cont

Program received signal SIG32, Real-time event 32.
0x4807501c in ?? () from /tftpboot/192.168.1.74/rootfs/lib/libc.so.0
(gdb) handle all nostop
(gdb) cont

->GDB seems to freeze here. Up to this point I get the following console output:

gdbserver :1234 ./thread_test
Process ./thread_test created; pid = 158
Listening on port 1234
Remote debugging from host 192.168.1.8
gdbserver: error initializing thread_db library: generic error
gdbserver: error initializing thread_db library: generic error
gdbserver: error initializing thread_db library: generic error
00158 : __pthread_initialize_manager: manager stack: size=8160, bos=0x10011150,
tos=0x10013130
00158 : __pthread_initialize_manager: send REQ_DEBUG to manager thread
00159 : __pthread_manager: before poll
00158 : pthread_create: write REQ_CREATE to manager thread
00159 : __pthread_manager: after poll
00159 : __pthread_manager: before read
00159 : __pthread_manager: after read, n=28
00159 : __pthread_manager: got REQ_CREATE
00159 : pthread_handle_create: cloning new_thread = 0xbf3ffea0
00158 : pthread_create: before suspend(self)
00160 : pthread_start_thread:
Thread 0 reporting!
00159 : pthread_handle_create: new thread pid = 160
00159 : __pthread_manager: restarting 0x4803a1c0
00159 : __pthread_manager: before poll
00158 : pthread_create: after suspend(self)
00158 : pthread_create: write REQ_CREATE to manager thread
00158 : pthread_create: before suspend(self)
00159 : __pthread_manager: after poll
00159 : __pthread_manager: before read
00159 : __pthread_manager: after read, n=28
00159 : __pthread_manager: got REQ_CREATE
00159 : pthread_handle_create: cloning new_thread = 0xbf1ffea0
00161 : pthread_start_thread:
Thread 1 reporting!
00159 : pthread_handle_create: new thread pid = 161
00159 : __pthread_manager: restarting 0x4803a1c0
00159 : __pthread_manager: before poll

-->The multi-threaded application seems to freeze here. It should have gone on
to produce another 18 threads.


When I pressed Ctrl-c in GDB, the following was outputted to the console:

input_interrupt, count = 0 c = 0 ('')


Why did the application freeze? Of course without GDB, it works fine.

System Info:
-powerpc
-Linux 2.6.30.3
-gdb 6.8
-gcc 4.3.3
-uClibc 0.9.31 using old-style Linux threads

Cheers,
Daniel




More information about the uClibc mailing list