diff options
author | Ciaran Woodward <ciaranwoodward@xmos.com> | 2022-07-19 16:23:53 +0100 |
---|---|---|
committer | Ciaran Woodward <ciaranwoodward@xmos.com> | 2025-02-25 11:27:18 +0000 |
commit | bd217f6d0570c56cf15faf9852753bc56b504bbf (patch) | |
tree | 3553456302d2861042144f30b59704c3e70a7369 /gdb | |
parent | a6bc00ff35a42d6d555aa8de97d427074151ae47 (diff) | |
download | binutils-bd217f6d0570c56cf15faf9852753bc56b504bbf.zip binutils-bd217f6d0570c56cf15faf9852753bc56b504bbf.tar.gz binutils-bd217f6d0570c56cf15faf9852753bc56b504bbf.tar.bz2 |
gdb/remote: Set the thread of the remote before sending qRcmd.
GDB allows remotes to implement extension commands which can
be accessed using the 'monitor' command.
This allows remotes to implement functionality which does not
exist in GDB for whatever reason (doesn't make sense, too
specific to one target, etc.)
However, before this change, the remote would not necessarily know
which thread/inferior was currently selected on the GDB client.
This prevents the implementation of any 'monitor' commands which are
specific to a single inferior/thread on the remote.
This is because GDB informs the remote of the current thread
lazily - only when it is relevant to the RSP command next being
sent.
qRcmd is the underlying RSP command used for monitor commands, so
this change ensures that GDB will update the remote with the
'current' thread if it has changed since the remote was last
informed.
Approved-By: Tom Tromey <tom@tromey.com>
Diffstat (limited to 'gdb')
-rw-r--r-- | gdb/remote.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/gdb/remote.c b/gdb/remote.c index 9dfc372..8794649 100644 --- a/gdb/remote.c +++ b/gdb/remote.c @@ -12072,6 +12072,9 @@ remote_target::rcmd (const char *command, struct ui_file *outbuf) if (command == NULL) command = ""; + /* It might be important for this command to know the current thread. */ + set_general_thread (inferior_ptid); + /* The query prefix. */ strcpy (rs->buf.data (), "qRcmd,"); p = strchr (rs->buf.data (), '\0'); |