[review] Move wait_for_debug_event to nat/windows-nat.c
Commit Message
Change URL: https://gnutoolchain-gerrit.osci.io/r/c/binutils-gdb/+/719
......................................................................
Move wait_for_debug_event to nat/windows-nat.c
This moves the wait_for_debug_event helper function to
nat/windows-nat.c, and changes gdbserver to use it.
wait_for_debug_event is a wrapper for WaitForDebugEvent that also sets
last_wait_event when appropriate. This is needed to properly handle
queued stops.
2019-11-26 Tom Tromey <tromey@adacore.com>
* windows-nat.c (wait_for_debug_event): Move to
nat/windows-nat.c.
* nat/windows-nat.h (wait_for_debug_event): Declare.
* nat/windows-nat.c (wait_for_debug_event): Move from
windows-nat.c. No longer static.
gdb/gdbserver/ChangeLog
2019-11-26 Tom Tromey <tromey@adacore.com>
* win32-low.c (win32_kill, get_child_debug_event): Use
wait_for_debug_event.
Change-Id: I94347cefeeab99cacf713b1f8f09427319da0caa
---
M gdb/ChangeLog
M gdb/gdbserver/ChangeLog
M gdb/gdbserver/win32-low.c
M gdb/nat/windows-nat.c
M gdb/nat/windows-nat.h
M gdb/windows-nat.c
6 files changed, 31 insertions(+), 14 deletions(-)
Comments
Pedro Alves has posted comments on this change.
Change URL: https://gnutoolchain-gerrit.osci.io/r/c/binutils-gdb/+/719
......................................................................
Patch Set 1: Code-Review+2
@@ -1,5 +1,13 @@
2019-11-26 Tom Tromey <tromey@adacore.com>
+ * windows-nat.c (wait_for_debug_event): Move to
+ nat/windows-nat.c.
+ * nat/windows-nat.h (wait_for_debug_event): Declare.
+ * nat/windows-nat.c (wait_for_debug_event): Move from
+ windows-nat.c. No longer static.
+
+2019-11-26 Tom Tromey <tromey@adacore.com>
+
* windows-nat.c (get_windows_debug_event): Use
fetch_pending_stop.
* nat/windows-nat.h (fetch_pending_stop): Declare.
@@ -1,5 +1,10 @@
2019-11-26 Tom Tromey <tromey@adacore.com>
+ * win32-low.c (win32_kill, get_child_debug_event): Use
+ wait_for_debug_event.
+
+2019-11-26 Tom Tromey <tromey@adacore.com>
+
* win32-low.c (child_continue): Call continue_last_debug_event.
2019-11-26 Tom Tromey <tromey@adacore.com>
@@ -785,7 +785,7 @@
{
if (!child_continue (DBG_CONTINUE, -1))
break;
- if (!WaitForDebugEvent (¤t_event, INFINITE))
+ if (!wait_for_debug_event (¤t_event, INFINITE))
break;
if (current_event.dwDebugEventCode == EXIT_PROCESS_DEBUG_EVENT)
break;
@@ -1219,7 +1219,7 @@
happen is the user will see a spurious breakpoint. */
current_event.dwDebugEventCode = 0;
- if (!WaitForDebugEvent (¤t_event, 0))
+ if (!wait_for_debug_event (¤t_event, 0))
{
OUTMSG2(("no attach events left\n"));
fake_breakpoint_event ();
@@ -1234,7 +1234,7 @@
/* Keep the wait time low enough for comfortable remote
interruption, but high enough so gdbserver doesn't become a
bottleneck. */
- if (!WaitForDebugEvent (¤t_event, 250))
+ if (!wait_for_debug_event (¤t_event, 250))
{
DWORD e = GetLastError();
@@ -365,5 +365,15 @@
continue_status);
}
+/* See nat/windows-nat.h. */
+
+BOOL
+wait_for_debug_event (DEBUG_EVENT *event, DWORD timeout)
+{
+ BOOL result = WaitForDebugEvent (event, timeout);
+ if (result)
+ last_wait_event = *event;
+ return result;
+}
}
@@ -231,6 +231,11 @@
extern BOOL continue_last_debug_event (DWORD continue_status,
bool debug_events);
+/* A simple wrapper for WaitForDebugEvent that also sets
+ 'last_wait_event' on success. */
+
+extern BOOL wait_for_debug_event (DEBUG_EVENT *event, DWORD timeout);
+
}
#endif
@@ -1298,17 +1298,6 @@
return TRUE;
}
-/* A wrapper for WaitForDebugEvent that sets "last_wait_event"
- appropriately. */
-static BOOL
-wait_for_debug_event (DEBUG_EVENT *event, DWORD timeout)
-{
- BOOL result = WaitForDebugEvent (event, timeout);
- if (result)
- last_wait_event = *event;
- return result;
-}
-
/* Get the next event from the child. Returns a non-zero thread id if the event
requires handling by WFI (or whatever). */
static int