This is the mail archive of the
mailing list for the glibc project.
Re: Possible pthreads problem in glibc-2.0.7 (from RedHat rpm glibc-2.0.7-19)
- To: email@example.com
- Subject: Re: Possible pthreads problem in glibc-2.0.7 (from RedHat rpm glibc-2.0.7-19)
- From: Geoff Keating <firstname.lastname@example.org>
- Date: Sat, 26 Sep 1998 14:43:34 +1000
- CC: email@example.com
- References: <36076542.4C8B466A@darmstadt.gmd.de>
> Date: Tue, 22 Sep 1998 10:52:18 +0200
> From: Joerg Pommnitz <firstname.lastname@example.org>
> Now I'm asking for help and guidance in chasing down this bug.
> Do you have tools that might help investigating what is going
Here is some generic linuxthread debugging help:
Firstly, H.J.Lu had some kernel/gdb patches that let gdb understand
threads on x86 linux. You may be able to single-step through your
program, switching threads at will! Of course, doing this may make
your bug go away :-(.
If you can stop the program where the problem happens (for instance,
it is a deadlock, or it causes a segfault and dumps core), you can use
gdb's `attach' command or postmortem debugging on the core file, to
read static memory. You may be able to modify your program to save
important values in global variables, so that you can inspect them
after a deadlock or crash.
You can see the list of threads in the variable __pthread_handles.
Under glibc 2.0.96, you can use the 'catchsegv' shell script if your
program is dumping core, to show the CPU registers of the thread that
is causing the signal. You can then look at the core file under gdb
to see what any addresses relate to.
printf() is helpful, but again it may make your problem change. Note
that printf() uses locks; you may want to use write() directly
If you think a thread might be trying to lock a mutex it has already
locked (causing an instant deadlock), you can use
'PTHREAD_MUTEX_ERRORCHECK_NP' mutexes instead of the default, and
they'll return an error code if this happens.
If you compile linuxthreads with -DDEBUG, there are a number
of internal consistency checks that are added. You also get a
__pthread_message function which is handy for printing debugging
Geoffrey Keating <email@example.com>