gdb and pthreads hang

gdb and pthreads hang

Post by John Tave » Tue, 02 Nov 1999 04:00:00



I am developing a multicast protocol that uses pthreads. I find that when I
run it in the de* it will hang forever. If I hit ^-C and investigate,
it looks like it should be running fine. I then type continue on all the
threads and it continues just fine. The program uses 6 threads, one thread
typically waits in pthread_cond_timedwait. Other threads are usually
sleeping with pthread_cond_wait. I am not using any signals.

If I don't use the de* the program will crash, or hang because I
haven't figured out all the bugs. But it is a real pain to debug without the
de*, and it is time consuming to have to constantly unstick it by doing
^-C continue in the de*. Sometimes it doesn't continue, and then I know
it is hung because of my code.

Does anyone know how the de* could be altering pthreads?

I am using 2.2.12, gdb 4.17.0.12, pthread 0.8, libc 2.1.1.

--

John Taves
Pacific Northwest Software
www.pnwsoft.com
425 868-1395

 
 
 

gdb and pthreads hang

Post by Peter Tod » Wed, 03 Nov 1999 04:00:00



> I am developing a multicast protocol that uses pthreads. I find that when I
> run it in the de* it will hang forever. If I hit ^-C and investigate,
> it looks like it should be running fine. I then type continue on all the
> threads and it continues just fine. The program uses 6 threads, one thread
> typically waits in pthread_cond_timedwait. Other threads are usually
> sleeping with pthread_cond_wait. I am not using any signals.

I have one simple answere to that. Don't use de*s on threads. :(

They just don't work unless they *specifically* say they work with
threads. There are patches to gdb that allow it to work with threads.
But I've never tried one.

I had to resort to using lots of printf's on my last threaded
project. :(