Gabe Black has uploaded this change for review. ( https://gem5-review.googlesource.com/c/public/gem5/+/44609 )

Change subject: base: Fill out the 'H' thread setting command in remote GDB.
......................................................................

base: Fill out the 'H' thread setting command in remote GDB.

Distinguish between the 'g' and 'c' subcommands. 'c' sets what thread(s)
should be continued or single stepped when those commands are used, and
'g' sets what thread(s) should be used for anything else. Also, insist
that all threads are used for continuing or single stepping.

Still complain if we're asked to switch threads, since we only have one
and we can't change to anything else.

Change-Id: Ia15c055baba48f75fc29ef369567535b0aa2c76b
---
M src/base/remote_gdb.cc
1 file changed, 24 insertions(+), 4 deletions(-)



diff --git a/src/base/remote_gdb.cc b/src/base/remote_gdb.cc
index 16373e6..d074c96 100644
--- a/src/base/remote_gdb.cc
+++ b/src/base/remote_gdb.cc
@@ -900,13 +900,33 @@
 bool
 BaseRemoteGDB::cmdSetThread(GdbCommand::Context &ctx)
 {
-    const char *p = ctx.data + 1; // Ignore the subcommand byte.
-    ContextID tid = 0;
+    const char *p = ctx.data;
+    char subcommand = *p++;
+    int tid = 0;
     bool all, any;
     if (!parseThreadId(&p, all, any, tid))
         throw CmdError("E01");
-    if (any || all || tid != tc->contextId())
-        throw CmdError("E02");
+
+    if (subcommand == 'c') {
+ // We can only single step or continue all threads at once, since we
+        // stop time itself and not individual threads.
+        if (!all)
+            throw CmdError("E02");
+    } else if (subcommand == 'g') {
+ // We don't currently support reading registers, memory, etc, from all
+        // threads at once. GDB may never ask for this, but if it does we
+        // should complain.
+        if (all)
+            throw CmdError("E03");
+ // If GDB cares which thread we're using and wants a different one, we
+        // don't support that right now.
+        if (!any && tid != tc->contextId())
+            throw CmdError("E04");
+        // Since we weren't asked to do anything, we succeeded.
+    } else {
+        throw CmdError("E05");
+    }
+
     send("OK");
     return true;
 }

--
To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/44609
To unsubscribe, or for help writing mail filters, visit https://gem5-review.googlesource.com/settings

Gerrit-Project: public/gem5
Gerrit-Branch: develop
Gerrit-Change-Id: Ia15c055baba48f75fc29ef369567535b0aa2c76b
Gerrit-Change-Number: 44609
Gerrit-PatchSet: 1
Gerrit-Owner: Gabe Black <gabe.bl...@gmail.com>
Gerrit-MessageType: newchange
_______________________________________________
gem5-dev mailing list -- gem5-dev@gem5.org
To unsubscribe send an email to gem5-dev-le...@gem5.org
%(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s

Reply via email to