diff options
author | Tom Tromey <tromey@adacore.com> | 2020-04-08 14:33:35 -0600 |
---|---|---|
committer | Tom Tromey <tromey@adacore.com> | 2020-04-08 14:47:59 -0600 |
commit | e758e19c596f8d0683f6c8ca750eb4e79071523d (patch) | |
tree | a353862ef878e18d32918f5c5ed803836ada23cd /gdb/windows-nat.c | |
parent | 8d30e395779603a8d36fa8bdfddba88a312552f4 (diff) | |
download | gdb-e758e19c596f8d0683f6c8ca750eb4e79071523d.zip gdb-e758e19c596f8d0683f6c8ca750eb4e79071523d.tar.gz gdb-e758e19c596f8d0683f6c8ca750eb4e79071523d.tar.bz2 |
Share some inferior-related Windows code
This adds a couple of functions to nat/windows-nat.c and changes gdb
and gdbserver to use them. One function checks the list of pending
stops for a match (not yet used by gdbserver, but will be in a
subsequent patch); and the other is a wrapper for ContinueDebugEvent
that always uses the last "real" stop event.
gdb/ChangeLog
2020-04-08 Tom Tromey <tromey@adacore.com>
* windows-nat.c (windows_continue): Use matching_pending_stop and
continue_last_debug_event.
* nat/windows-nat.h (matching_pending_stop)
(continue_last_debug_event): Declare.
* nat/windows-nat.c (DEBUG_EVENTS): New define.
(matching_pending_stop, continue_last_debug_event): New
functions.
gdbserver/ChangeLog
2020-04-08 Tom Tromey <tromey@adacore.com>
* win32-low.c (child_continue): Call continue_last_debug_event.
Diffstat (limited to 'gdb/windows-nat.c')
-rw-r--r-- | gdb/windows-nat.c | 28 |
1 files changed, 3 insertions, 25 deletions
diff --git a/gdb/windows-nat.c b/gdb/windows-nat.c index d48f90a..d04dc06 100644 --- a/gdb/windows-nat.c +++ b/gdb/windows-nat.c @@ -1239,28 +1239,8 @@ windows_continue (DWORD continue_status, int id, int killed) desired_stop_thread_id = id; - /* If there are pending stops, and we might plausibly hit one of - them, we don't want to actually continue the inferior -- we just - want to report the stop. In this case, we just pretend to - continue. See the comment by the definition of "pending_stops" - for details on why this is needed. */ - for (const auto &item : pending_stops) - { - if (desired_stop_thread_id == -1 - || desired_stop_thread_id == item.thread_id) - { - DEBUG_EVENTS (("windows_continue - pending stop anticipated, " - "desired=0x%x, item=0x%x\n", - desired_stop_thread_id, item.thread_id)); - return TRUE; - } - } - - DEBUG_EVENTS (("ContinueDebugEvent (cpid=%d, ctid=0x%x, %s);\n", - (unsigned) last_wait_event.dwProcessId, - (unsigned) last_wait_event.dwThreadId, - continue_status == DBG_CONTINUE ? - "DBG_CONTINUE" : "DBG_EXCEPTION_NOT_HANDLED")); + if (matching_pending_stop (debug_events)) + return TRUE; for (windows_thread_info *th : thread_list) if (id == -1 || id == (int) th->tid) @@ -1333,9 +1313,7 @@ windows_continue (DWORD continue_status, int id, int killed) th->suspend (); } - res = ContinueDebugEvent (last_wait_event.dwProcessId, - last_wait_event.dwThreadId, - continue_status); + res = continue_last_debug_event (continue_status, debug_events); if (!res) error (_("Failed to resume program execution" |