This is the mail archive of the
gdb-prs@sourceware.org
mailing list for the GDB project.
[Bug threads/10879] New: Rapidly exiting threads cause problems on attach+continue on Solaris
- From: "ppluzhnikov at google dot com" <sourceware-bugzilla at sourceware dot org>
- To: gdb-prs at sourceware dot org
- Date: 31 Oct 2009 17:25:22 -0000
- Subject: [Bug threads/10879] New: Rapidly exiting threads cause problems on attach+continue on Solaris
- Reply-to: sourceware-bugzilla at sourceware dot org
This is a logical continuation of PR10757.
Test case:
/// --- cut ---
/* compile with "gcc -g -pthreads manythreads.c -o manythreads" */
#include <assert.h>
#include <pthread.h>
#include <stdlib.h>
#include <stdio.h>
#include <unistd.h>
void *foo (void)
{
// set breakpoint here
usleep(1);
return NULL;
}
void *fn (void *p)
{
pthread_t tid = (pthread_t) p;
int rc;
if (p != NULL)
assert (pthread_join (tid, NULL) == 0);
while ((rc = pthread_create (&tid, NULL, fn, (void*) pthread_self ())) != 0)
fprintf (stderr, "unexpected error from pthread_create: %d\n", rc);
return foo();
}
int main (int argc, char *argv[])
{
int i, n_threads = 100;
if (argc > 1)
n_threads = atoi (argv[1]);
for (i = 0; i < n_threads; ++i)
{
pthread_t tid;
while (pthread_create (&tid, NULL, fn, NULL) != 0)
sleep (1);
}
sleep (300);
exit (0);
}
/// --- cut ---
./manythreads & sleep 1 && ./gdb -nx ./manythreads $!
[1] 12880
GNU gdb (GDB) 7.0.50.20091031-cvs
Copyright (C) 2009 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. Type "show copying"
and "show warranty" for details.
This GDB was configured as "i386-pc-solaris2.10".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>...
Reading symbols from /export/home/paul/tmp/manythreads...done.
Attaching to program `/export/home/paul/tmp/manythreads', process 12880
[New process 12880]
Retry #1:
Retry #2:
Retry #3:
Retry #4:
Reading symbols from /lib/libpthread.so.1...(no debugging symbols found)...done.
Loaded symbols for /lib/libpthread.so.1
Reading symbols from /lib/libc.so.1...(no debugging symbols found)...done.
[Thread debugging using libthread_db enabled]
[New LWP 7656 ]
[New LWP 7614 ]
...
[New Thread 7459 ]
[New Thread 7458 ]
[New Thread 7457 ]
Loaded symbols for /lib/libc.so.1
Reading symbols from /lib/ld.so.1...(no debugging symbols found)...done.
Loaded symbols for /lib/ld.so.1
[Switching to Thread 1 (LWP 1)]
0xfef19735 in ___nanosleep () from /lib/libc.so.1
(gdb) b foo
procfs: fetch_registers, get_gregs line 3800, /proc/12880/lwp/7457: No such file
or directory.
Another failure I've seen:
(gdb) b foo
Breakpoint 1 at 0x8050ab2: file manythreads.c, line 10.
(gdb) commands 1
Type commands for when breakpoint 1 is hit, one per line.
End with a line saying just "end".
>silent
>c
>end
(gdb) c
Continuing.
[LWP 2236 exited]
[New LWP 2247 ]
[LWP 2235 exited]
[LWP 2246 exited]
sol_thread_fetch_registers: td_ta_map_id2thr: no thread can be found to satisfy
query
--
Summary: Rapidly exiting threads cause problems on
attach+continue on Solaris
Product: gdb
Version: unknown
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: threads
AssignedTo: unassigned at sourceware dot org
ReportedBy: ppluzhnikov at google dot com
CC: gdb-prs at sourceware dot org
GCC build triplet: i386-pc-solaris2.10
GCC host triplet: i386-pc-solaris2.10
GCC target triplet: i386-pc-solaris2.10
http://sourceware.org/bugzilla/show_bug.cgi?id=10879
------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.