pthread_create does not return when remote debugging

Jon Ringle
2003-06-28T05:32:17Z

Hi,

I am having an issue when remote debugging a multi-threaded app, a call to
pthread_create hangs inside __pthread_wait_for_restart_signal on the host
gdb.

Thanks in advance.

Jon

I've built a gdb-5.3 cross debugging environment i686 host/arm target with the
following:

$ tar xzf gdb-5.3.tar.gz
$ mkdir gdb-native
$ cd gdb-native
$ ../gdb-5.3/configure --host=i686-pc-linux-gnu \
--target=arm-linux \
--build=i686-pc-linux-gnu
$ make
$ cd ..
$ mkdir gdb-cross
$ cd gdb-cross
$ HOSTCC=gcc CC='arm-linux-gcc -msoft-float' \
../gdb-5.3/configure --host=arm-linux \
--target=arm-linux \
--build=i686-pc-linux-gnu
$ make
$ cd ..

I copy gdb-cross/gdb/gdbserver/gdbserver to the target arm.
On the target, I execute:
# ./gdbserver :5555 test-thread
Process test-thread created; pid = 380

On the host I run:
$ gdb-native/gdb/gdb test-thread
GNU gdb 5.3
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 "--host=i686-pc-linux-gnu --target=arm-linux"...
(gdb) set solib-absolute-prefix /dev/null
(gdb) set solib-search-path /usr/arm-linux/lib
(gdb) target remote 10.10.10.101:5555
Remote debugging using 10.10.10.101:5555
0x400025c0 in ?? ()
(gdb) b pthread_create
Breakpoint 1 at 0x20019e0
(gdb) c
Continuing.
[New Thread 1024]
[Switching to Thread 1024]

Breakpoint 1, 0x020019e0 in pthread_create ()
(gdb) finish
Run till exit from #0 0x020019e0 in pthread_create ()

<<<<< at this point it gdb hangs indefinately. I ctrl-c out >>>>>>

Program received signal SIGINT, Interrupt.
0x4014ebc4 in __sigsuspend (set=0xbffffbb4) at
../sysdeps/unix/sysv/linux/sigsuspend.c:48
48 ../sysdeps/unix/sysv/linux/sigsuspend.c: No such file or directory.
in ../sysdeps/unix/sysv/linux/sigsuspend.c
(gdb) bt
#0 0x4014ebc4 in __sigsuspend (set=0xbffffbb4) at
../sysdeps/unix/sysv/linux/sigsuspend.c:48
#1 0x40101b34 in __pthread_wait_for_restart_signal (self=0x401116e0) at
pthread.c:786
#2 0x40101138 in __pthread_create_2_1 (thread=0x206f8dc, attr=0xbffffc58,
start_routine=0x20043ac <console>, arg=0xbffffd88) at restart.h:26
#3 0x0204b424 in createThread (func=0x20043ac <console>, arg=0xbffffd88,
threadname=0x204f4f0 "console") at thread.c:84
#4 0x020022b8 in main (argc=1, argv=0xbffffdd4) at main.c:168
#5 0x401484a0 in __libc_start_main (main=0x2002054 , argc=1,
argv=0xbffffdd4, init=0x2001848 <_init>, fini=0x204f334 <_fini>,
rtld_fini=0x4000ca60 <_dl_fini>,
stack_end=0xbffffeba) at ../sysdeps/generic/libc-start.c:92