[binutils-gdb] Windows gdb: Factor code out of windows_nat_target::windows_continue

Pedro Alves via Gdb-cvs <[email protected]>
Newsgroups gmane.comp.gdb.cvs
Message-ID <[email protected]>
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=42cdda339eff96251b69ab964e311fcf26c773c8

commit 42cdda339eff96251b69ab964e311fcf26c773c8
Author: Pedro Alves <[email protected]>
Date:   Tue May 9 20:34:50 2023 +0100

    Windows gdb: Factor code out of windows_nat_target::windows_continue
    
    This factors some code out of windows_nat_target::windows_continue
    into a new windows_continue_one function.  This will make the
    following patch easier to read (as well as the resulting code itself).
    
    Approved-By: Tom Tromey <[email protected]>
    Change-Id: I14a0386b1b8b03015e86273060af173b5130e375

Diff:
---
 gdb/windows-nat.c | 16 ++++++++++------
 gdb/windows-nat.h |  3 +++
 2 files changed, 13 insertions(+), 6 deletions(-)

diff --git a/gdb/windows-nat.c b/gdb/windows-nat.c
index 170b837e930..2ecb8a105c0 100644
--- a/gdb/windows-nat.c
+++ b/gdb/windows-nat.c
@@ -704,6 +704,15 @@ windows_per_inferior::handle_access_violation
   return false;
 }
 
+void
+windows_nat_target::continue_one_thread (windows_thread_info *th,
+					 windows_continue_flags cont_flags)
+{
+  bool killed = (cont_flags & WCONT_KILLED) != 0;
+  thread_context_continue (th, killed);
+  th->resume ();
+}
+
 /* Resume thread specified by ID, or all artificially suspended
    threads, if we are continuing execution.  See description of
    windows_continue_flags for CONT_FLAGS.  */
@@ -725,12 +734,7 @@ windows_nat_target::windows_continue (DWORD continue_status, int id,
 
   for (auto &th : windows_process->thread_list)
     if (id == -1 || id == (int) th->tid)
-      {
-	bool killed = (cont_flags & WCONT_KILLED) != 0;
-	thread_context_continue (th.get (), killed);
-
-	th->resume ();
-      }
+      continue_one_thread (th.get (), cont_flags);
 
   continue_last_debug_event_main_thread
     (_("Failed to resume program execution"), continue_status,
diff --git a/gdb/windows-nat.h b/gdb/windows-nat.h
index c4f3b2423b6..221ce58a887 100644
--- a/gdb/windows-nat.h
+++ b/gdb/windows-nat.h
@@ -243,6 +243,9 @@ private:
   void delete_thread (ptid_t ptid, DWORD exit_code, bool main_thread_p);
   DWORD fake_create_process ();
 
+  void continue_one_thread (windows_thread_info *th,
+			    windows_continue_flags cont_flags);
+
   BOOL windows_continue (DWORD continue_status, int id,
 			 windows_continue_flags cont_flags = 0);
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.