thread-debuging with gdbserver on ARM/NPTL

Benedikt Spranger
2006-10-24T18:29:45Z

Hi,

trying to debug a simple multithreaded application with gdbserver on an
ARM eabi/NPTL based System leads to a completely confused gdbserver.

thread_code() {

BP2 do_thread_init();
pthread_lock();
do_thread_work();
pthread_unlock();
}

main() {

pthread_lock()
pthread_create()
BP1 do_something()
pthread_unlock()
}

Attaching gdb to gdbserver, set the above breakpoints and issue "cont",
then the program stops at breakpoint BP1. BP2 is never reached, although
the thread is visible via "ps" on the target system. The thread is stuck
in sys_futex and not as expected in the ptrace breakpoint trap. Also gdb
does not show that the thread was created.

This can be reproduced with glibc 2.3.6 -> 2.5, kernel 2.6.14 ->
2.6.19-rc2, gcc 3.4 -> 4.1.1 and binutils up to cvs-latest.

Benedikt Spranger