[RFC,2/8] gdb, infrun: track last waitstatus per thread
Checks
Commit Message
---
gdb/gdbthread.h | 3 +++
gdb/infrun.c | 11 +++++++++--
2 files changed, 12 insertions(+), 2 deletions(-)
@@ -225,6 +225,9 @@ struct thread_control_state
/* Nonzero if stopped due to a step command. */
int stop_step = 0;
+ /* The last waitstatus for this thread. */
+ target_waitstatus stop_ws {};
+
/* Chain containing status of breakpoint(s) the thread stopped
at. */
bpstat *stop_bpstat = nullptr;
@@ -3134,6 +3134,7 @@ clear_proceed_status_thread (struct thread_info *tp)
/* Discard any remaining commands or status from previous stop. */
bpstat_clear (&tp->control.stop_bpstat);
+ tp->control.stop_ws.set_ignore ();
}
/* Notify the current interpreter and observers that the target is about to
@@ -4169,7 +4170,8 @@ do_target_wait_1 (inferior *inf, ptid_t ptid,
}
tp->set_stop_reason (TARGET_STOPPED_BY_NO_REASON);
- *status = tp->pending_waitstatus ();
+ tp->control.stop_ws = tp->pending_waitstatus ();
+ *status = tp->control.stop_ws;
tp->set_internal_state (THREAD_INT_STOPPED);
tp->clear_pending_waitstatus ();
@@ -4187,7 +4189,12 @@ do_target_wait_1 (inferior *inf, ptid_t ptid,
if (!target_can_async_p ())
options &= ~TARGET_WNOHANG;
- return target_wait (ptid, status, options);
+ ptid_t event_ptid = target_wait (ptid, status, options);
+ tp = inf->find_thread (event_ptid);
+ if (tp != nullptr)
+ tp->control.stop_ws = *status;
+
+ return event_ptid;
}
/* Wrapper for target_wait that first checks whether threads have