diff options
-rw-r--r-- | gdb/ChangeLog | 5 | ||||
-rw-r--r-- | gdb/nat/linux-waitpid.c | 21 |
2 files changed, 18 insertions, 8 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog index bb5f5aa..6cfb9c5 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,5 +1,10 @@ 2014-02-27 Pedro Alves <palves@redhat.com> + * nat/linux-waitpid.c (my_waitpid): Only block signals if WNOHANG + isn't set. + +2014-02-27 Pedro Alves <palves@redhat.com> + PR 12702 * linux-nat.c (status_to_str): Moved to nat/linux-waitpid.c. * nat/linux-waitpid.c: Include string.h. diff --git a/gdb/nat/linux-waitpid.c b/gdb/nat/linux-waitpid.c index e9e69db..4693120 100644 --- a/gdb/nat/linux-waitpid.c +++ b/gdb/nat/linux-waitpid.c @@ -92,15 +92,19 @@ my_waitpid (int pid, int *status, int flags) wnohang = (flags & WNOHANG) != 0; flags &= ~(__WALL | __WCLONE); - flags |= WNOHANG; - /* Block all signals while here. This avoids knowing about - LinuxThread's signals. */ - sigfillset (&block_mask); - sigprocmask (SIG_BLOCK, &block_mask, &org_mask); + if (!wnohang) + { + flags |= WNOHANG; + + /* Block all signals while here. This avoids knowing about + LinuxThread's signals. */ + sigfillset (&block_mask); + sigprocmask (SIG_BLOCK, &block_mask, &org_mask); - /* ... except during the sigsuspend below. */ - sigemptyset (&wake_mask); + /* ... except during the sigsuspend below. */ + sigemptyset (&wake_mask); + } while (1) { @@ -129,7 +133,8 @@ my_waitpid (int pid, int *status, int flags) flags ^= __WCLONE; } - sigprocmask (SIG_SETMASK, &org_mask, NULL); + if (!wnohang) + sigprocmask (SIG_SETMASK, &org_mask, NULL); } else { |