debugging threads
Hello,
I am trying to debug a multithreaded app and am having some problems. I've hunted around how to do this and have done the following:
Built uClibc with debug threads on so have a libthread_db.so Built gdbserver for target
I then execute gdbserver with:
gdbserver 192.168.42.15:2345 /usr/sbin/threaded_test
On the host machine I run:
~/buildroot/build_i686/staging_dir/usr/bin/i686-linux-gdb ~/threaded_test
Once gdb starts I point it to the shared libs with:
set solib-absolute-prefix ~/buildroot/project_build_i686/uclibc/root
Then connect to gdbserver with
target remote 192.168.42.101:2345
I am able to debug the application until a call to create a thread (pthread_create) when I get the following error:
Program received signal SIG32, Real-time event 32. 0xb7ef0175 in sigsuspend ()
from/home/willw/buildroot/project_build_i686/uclibc/root/lib/libc.so.0 (gdb) bt
#0 0xb7ef0175 in sigsuspend ()
from/home/willw/buildroot/project_build_i686/uclibc/root/lib/libc.so.0 #1 0xb7faf6a4 in __pthread_wait_for_restart_signal ()
from/home/willw/buildroot/project_build_i686/uclibc/root/lib/libpthread.so.0 #2 0xb7faf6cc in ?? ()
from/home/willw/buildroot/project_build_i686/uclibc/root/lib/libpthread.so.0 #3 0xb7fb6040 in ?? ()
from/home/willw/buildroot/project_build_i686/uclibc/root/lib/libpthread.so.0 #4 0xb7fb1de8 in ?? ()
from/home/willw/buildroot/project_build_i686/uclibc/root/lib/libpthread.so.0 #5 0xbf871718 in ?? ()
#6 0xb7fafda8 in pthread_create ()
from/home/willw/buildroot/project_build_i686/uclibc/root/lib/libpthread.so.0 Backtrace stopped: frame did not save the PC
Can anyone tell me what step I am missing to get thread debugging working? From searching on the net it seems the libthread_db is needed but it doesn't seem to be loaded by gdb.
Many thanks,
Will.
Signature · 5 lines
------------------------------------------------------------------------ Will Wagner will_wagner at carallon.com Senior Project Engineer Office Tel: +44 (0)20 7371 2032 Carallon Ltd, Studio G20, Shepherds Building, Rockley Rd, London W14 0DA ------------------------------------------------------------------------
I solved this, it was a problem with gdb & gdbserver not being rebuilt when you change the uClibc option to allow thread debugging. A rebuild from scratch fixed the problem.
Will.
Quoted 58 lines · Will Wagner
Hello,
I am trying to debug a multithreaded app and am having some problems. I've hunted around how to do this and have done the following:
Built uClibc with debug threads on so have a libthread_db.so Built gdbserver for target
I then execute gdbserver with:
gdbserver 192.168.42.15:2345/usr/sbin/threaded_testOn the host machine I run:
~/buildroot/build_i686/staging_dir/usr/bin/i686-linux-gdb ~/threaded_testOnce gdb starts I point it to the shared libs with:
set solib-absolute-prefix ~/buildroot/project_build_i686/uclibc/rootThen connect to gdbserver with
target remote 192.168.42.101:2345I am able to debug the application until a call to create a thread (
pthread_create) when I get the following error:Program received signal SIG32, Real-time event 32.
0xb7ef0175in sigsuspend ()
from/home/willw/buildroot/project_build_i686/uclibc/root/lib/libc.so.0(gdb) bt
#00xb7ef0175in sigsuspend ()
from/home/willw/buildroot/project_build_i686/uclibc/root/lib/libc.so.0#10xb7faf6a4in__pthread_wait_for_restart_signal()
from/home/willw/buildroot/project_build_i686/uclibc/root/lib/libpthread.so.0#20xb7faf6ccin ?? ()
from/home/willw/buildroot/project_build_i686/uclibc/root/lib/libpthread.so.0#30xb7fb6040in ?? ()
from/home/willw/buildroot/project_build_i686/uclibc/root/lib/libpthread.so.0#40xb7fb1de8in ?? ()
from/home/willw/buildroot/project_build_i686/uclibc/root/lib/libpthread.so.0#50xbf871718in ?? ()
#60xb7fafda8inpthread_create()
from/home/willw/buildroot/project_build_i686/uclibc/root/lib/libpthread.so.0Backtrace stopped: frame did not save the PCCan anyone tell me what step I am missing to get thread debugging working? From searching on the net it seems the
libthread_dbis needed but it doesn't seem to be loaded by gdb.Many thanks,
Will.
Signature · 5 lines
------------------------------------------------------------------------ Will Wagner will_wagner at carallon.com Senior Project Engineer Office Tel: +44 (0)20 7371 2032 Carallon Ltd, Studio G20, Shepherds Building, Rockley Rd, London W14 0DA ------------------------------------------------------------------------