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 /gdb/windows-nat.c | |
parent | 7c7411bcabdbe88c6a2f1b9a6090eea0dc50686f (diff) | |
download | fsf-binutils-gdb-98a032873232f9685dc7a5d632481c1488b9f1c5.zip fsf-binutils-gdb-98a032873232f9685dc7a5d632481c1488b9f1c5.tar.gz fsf-binutils-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 'gdb/windows-nat.c')
-rw-r--r-- | gdb/windows-nat.c | 26 |
1 files changed, 2 insertions, 24 deletions
diff --git a/gdb/windows-nat.c b/gdb/windows-nat.c index d2e900c..da35799 100644 --- a/gdb/windows-nat.c +++ b/gdb/windows-nat.c @@ -416,27 +416,7 @@ thread_rec (DWORD id, int get_context) if (!th->suspended && get_context) { if (get_context > 0 && id != current_event.dwThreadId) - { - if (SuspendThread (th->h) == (DWORD) -1) - { - DWORD err = GetLastError (); - - /* We get Access Denied (5) when trying to suspend - threads that Windows started on behalf of the - debuggee, usually when those threads are just - about to exit. - We can get Invalid Handle (6) if the main thread - has exited. */ - if (err != ERROR_INVALID_HANDLE - && err != ERROR_ACCESS_DENIED) - warning (_("SuspendThread (tid=0x%x) failed." - " (winerr %u)"), - (unsigned) id, (unsigned) err); - th->suspended = -1; - } - else - th->suspended = 1; - } + th->suspend (); else if (get_context < 0) th->suspended = -1; th->reload_context = true; @@ -1515,9 +1495,7 @@ windows_continue (DWORD continue_status, int id, int killed) th->context.ContextFlags = 0; } } - if (th->suspended > 0) - (void) ResumeThread (th->h); - th->suspended = 0; + th->resume (); } res = ContinueDebugEvent (current_event.dwProcessId, |