]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
Move wait_for_debug_event to nat/windows-nat.c
authorTom Tromey <tromey@adacore.com>
Wed, 8 Apr 2020 20:33:35 +0000 (14:33 -0600)
committerTom Tromey <tromey@adacore.com>
Wed, 8 Apr 2020 20:47:59 +0000 (14:47 -0600)
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.

gdb/ChangeLog
2020-04-08  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.

gdbserver/ChangeLog
2020-04-08  Tom Tromey  <tromey@adacore.com>

* win32-low.c (win32_kill, get_child_debug_event): Use
wait_for_debug_event.

gdb/ChangeLog
gdb/nat/windows-nat.c
gdb/nat/windows-nat.h
gdb/windows-nat.c
gdbserver/ChangeLog
gdbserver/win32-low.cc

index 738c6c2d779e1672fab7b067dd98460e3925ee84..3c3ae28dd85850f8999af732d056889c289ecdd7 100644 (file)
@@ -1,3 +1,11 @@
+2020-04-08  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.
+
 2020-04-08  Tom Tromey  <tromey@adacore.com>
 
        * windows-nat.c (get_windows_debug_event): Use
index 823471eb4dabe18872a4142a98f3821c7e56e8ed..bb28e9b13c71217fbba38b8d5718fa0b08f7fc85 100644 (file)
@@ -385,5 +385,15 @@ continue_last_debug_event (DWORD continue_status, bool debug_events)
                             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;
+}
 
 }
index 68b72d4bbd205f01abaadaee585e758725060817..846fa67f407c48dec6cf1bbf79870edef26d854f 100644 (file)
@@ -245,6 +245,11 @@ extern gdb::optional<pending_stop> fetch_pending_stop (bool debug_events);
 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
index 2ee7a2412a9b1dd5e93756871e40bcf185c655f6..cdaca8d0cbf6391b7e0f6412b252ad1515356ddc 100644 (file)
@@ -1495,17 +1495,6 @@ ctrl_c_handler (DWORD event_type)
   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).  */
 
index 6793795376ea2b9ebc8af541fb8c50a677cc0a65..792834077feddd098ab54a03487a4440cf550af0 100644 (file)
@@ -1,3 +1,8 @@
+2020-04-08  Tom Tromey  <tromey@adacore.com>
+
+       * win32-low.c (win32_kill, get_child_debug_event): Use
+       wait_for_debug_event.
+
 2020-04-08  Tom Tromey  <tromey@adacore.com>
 
        * win32-low.c (child_continue): Call continue_last_debug_event.
index 33f6470015376774c0ebe377ec1a6dcfe27fdf6f..d151505e9f8cad5fdfdbd1112fd0edbb3db210bf 100644 (file)
@@ -797,7 +797,7 @@ win32_process_target::kill (process_info *process)
     {
       if (!child_continue (DBG_CONTINUE, -1))
        break;
-      if (!WaitForDebugEvent (&current_event, INFINITE))
+      if (!wait_for_debug_event (&current_event, INFINITE))
        break;
       if (current_event.dwDebugEventCode == EXIT_PROCESS_DEBUG_EVENT)
        break;
@@ -1231,7 +1231,7 @@ get_child_debug_event (DWORD *continue_status,
         happen is the user will see a spurious breakpoint.  */
 
       current_event.dwDebugEventCode = 0;
-      if (!WaitForDebugEvent (&current_event, 0))
+      if (!wait_for_debug_event (&current_event, 0))
        {
          OUTMSG2(("no attach events left\n"));
          fake_breakpoint_event ();
@@ -1246,7 +1246,7 @@ get_child_debug_event (DWORD *continue_status,
       /* Keep the wait time low enough for comfortable remote
         interruption, but high enough so gdbserver doesn't become a
         bottleneck.  */
-      if (!WaitForDebugEvent (&current_event, 250))
+      if (!wait_for_debug_event (&current_event, 250))
         {
          DWORD e  = GetLastError();