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 | |
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')
-rw-r--r-- | gdbserver/ChangeLog | 7 | ||||
-rw-r--r-- | gdbserver/configure.srv | 7 | ||||
-rw-r--r-- | gdbserver/win32-low.cc | 33 |
3 files changed, 16 insertions, 31 deletions
diff --git a/gdbserver/ChangeLog b/gdbserver/ChangeLog index 25b5768..29d1760 100644 --- a/gdbserver/ChangeLog +++ b/gdbserver/ChangeLog @@ -1,5 +1,12 @@ 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. + +2020-04-08 Tom Tromey <tromey@adacore.com> + * win32-i386-low.c (update_debug_registers) (i386_prepare_to_resume, i386_thread_added): Update. diff --git a/gdbserver/configure.srv b/gdbserver/configure.srv index ecdd63a..7acf229 100644 --- a/gdbserver/configure.srv +++ b/gdbserver/configure.srv @@ -74,7 +74,7 @@ case "${gdbserver_host}" in srv_linux_thread_db=yes ;; arm*-*-mingw32ce*) srv_regobj=reg-arm.o - srv_tgtobj="win32-low.o win32-arm-low.o" + srv_tgtobj="win32-low.o windows-nat.o win32-arm-low.o" srv_tgtobj="${srv_tgtobj} wincecompat.o" # hostio_last_error implementation is in win32-low.c srv_hostio_err_objs="" @@ -99,6 +99,7 @@ case "${gdbserver_host}" in i[34567]86-*-cygwin*) srv_regobj="" srv_tgtobj="x86-low.o nat/x86-dregs.o win32-low.o" srv_tgtobj="${srv_tgtobj} win32-i386-low.o" + srv_tgtobj="${srv_tgtobj} nat/windows-nat.o" srv_tgtobj="${srv_tgtobj} arch/i386.o" ;; i[34567]86-*-linux*) srv_tgtobj="${srv_tgtobj} arch/i386.o" @@ -126,6 +127,7 @@ case "${gdbserver_host}" in srv_regobj="" srv_tgtobj="x86-low.o nat/x86-dregs.o win32-low.o" srv_tgtobj="${srv_tgtobj} win32-i386-low.o" + srv_tgtobj="${srv_tgtobj} nat/windows-nat.o" srv_tgtobj="${srv_tgtobj} arch/i386.o" srv_tgtobj="${srv_tgtobj} wincecompat.o" # hostio_last_error implementation is in win32-low.c @@ -136,6 +138,7 @@ case "${gdbserver_host}" in i[34567]86-*-mingw*) srv_regobj="" srv_tgtobj="x86-low.o nat/x86-dregs.o win32-low.o" srv_tgtobj="${srv_tgtobj} win32-i386-low.o" + srv_tgtobj="${srv_tgtobj} nat/windows-nat.o" srv_tgtobj="${srv_tgtobj} arch/i386.o" srv_mingw=yes ;; @@ -393,12 +396,14 @@ case "${gdbserver_host}" in x86_64-*-mingw*) srv_regobj="" srv_tgtobj="x86-low.o nat/x86-dregs.o i387-fp.o" srv_tgtobj="${srv_tgtobj} win32-low.o win32-i386-low.o" + srv_tgtobj="${srv_tgtobj} nat/windows-nat.o" srv_tgtobj="${srv_tgtobj} arch/amd64.o" srv_mingw=yes ;; x86_64-*-cygwin*) srv_regobj="" srv_tgtobj="x86-low.o nat/x86-dregs.o i387-fp.o" srv_tgtobj="${srv_tgtobj} win32-low.o win32-i386-low.o" + srv_tgtobj="${srv_tgtobj} nat/windows-nat.o" srv_tgtobj="${srv_tgtobj} arch/amd64.o" ;; 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 |