Re: pthread_create does not return when remote debugging

Jon Ringle
2003-06-28T07:16:54Z

Updated output below to have 'set debug remote 1' just before the hang...
Seems like it would be useful information.

Jon

On Saturday 28 June 2003 01:28 am, Jon Ringle wrote:
> 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 extended-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) set debug remote 1
(gdb) finish
Sending packet: $m20019e0,4#5e...Ack
Packet received: 04c09fe5
Sending packet: $m204b424,4#5f...Ack
Packet received: 0030a0e1
Sending packet: $m204b230,4#5a...Ack
Packet received: 0dc0a0e1
Sending packet: $m204b234,4#5e...Ack
Packet received: 00d82de9
Sending packet: $m204b238,4#62...Ack
Packet received: 04b04ce2
Sending packet: $m204b23c,4#8d...Ack
Packet received: 30d04de2
Sending packet: $m204b240,4#5b...Ack
Packet received: 10000be5
Sending packet: $m204b244,4#5f...Ack
Packet received: 14100be5
Sending packet: $m204b248,4#63...Ack
Packet received: 18200be5
Sending packet: $m204b24c,4#8e...Ack
Packet received: 0030a0e3
Sending packet: $m204b250,4#5c...Ack
Packet received: 20300be5
Sending packet: $m204b254,4#60...Ack
Packet received: ab0300eb
Sending packet: $m204b258,4#64...Ack
Packet received: 0030a0e1
Sending packet: $m204b25c,4#8f...Ack
Packet received: 030053e3
Sending packet: $m204b260,4#5d...Ack
Packet received: 020000da
Sending packet: $m204b424,4#5f...Ack
Packet received: 0030a0e1
Run till exit from #0 0x020019e0 in pthread_create ()
Sending packet: $m20019e0,4#5e...Ack
Packet received: 04c09fe5
Sending packet: $m20019e4,4#62...Ack
Packet received: 0cc08fe0
Sending packet: $M20019e4,4:01009fef#a7...Ack
Packet received: OK
Sending packet: $Hc400#3f...Ack
Packet received: OK
Sending packet: $c#63...Ack
Packet received: T050b:54fdffbf;0d:18fdffbf;0f:e4190002;
Sending packet: $M20019e4,4:0cc08fe0#d5...Ack
Packet received: OK
Sending packet: $m20019e4,4#62...Ack
Packet received: 0cc08fe0
Sending packet: $m4000cbd0,4#ea...Ack
Packet received: 0dc0a0e1
Sending packet: $M4000cbd0,4:01009fef#2f...Ack
Packet received: OK
Sending packet: $m20019e0,4#5e...Ack
Packet received: 04c09fe5
Sending packet: $M20019e0,4:01009fef#a3...Ack
Packet received: OK
Sending packet: $m204b424,4#5f...Ack
Packet received: 0030a0e1
Sending packet: $M204b424,4:01009fef#a4...Ack
Packet received: OK
Sending packet: $Hc0#db...Ack
Packet received: OK
Sending packet: $c#63...Ack
remote_interrupt called
remote_stop called
Packet received: T020b:b0fbffbf;0d:90fbffbf;0f:c4eb1440;

<<<<< Hang occurs here! Pressing ctrl-c to abort. >>>>>>>>>

Program received signal SIGINT, Interrupt.
Sending packet: $g#67...Ack
Packet received:
fcffffff08000000641a11406c010000841a1140b4fbffbf16000000301a214088fdffbfdcf80602c0c32040b0fbffbf90fbffbf90fbffbfb4eb1440c4eb14400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000020
Sending packet: $m4014ebc4,4#f4...Ack
Packet received: 0040a0e1
Sending packet: $m4014ebc4,4#f4...Ack
Packet received: 0040a0e1
Sending packet: $m4014eb84,4#c9...Ack
Packet received: 0dc0a0e1
Sending packet: $m4014eb88,4#cd...Ack
Packet received: f0dc2de9
Sending packet: $m4014eb8c,4#f8...Ack
Packet received: b0a09fe5
Sending packet: $m4014eb90,4#c6...Ack
Packet received: b0209fe5
Sending packet: $m4014eb94,4#ca...Ack
Packet received: 0aa08fe0
Sending packet: $m4014eb98,4#ce...Ack
Packet received: 02709ae7
Sending packet: $m4014eb9c,4#f9...Ack
Packet received: 04b04ce2
Sending packet: $m4014eba0,4#ee...Ack
Packet received: 003097e5
Sending packet: $m4014eba4,4#f2...Ack
Packet received: 0050a0e1
Sending packet: $m4014eba8,4#f6...Ack
Packet received: 000053e3
Sending packet: $m4014ebac,4#21...Ack
Packet received: 1700001a
Sending packet: $M4000cbd0,4:0dc0a0e1#52...Ack
Packet received: OK
Sending packet: $M20019e0,4:04c09fe5#a8...Ack
Packet received: OK
Sending packet: $M204b424,4:0030a0e1#63...Ack
Packet received: OK
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) set debug remote 0
(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