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 Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/44029 Reviewed-by: Gabe Black <gabe.black@gmail.com> Maintainer: Gabe Black <gabe.black@gmail.com> Tested-by: kokoro <noreply+kokoro@google.com>
This commit is contained in:
@@ -139,6 +139,7 @@
|
||||
#include <string>
|
||||
#include <utility>
|
||||
|
||||
#include "base/cprintf.hh"
|
||||
#include "base/intmath.hh"
|
||||
#include "base/socket.hh"
|
||||
#include "base/trace.hh"
|
||||
@@ -863,7 +864,7 @@ bool
|
||||
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;
|
||||
@@ -937,12 +938,14 @@ std::map<std::string, BaseRemoteGDB::QuerySetCommand>
|
||||
{ "C", { &BaseRemoteGDB::queryC } },
|
||||
{ "Supported", { &BaseRemoteGDB::querySupported, ";" } },
|
||||
{ "Xfer", { &BaseRemoteGDB::queryXfer } },
|
||||
{ "fThreadInfo", { &BaseRemoteGDB::queryFThreadInfo } },
|
||||
{ "sThreadInfo", { &BaseRemoteGDB::querySThreadInfo } },
|
||||
};
|
||||
|
||||
void
|
||||
BaseRemoteGDB::queryC(QuerySetCommand::Context &ctx)
|
||||
{
|
||||
send("QC0");
|
||||
send(csprintf("QC%x", tc->contextId()).c_str());
|
||||
}
|
||||
|
||||
void
|
||||
@@ -999,6 +1002,18 @@ BaseRemoteGDB::queryXfer(QuerySetCommand::Context &ctx)
|
||||
send(encoded.c_str());
|
||||
}
|
||||
|
||||
void
|
||||
BaseRemoteGDB::queryFThreadInfo(QuerySetCommand::Context &ctx)
|
||||
{
|
||||
send(csprintf("m%x", tc->contextId()).c_str());
|
||||
}
|
||||
|
||||
void
|
||||
BaseRemoteGDB::querySThreadInfo(QuerySetCommand::Context &ctx)
|
||||
{
|
||||
send("l");
|
||||
}
|
||||
|
||||
bool
|
||||
BaseRemoteGDB::cmdQueryVar(GdbCommand::Context &ctx)
|
||||
{
|
||||
|
||||
@@ -324,6 +324,8 @@ class BaseRemoteGDB
|
||||
void queryC(QuerySetCommand::Context &ctx);
|
||||
void querySupported(QuerySetCommand::Context &ctx);
|
||||
void queryXfer(QuerySetCommand::Context &ctx);
|
||||
void queryFThreadInfo(QuerySetCommand::Context &ctx);
|
||||
void querySThreadInfo(QuerySetCommand::Context &ctx);
|
||||
|
||||
protected:
|
||||
ThreadContext *context() { return tc; }
|
||||
|
||||
Reference in New Issue
Block a user