Messages in this thread |  | | Subject | Re: Pthreads, linux, gdb, oh my! (fwd) | From | (Kevin Buhr) | Date | 09 Dec 2000 00:34:06 -0600 |
| |
Peter Berger <peterb@telerama.com> writes: > > Hi. I have the following tiny test program which fails dramatically, > using pthreads, in a number of fascinating ways on various version of > linux, using various versions of glibc, under various (current) versions > of GDB.
It looks like a GDB bug. GDB contains code to recognize when the "pthreads" shared library has been loaded. When this happens, it sets itself up to properly handle threads (including setting up correct SIG32 signal handling). If you trick GDB into thinking "pthreads" hasn't been loaded and set the SIG32 stuff up yourself, like so:
buhr@saurus:~/src$ gdb thread-test GNU gdb 19990928 Copyright 1998 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 "i686-pc-linux-gnu"... (gdb) set auto-solib-add 0 (gdb) handle SIG32 nostop noprint pass Signal Stop Print Pass to program Description SIG32 No No Yes Real-time event 32 (gdb) run
then your program works fine. Ergo, this is strong evidence that GDB's thread handling is broken. Presumably, it's simply not reaping threads when they exit.
I don't know if Petr just happened to run his GDB 5.0 with "set auto-solib-add 0" in his ".gdbinit" (a rather necessary precaution if you're hacking on, say, Mozilla) and didn't see any problem for that reason, or if some aspect of his configuration has fixed the problem. Alternatively, maybe Petr is using a GDB that doesn't actually support threads---if so, he'd *have* to set the SIG32 stuff up manually, and he wouldn't notice any problem.
Kevin <buhr@stat.wisc.edu> - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org Please read the FAQ at http://www.tux.org/lkml/
|  |