This is the mail archive of the
gdb-prs@sources.redhat.com
mailing list for the GDB project.
threads/1662: Spawned threads don't stop when breakpoint is hit
- From: nicknospam at optonline dot net
- To: gdb-gnats at sources dot redhat dot com
- Date: 1 Jun 2004 00:32:50 -0000
- Subject: threads/1662: Spawned threads don't stop when breakpoint is hit
- Reply-to: nicknospam at optonline dot net
>Number: 1662
>Category: threads
>Synopsis: Spawned threads don't stop when breakpoint is hit
>Confidential: no
>Severity: critical
>Priority: high
>Responsible: unassigned
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Tue Jun 01 00:38:00 UTC 2004
>Closed-Date:
>Last-Modified:
>Originator: nicknospam@optonline.net
>Release: 6.0 & 6.1
>Organization:
>Environment:
i686-pc-linux-gnu
>Description:
The documentation states:
Section 5.4 Stopping and starting multi-threaded programs
...
Whenever your program stops under GDB for any reason, *all* threads
of execution stop, not just the current thread.
However this is not happening. When a breakpoint is hit in the main process, the spawned thread continues to run.
Version Info:
gdb: 6.1 (configured as "i686-pc-linux-gnu")
gcc: 3.3.2 (Thread model: posix, configured with --enable-threads=posix)
glibc: 2.3.2
kernel: 2.6.5 (vanilla)
>How-To-Repeat:
1. gcc -g threadtest.c -o threadtest -lpthread
2. gdb threadtest
3. break main
4. break 18
5. run
6. next
7. next
Notice that despite the main process stopped at a breakpoint, the spawned thread continues to run (evidenced by the printf ceasing to output text).
>Fix:
>Release-Note:
>Audit-Trail:
>Unformatted:
----gnatsweb-attachment----
Content-Type: text/x-csrc; name="threadtest.c"
Content-Transfer-Encoding: base64
Content-Disposition: attachment; filename="threadtest.c"
I2luY2x1ZGUgPHN0ZGlvLmg+CiNpbmNsdWRlIDxwdGhyZWFkLmg+CiNpbmNsdWRlIDx1bmlzdGQu
aD4KCnN0YXRpYyB2b2lkICp3YWl0X3RocmVhZCh2b2lkICphcmcpOwoKaW50IG1haW4oaW50IGFy
Z2MsIGNoYXIgKmFyZ3ZbXSkKewogICBwcmludGYoIlsgbWFpbiBdIFByb2dyYW0gZW50ZXIuXG4i
KTsKCiAgIHB0aHJlYWRfdCB0OwogICBpbnQgcmVzID0gcHRocmVhZF9jcmVhdGUoJnQsIE5VTEws
IHdhaXRfdGhyZWFkLCBOVUxMKTsKICAgaWYocmVzICE9IDApCiAgIHsKICAgICAgcHJpbnRmKCJb
IG1haW4gXSBFcnJvciBjcmVhdGluZyB3YWl0IHRocmVhZCFcbiIpOwogICB9CgogICBwcmludGYo
IlsgbWFpbiBdIEdvaW5nIHRvIHNsZWVwLi4uXG4iKTsKICAgc2xlZXAoMyk7CiAgIHByaW50Zigi
WyBtYWluIF0gRXhpdHRpbmcuLi5cbiIpOwoKICAgcmV0dXJuKDApOwp9CgpzdGF0aWMgdm9pZCAq
d2FpdF90aHJlYWQodm9pZCAqYXJnKQp7CiAgIHdoaWxlKDEpCiAgIHsKICAgICAgcHJpbnRmKCJb
IHdhaXRfdGhyZWFkIF0gV2FpdGluZyBpbiB0aHJlYWRcbiIpOwogICAgICBzbGVlcCgxKTsKICAg
fQp9Cg==