gdb
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Gdb] sigwait exits in gdb on pthread_exit call


From: Michael Elizabeth Chastain
Subject: Re: [Gdb] sigwait exits in gdb on pthread_exit call
Date: Sat, 26 Jun 2004 13:46:19 -0400 (EDT)

Hello,

> When I run a multithreaded program in the debugger, it exists on my 
> sigwait call (EINTR) when a thread calls pthread_exit(NULL).

Yes, that's true.  See the gdb manual section 'stopped threads'.

gdb monitors certain events in the inferior program, including thread
creation and thread destruction.  gdb does this by using hidden
breakpoints.  When the inferior program calls pthread_exit, gdb takes
the hidden breakpoint and notes that a thread has exited.

Unfortunately, when the inferior program takes the hidden breakpoint,
all threads stop.  So any threads in sigwait() will be returned from
the sigwait().

> I don't have this problem if I don't run in gdb.

Again, that's right, and unfortunate.  The program behaves differently
when it's run under gdb.  You will have to wrap your system calls
with "if (errno == EINTR) restart" logic.

Michael C
GDB QA Guy




reply via email to

[Prev in Thread] Current Thread [Next in Thread]