aboutsummaryrefslogtreecommitdiff
path: root/gdb/windows-nat.c
diff options
context:
space:
mode:
authorTom Tromey <tromey@adacore.com>2020-04-08 14:33:35 -0600
committerTom Tromey <tromey@adacore.com>2020-04-08 14:47:59 -0600
commitd2977bc4253614907058d3a339875683d8215065 (patch)
tree606cb0b2f1e932e05e87c79077c1dba0253616aa /gdb/windows-nat.c
parente758e19c596f8d0683f6c8ca750eb4e79071523d (diff)
downloadgdb-d2977bc4253614907058d3a339875683d8215065.zip
gdb-d2977bc4253614907058d3a339875683d8215065.tar.gz
gdb-d2977bc4253614907058d3a339875683d8215065.tar.bz2
Introduce fetch_pending_stop
This introduces a new "fetch_pending_stop" function and changes gdb to use it. This function removes the first matching pending stop from the list of such stops. gdb/ChangeLog 2020-04-08 Tom Tromey <tromey@adacore.com> * windows-nat.c (get_windows_debug_event): Use fetch_pending_stop. * nat/windows-nat.h (fetch_pending_stop): Declare. * nat/windows-nat.c (fetch_pending_stop): New function.
Diffstat (limited to 'gdb/windows-nat.c')
-rw-r--r--gdb/windows-nat.c29
1 files changed, 9 insertions, 20 deletions
diff --git a/gdb/windows-nat.c b/gdb/windows-nat.c
index d04dc06..2ee7a24 100644
--- a/gdb/windows-nat.c
+++ b/gdb/windows-nat.c
@@ -1522,29 +1522,18 @@ windows_nat_target::get_windows_debug_event (int pid,
/* If there is a relevant pending stop, report it now. See the
comment by the definition of "pending_stops" for details on why
this is needed. */
- for (auto iter = pending_stops.begin ();
- iter != pending_stops.end ();
- ++iter)
+ gdb::optional<pending_stop> stop = fetch_pending_stop (debug_events);
+ if (stop.has_value ())
{
- if (desired_stop_thread_id == -1
- || desired_stop_thread_id == iter->thread_id)
- {
- thread_id = iter->thread_id;
- *ourstatus = iter->status;
- current_event = iter->event;
-
- inferior_ptid = ptid_t (current_event.dwProcessId, thread_id, 0);
- current_windows_thread = thread_rec (inferior_ptid,
- INVALIDATE_CONTEXT);
- current_windows_thread->reload_context = 1;
+ thread_id = stop->thread_id;
+ *ourstatus = stop->status;
- DEBUG_EVENTS (("get_windows_debug_event - "
- "pending stop found in 0x%x (desired=0x%x)\n",
- thread_id, desired_stop_thread_id));
+ inferior_ptid = ptid_t (current_event.dwProcessId, thread_id, 0);
+ current_windows_thread = thread_rec (inferior_ptid,
+ INVALIDATE_CONTEXT);
+ current_windows_thread->reload_context = 1;
- pending_stops.erase (iter);
- return thread_id;
- }
+ return thread_id;
}
last_sig = GDB_SIGNAL_0;