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

Change subject: base: Report actual thread numbers to remote GDB.
......................................................................

base: Report actual thread numbers to remote GDB.

This is more accurate, and will help when the GDB stub is able to manage
multiple threads through the same connection.

Change-Id: Ica04a8e2b5e93ca254fb2c2e1b44075634a69b9c
---
M src/base/remote_gdb.cc
M src/base/remote_gdb.hh
2 files changed, 20 insertions(+), 2 deletions(-)



diff --git a/src/base/remote_gdb.cc b/src/base/remote_gdb.cc
index 467893a..2aea740 100644
--- a/src/base/remote_gdb.cc
+++ b/src/base/remote_gdb.cc
@@ -865,7 +865,7 @@
 BaseRemoteGDB::cmdSetThread(GdbCommand::Context &ctx)
 {
     const char *p = ctx.data + 1; // Ignore the subcommand byte.
-    if (hex2i(&p) != 0)
+    if (hex2i(&p) != tc->contextId())
         throw CmdError("E01");
     send("OK");
     return true;
@@ -939,12 +939,14 @@
     { "C", { &BaseRemoteGDB::queryC } },
     { "Supported", { &BaseRemoteGDB::querySupported, ";" } },
     { "Xfer", { &BaseRemoteGDB::queryXfer } },
+    { "fThreadInfo", { &BaseRemoteGDB::queryFThreadInfo } },
+    { "sThreadInfo", { &BaseRemoteGDB::querySThreadInfo } },
 };

 bool
 BaseRemoteGDB::queryC(QuerySetCommand::Context &ctx)
 {
-    send("QC0");
+    send(csprintf("QC%x", tc->contextId()).c_str());
     return true;
 }

@@ -1007,6 +1009,20 @@
 }

 bool
+BaseRemoteGDB::queryFThreadInfo(QuerySetCommand::Context &ctx)
+{
+    send(csprintf("m%x", tc->contextId()).c_str());
+    return true;
+}
+
+bool
+BaseRemoteGDB::querySThreadInfo(QuerySetCommand::Context &ctx)
+{
+    send("l");
+    return true;
+}
+
+bool
 BaseRemoteGDB::cmdQueryVar(GdbCommand::Context &ctx)
 {
// The query command goes until the first ':', or the end of the string.
diff --git a/src/base/remote_gdb.hh b/src/base/remote_gdb.hh
index c279e4d..f45c89f 100644
--- a/src/base/remote_gdb.hh
+++ b/src/base/remote_gdb.hh
@@ -324,6 +324,8 @@
     bool queryC(QuerySetCommand::Context &ctx);
     bool querySupported(QuerySetCommand::Context &ctx);
     bool queryXfer(QuerySetCommand::Context &ctx);
+    bool queryFThreadInfo(QuerySetCommand::Context &ctx);
+    bool querySThreadInfo(QuerySetCommand::Context &ctx);

   protected:
     ThreadContext *context() { return tc; }

--
To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/44029
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: Ica04a8e2b5e93ca254fb2c2e1b44075634a69b9c
Gerrit-Change-Number: 44029
Gerrit-PatchSet: 1
Gerrit-Owner: Gabe Black <gabe.bl...@gmail.com>
Gerrit-CC: Gabe Black <gabebl...@google.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