Gabe Black has submitted this change. ( 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
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/44609
Tested-by: kokoro <[email protected]>
Reviewed-by: Bobby R. Bruce <[email protected]>
Reviewed-by: Daniel Carvalho <[email protected]>
Maintainer: Bobby R. Bruce <[email protected]>
---
M src/base/remote_gdb.cc
1 file changed, 24 insertions(+), 4 deletions(-)

Approvals:
  Daniel Carvalho: Looks good to me, but someone else must approve
  Bobby R. Bruce: Looks good to me, approved; Looks good to me, approved
  kokoro: Regressions pass



diff --git a/src/base/remote_gdb.cc b/src/base/remote_gdb.cc
index efda8e8..98686cf 100644
--- a/src/base/remote_gdb.cc
+++ b/src/base/remote_gdb.cc
@@ -909,13 +909,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: 6
Gerrit-Owner: Gabe Black <[email protected]>
Gerrit-Reviewer: Bobby R. Bruce <[email protected]>
Gerrit-Reviewer: Boris Shingarov <[email protected]>
Gerrit-Reviewer: Daniel Carvalho <[email protected]>
Gerrit-Reviewer: Gabe Black <[email protected]>
Gerrit-Reviewer: kokoro <[email protected]>
Gerrit-MessageType: merged
_______________________________________________
gem5-dev mailing list -- [email protected]
To unsubscribe send an email to [email protected]
%(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s

Reply via email to