From: Pedro Alves Date: Tue, 9 May 2023 19:34:50 +0000 (+0100) Subject: Windows gdb: Factor code out of windows_nat_target::windows_continue X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=42cdda339eff96251b69ab964e311fcf26c773c8;p=thirdparty%2Fbinutils-gdb.git 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 Change-Id: I14a0386b1b8b03015e86273060af173b5130e375 --- 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);