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
Subject: Re: New: Rapidly exiting threads cause problems on attach+continue on Solaris On Saturday 31 October 2009 17:25:22, ppluzhnikov at google dot com wrote: > 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 May be related to PR7860.