]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
Windows gdb+gdbserver: Eliminate struct pending_stop
authorPedro Alves <pedro@palves.net>
Wed, 17 May 2023 13:34:53 +0000 (14:34 +0100)
committerPedro Alves <pedro@palves.net>
Fri, 24 Apr 2026 20:28:44 +0000 (21:28 +0100)
After the previous patches, struct pending_stop only contains one
field.  So move that field into the windows_thread_info structure
directly, and eliminate struct pending_stop.

Approved-By: Tom Tromey <tom@tromey.com>
Change-Id: I7955884b3f378d8b39b908f6252d215f6568b367
commit-id:fb68c808

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

index cb7456c624e19fc157c11927d088bd9a9a017219..5258ce52a0f87b85512d58a9584e8049df8e9e3d 100644 (file)
 namespace windows_nat
 {
 
-/* Info about a potential pending stop.  Each thread holds one of
-   these.  See "windows_thread_info::pending_stop" for more
-   information.  */
-struct pending_stop
-{
-  /* The target waitstatus we computed.  TARGET_WAITKIND_IGNORE if the
-     thread does not have a pending stop.  */
-  target_waitstatus status;
-};
-
 struct windows_process_info;
 
 /* Thread information structure used to track extra information about
@@ -111,9 +101,14 @@ struct windows_thread_info
    queues the stop events.  However, this can result in the strange
    effect of trying to single step thread A -- leaving all other
    threads suspended -- and then seeing a stop in thread B.  To handle
-   this scenario, we queue all such "pending" stops here, and then
-   process them once the step has completed.  See PR gdb/22992.  */
-  struct pending_stop pending_stop {};
+   this scenario, we queue the "pending" stop here, and then
+   process it once the step has completed.  See PR gdb/22992.
+   If we do have a pending event, its Windows event info is in
+   LAST_EVENT.
+
+   TARGET_WAITKIND_IGNORE if the thread does not have a pending
+   stop.  */
+  target_waitstatus pending_status;
 
   /* The last Windows event returned by WaitForDebugEvent for this
      thread.  */
index 062ecf1e0632f0f09f0e583107acf9532a76c0ff..e0589c4de970b20ef3ed6ba1ae526d9e879a794e 100644 (file)
@@ -727,7 +727,7 @@ windows_nat_target::windows_continue (DWORD continue_status, int id,
     {
       if ((id == -1 || id == (int) th->tid)
          && !th->suspended
-         && th->pending_stop.status.kind () != TARGET_WAITKIND_IGNORE)
+         && th->pending_status.kind () != TARGET_WAITKIND_IGNORE)
        {
          DEBUG_EVENTS ("got matching pending stop event "
                        "for 0x%x, not resuming",
@@ -923,18 +923,18 @@ windows_nat_target::get_windows_debug_event
   DWORD thread_id = 0;
 
   /* If there is a relevant pending stop, report it now.  See the
-     comment by the definition of "windows_thread_info::pending_stop"
+     comment by the definition of "windows_thread_info::pending_status"
      for details on why this is needed.  */
   for (auto &th : windows_process->thread_list)
     {
       if (!th->suspended
-         && th->pending_stop.status.kind () != TARGET_WAITKIND_IGNORE)
+         && th->pending_status.kind () != TARGET_WAITKIND_IGNORE)
        {
          DEBUG_EVENTS ("reporting pending event for 0x%x", th->tid);
 
          thread_id = th->tid;
-         *ourstatus = th->pending_stop.status;
-         th->pending_stop.status.set_ignore ();
+         *ourstatus = th->pending_status;
+         th->pending_status.set_ignore ();
          *current_event = th->last_event;
 
          ptid_t ptid (windows_process->process_id, thread_id);
@@ -1159,7 +1159,7 @@ windows_nat_target::get_windows_debug_event
   if (th->suspended)
     {
       /* Pending stop.  See the comment by the definition of
-        "pending_stops" for details on why this is needed.  */
+        "pending_status" for details on why this is needed.  */
       DEBUG_EVENTS ("get_windows_debug_event - "
                    "unexpected stop in suspended thread 0x%x",
                    thread_id);
@@ -1172,7 +1172,7 @@ windows_nat_target::get_windows_debug_event
          th->pc_adjusted = false;
        }
 
-      th->pending_stop.status = *ourstatus;
+      th->pending_status = *ourstatus;
       ourstatus->set_ignore ();
 
       continue_last_debug_event_main_thread
index 0741dd24ed53289f934e740ed5c2a49bac562933..e712033898c317050275cb16b1727fa18fe60caa 100644 (file)
@@ -814,7 +814,7 @@ win32_process_target::resume (thread_resume *resume_info, size_t n)
        }
 
       if (!th->suspended
-         && th->pending_stop.status.kind () != TARGET_WAITKIND_IGNORE)
+         && th->pending_status.kind () != TARGET_WAITKIND_IGNORE)
        any_pending = true;
     });
 
@@ -957,10 +957,10 @@ get_child_debug_event (DWORD *continue_status,
        auto *th = static_cast<windows_thread_info *> (thread.target_data ());
 
        if (!th->suspended
-           && th->pending_stop.status.kind () != TARGET_WAITKIND_IGNORE)
+           && th->pending_status.kind () != TARGET_WAITKIND_IGNORE)
          {
-           *ourstatus = th->pending_stop.status;
-           th->pending_stop.status.set_ignore ();
+           *ourstatus = th->pending_status;
+           th->pending_status.set_ignore ();
            *current_event = th->last_event;
            ptid = debug_event_ptid (current_event);
            switch_to_thread (find_thread_ptid (ptid));
@@ -1120,13 +1120,13 @@ get_child_debug_event (DWORD *continue_status,
   if (th != nullptr && th->suspended)
     {
       /* Pending stop.  See the comment by the definition of
-        "windows_thread_info::pending_stop" for details on why this
+        "windows_thread_info::pending_status" for details on why this
         is needed.  */
       OUTMSG2 (("get_windows_debug_event - "
                "unexpected stop in suspended thread 0x%x\n",
                th->tid));
       maybe_adjust_pc (*current_event);
-      th->pending_stop.status = *ourstatus;
+      th->pending_status = *ourstatus;
       ourstatus->set_spurious ();
     }
   else