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>
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');