diff options
author | Tom Tromey <tromey@adacore.com> | 2020-04-08 14:33:35 -0600 |
---|---|---|
committer | Tom Tromey <tromey@adacore.com> | 2020-04-08 14:47:58 -0600 |
commit | 98a032873232f9685dc7a5d632481c1488b9f1c5 (patch) | |
tree | 70351fce16a4d7860fa2cc9bb92032363babd7ed /gdbserver/win32-low.cc | |
parent | 7c7411bcabdbe88c6a2f1b9a6090eea0dc50686f (diff) | |
download | gdb-98a032873232f9685dc7a5d632481c1488b9f1c5.zip gdb-98a032873232f9685dc7a5d632481c1488b9f1c5.tar.gz gdb-98a032873232f9685dc7a5d632481c1488b9f1c5.tar.bz2 |
Share Windows thread-suspend and -resume code
This adds "suspend" and "resume" methods to windows_thread_info, and
changes gdb and gdbserver to share this code.
gdb/ChangeLog
2020-04-08 Tom Tromey <tromey@adacore.com>
* windows-nat.c (thread_rec): Use windows_thread_info::suspend.
(windows_continue): Use windows_continue::resume.
* nat/windows-nat.h (struct windows_thread_info) <suspend,
resume>: Declare new methods.
* nat/windows-nat.c: New file.
* configure.nat (NATDEPFILES): Add nat/windows-nat.o when needed.
gdbserver/ChangeLog
2020-04-08 Tom Tromey <tromey@adacore.com>
* win32-low.c (win32_require_context, suspend_one_thread): Use
windows_thread_info::suspend.
(continue_one_thread): Use windows_thread_info::resume.
* configure.srv (srv_tgtobj): Add windows-nat.o when needed.
Diffstat (limited to 'gdbserver/win32-low.cc')
-rw-r--r-- | gdbserver/win32-low.cc | 33 |
1 files changed, 3 insertions, 30 deletions
diff --git a/gdbserver/win32-low.cc b/gdbserver/win32-low.cc index 1284ed1..7cad640 100644 --- a/gdbserver/win32-low.cc +++ b/gdbserver/win32-low.cc @@ -171,18 +171,7 @@ win32_require_context (windows_thread_info *th) { if (th->context.ContextFlags == 0) { - if (!th->suspended) - { - if (SuspendThread (th->h) == (DWORD) -1) - { - DWORD err = GetLastError (); - OUTMSG (("warning: SuspendThread failed in thread_rec, " - "(error %d): %s\n", (int) err, strwinerror (err))); - } - else - th->suspended = 1; - } - + th->suspend (); win32_get_thread_context (th); } } @@ -435,13 +424,7 @@ continue_one_thread (thread_info *thread, int thread_id) th->context.ContextFlags = 0; } - if (ResumeThread (th->h) == (DWORD) -1) - { - DWORD err = GetLastError (); - OUTMSG (("warning: ResumeThread failed in continue_one_thread, " - "(error %d): %s\n", (int) err, strwinerror (err))); - } - th->suspended = 0; + th->resume (); } } } @@ -1348,17 +1331,7 @@ suspend_one_thread (thread_info *thread) { windows_thread_info *th = (windows_thread_info *) thread_target_data (thread); - if (!th->suspended) - { - if (SuspendThread (th->h) == (DWORD) -1) - { - DWORD err = GetLastError (); - OUTMSG (("warning: SuspendThread failed in suspend_one_thread, " - "(error %d): %s\n", (int) err, strwinerror (err))); - } - else - th->suspended = 1; - } + th->suspend (); } static void |