[PATCH 5/6] Make gdb/linux-nat.c consider a waitstatus pending on the infrun side

Pedro Alves
2016-05-19T14:56:09Z

Working on the fix for gdb/19828, I saw
gdb.threads/attach-many-short-lived-threads.exp fail once in an
unusual way. Unfortunately I didn't keep debug logs, but it's an
issue similar to what's been fixed in remote.c a while ago --
linux-nat.c was not fetching the pending status from the right place.

gdb/ChangeLog:
yyyy-mm-dd Pedro Alves <palves@redhat.com>

PR gdb/19828
* linux-nat.c (get_pending_status): If the thread reported the
event to the core and it's pending, use the pending status signal
number.
---
gdb/linux-nat.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/gdb/linux-nat.c b/gdb/linux-nat.c
index ea2e4dc..f2bdddc 100644
--- a/gdb/linux-nat.c
+++ b/gdb/linux-nat.c
@@ -1330,7 +1330,10 @@ get_pending_status (struct lwp_info *lp, int *status)
{
struct thread_info *tp = find_thread_ptid (lp->ptid);

- signo = tp->suspend.stop_signal;
+ if (tp->suspend.waitstatus_pending_p)
+ signo = tp->suspend.waitstatus.value.sig;
+ else
+ signo = tp->suspend.stop_signal;
}
else if (!target_is_non_stop_p ())
{
--
2.5.5