From 75352e283fb2b265d14c750859156943f6eb2693 Mon Sep 17 00:00:00 2001 From: Sergio Durigan Junior Date: Fri, 15 Sep 2017 00:27:53 -0400 Subject: Use "switch_to_thread" more thoroughly on gdbserver This is a technical debt that I left when I ported "switch_to_thread" to gdbserver. It's a simple patch that converts occurences of: current_thread = find_thread_ptid (ptid); to: switch_to_thread (ptid); This patch also converts a simple "if" to a "gdb_assert" on gdbserver's version of "switch_to_thread": gdb_assert (ptid != minus_one_ptid); This change makes the code more similar to what GDB already does. Regtested on BuildBot. gdb/gdbserver/ChangeLog: 2017-09-26 Sergio Durigan Junior * gdbthread.h: Include "common-gdbthread.h". * inferiors.c (switch_to_thread): Use "gdb_assert" instead of "if" when validating the ptid. * remote-utils.c: Include "gdbthread.h". (prepare_resume_reply): Use "switch_to_thread". * target.c (done_accessing_memory): Likewise. --- gdb/gdbserver/remote-utils.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'gdb/gdbserver/remote-utils.c') diff --git a/gdb/gdbserver/remote-utils.c b/gdb/gdbserver/remote-utils.c index 25b7e41..7616046 100644 --- a/gdb/gdbserver/remote-utils.c +++ b/gdb/gdbserver/remote-utils.c @@ -23,6 +23,7 @@ #include "tdesc.h" #include "dll.h" #include "rsp-low.h" +#include "gdbthread.h" #include #if HAVE_SYS_IOCTL_H #include @@ -1188,7 +1189,7 @@ prepare_resume_reply (char *buf, ptid_t ptid, saved_thread = current_thread; - current_thread = find_thread_ptid (ptid); + switch_to_thread (ptid); regp = current_target_desc ()->expedite_regs; -- cgit v1.1