Gabe Black has uploaded this change for review. (
https://gem5-review.googlesource.com/c/public/gem5/+/44027 )
Change subject: base: Fix the syntax of the remote GDB command
implementations.
......................................................................
base: Fix the syntax of the remote GDB command implementations.
Since these are methods, they should be camel case, not underscores. The
command map should also be camel case.
Change-Id: Ie646a19b6e2fc022078722c67a11d370af4e84fe
---
M src/base/remote_gdb.cc
M src/base/remote_gdb.hh
2 files changed, 65 insertions(+), 65 deletions(-)
diff --git a/src/base/remote_gdb.cc b/src/base/remote_gdb.cc
index 38ddb75..bfc3e1a 100644
--- a/src/base/remote_gdb.cc
+++ b/src/base/remote_gdb.cc
@@ -446,15 +446,15 @@
recv(data);
if (data.size() == 1)
throw BadClient();
- cmdCtx.cmd_byte = data[0];
+ cmdCtx.cmdByte = data[0];
cmdCtx.data = data.data() + 1;
- // One for sentinel, one for cmd_byte.
+ // One for sentinel, one for cmdByte.
cmdCtx.len = data.size() - 2;
- auto cmdIt = command_map.find(cmdCtx.cmd_byte);
- if (cmdIt == command_map.end()) {
+ auto cmdIt = commandMap.find(cmdCtx.cmdByte);
+ if (cmdIt == commandMap.end()) {
DPRINTF(GDBMisc, "Unknown command: %c(%#x)\n",
- cmdCtx.cmd_byte, cmdCtx.cmd_byte);
+ cmdCtx.cmdByte, cmdCtx.cmdByte);
throw Unsupported();
}
cmdCtx.cmd = &(cmdIt->second);
@@ -726,61 +726,61 @@
tc->descheduleInstCountEvent(ev);
}
-std::map<char, BaseRemoteGDB::GdbCommand> BaseRemoteGDB::command_map = {
+std::map<char, BaseRemoteGDB::GdbCommand> BaseRemoteGDB::commandMap = {
// last signal
- { '?', { "KGDB_SIGNAL", &BaseRemoteGDB::cmd_signal } },
+ { '?', { "KGDB_SIGNAL", &BaseRemoteGDB::cmdSignal } },
// set baud (deprecated)
- { 'b', { "KGDB_SET_BAUD", &BaseRemoteGDB::cmd_unsupported } },
+ { 'b', { "KGDB_SET_BAUD", &BaseRemoteGDB::cmdUnsupported } },
// set breakpoint (deprecated)
- { 'B', { "KGDB_SET_BREAK", &BaseRemoteGDB::cmd_unsupported } },
+ { 'B', { "KGDB_SET_BREAK", &BaseRemoteGDB::cmdUnsupported } },
// resume
- { 'c', { "KGDB_CONT", &BaseRemoteGDB::cmd_cont } },
+ { 'c', { "KGDB_CONT", &BaseRemoteGDB::cmdCont } },
// continue with signal
- { 'C', { "KGDB_ASYNC_CONT", &BaseRemoteGDB::cmd_async_cont } },
+ { 'C', { "KGDB_ASYNC_CONT", &BaseRemoteGDB::cmdAsyncCont } },
// toggle debug flags (deprecated)
- { 'd', { "KGDB_DEBUG", &BaseRemoteGDB::cmd_unsupported } },
+ { 'd', { "KGDB_DEBUG", &BaseRemoteGDB::cmdUnsupported } },
// detach remote gdb
- { 'D', { "KGDB_DETACH", &BaseRemoteGDB::cmd_detach } },
+ { 'D', { "KGDB_DETACH", &BaseRemoteGDB::cmdDetach } },
// read general registers
- { 'g', { "KGDB_REG_R", &BaseRemoteGDB::cmd_reg_r } },
+ { 'g', { "KGDB_REG_R", &BaseRemoteGDB::cmdRegR } },
// write general registers
- { 'G', { "KGDB_REG_W", &BaseRemoteGDB::cmd_reg_w } },
+ { 'G', { "KGDB_REG_W", &BaseRemoteGDB::cmdRegW } },
// set thread
- { 'H', { "KGDB_SET_THREAD", &BaseRemoteGDB::cmd_set_thread } },
+ { 'H', { "KGDB_SET_THREAD", &BaseRemoteGDB::cmdSetThread } },
// step a single cycle
- { 'i', { "KGDB_CYCLE_STEP", &BaseRemoteGDB::cmd_unsupported } },
+ { 'i', { "KGDB_CYCLE_STEP", &BaseRemoteGDB::cmdUnsupported } },
// signal then cycle step
- { 'I', { "KGDB_SIG_CYCLE_STEP", &BaseRemoteGDB::cmd_unsupported } },
+ { 'I', { "KGDB_SIG_CYCLE_STEP", &BaseRemoteGDB::cmdUnsupported } },
// kill program
- { 'k', { "KGDB_KILL", &BaseRemoteGDB::cmd_detach } },
+ { 'k', { "KGDB_KILL", &BaseRemoteGDB::cmdDetach } },
// read memory
- { 'm', { "KGDB_MEM_R", &BaseRemoteGDB::cmd_mem_r } },
+ { 'm', { "KGDB_MEM_R", &BaseRemoteGDB::cmdMemR } },
// write memory
- { 'M', { "KGDB_MEM_W", &BaseRemoteGDB::cmd_mem_w } },
+ { 'M', { "KGDB_MEM_W", &BaseRemoteGDB::cmdMemW } },
// read register
- { 'p', { "KGDB_READ_REG", &BaseRemoteGDB::cmd_unsupported } },
+ { 'p', { "KGDB_READ_REG", &BaseRemoteGDB::cmdUnsupported } },
// write register
- { 'P', { "KGDB_SET_REG", &BaseRemoteGDB::cmd_unsupported } },
+ { 'P', { "KGDB_SET_REG", &BaseRemoteGDB::cmdUnsupported } },
// query variable
- { 'q', { "KGDB_QUERY_VAR", &BaseRemoteGDB::cmd_query_var } },
+ { 'q', { "KGDB_QUERY_VAR", &BaseRemoteGDB::cmdQueryVar } },
// set variable
- { 'Q', { "KGDB_SET_VAR", &BaseRemoteGDB::cmd_unsupported } },
+ { 'Q', { "KGDB_SET_VAR", &BaseRemoteGDB::cmdUnsupported } },
// reset system (deprecated)
- { 'r', { "KGDB_RESET", &BaseRemoteGDB::cmd_unsupported } },
+ { 'r', { "KGDB_RESET", &BaseRemoteGDB::cmdUnsupported } },
// step
- { 's', { "KGDB_STEP", &BaseRemoteGDB::cmd_step } },
+ { 's', { "KGDB_STEP", &BaseRemoteGDB::cmdStep } },
// signal and step
- { 'S', { "KGDB_ASYNC_STEP", &BaseRemoteGDB::cmd_async_step } },
+ { 'S', { "KGDB_ASYNC_STEP", &BaseRemoteGDB::cmdAsyncStep } },
// find out if the thread is alive
- { 'T', { "KGDB_THREAD_ALIVE", &BaseRemoteGDB::cmd_unsupported } },
+ { 'T', { "KGDB_THREAD_ALIVE", &BaseRemoteGDB::cmdUnsupported } },
// target exited
- { 'W', { "KGDB_TARGET_EXIT", &BaseRemoteGDB::cmd_unsupported } },
+ { 'W', { "KGDB_TARGET_EXIT", &BaseRemoteGDB::cmdUnsupported } },
// write memory
- { 'X', { "KGDB_BINARY_DLOAD", &BaseRemoteGDB::cmd_unsupported } },
+ { 'X', { "KGDB_BINARY_DLOAD", &BaseRemoteGDB::cmdUnsupported } },
// remove breakpoint or watchpoint
- { 'z', { "KGDB_CLR_HW_BKPT", &BaseRemoteGDB::cmd_clr_hw_bkpt } },
+ { 'z', { "KGDB_CLR_HW_BKPT", &BaseRemoteGDB::cmdClrHwBkpt } },
// insert breakpoint or watchpoint
- { 'Z', { "KGDB_SET_HW_BKPT", &BaseRemoteGDB::cmd_set_hw_bkpt } },
+ { 'Z', { "KGDB_SET_HW_BKPT", &BaseRemoteGDB::cmdSetHwBkpt } },
};
bool
@@ -790,7 +790,7 @@
}
bool
-BaseRemoteGDB::cmd_unsupported(GdbCommand::Context &ctx)
+BaseRemoteGDB::cmdUnsupported(GdbCommand::Context &ctx)
{
DPRINTF(GDBMisc, "Unsupported command: %s\n", ctx.cmd->name);
DDUMP(GDBMisc, ctx.data, ctx.len);
@@ -799,14 +799,14 @@
bool
-BaseRemoteGDB::cmd_signal(GdbCommand::Context &ctx)
+BaseRemoteGDB::cmdSignal(GdbCommand::Context &ctx)
{
send(csprintf("S%02x", ctx.type).c_str());
return true;
}
bool
-BaseRemoteGDB::cmd_cont(GdbCommand::Context &ctx)
+BaseRemoteGDB::cmdCont(GdbCommand::Context &ctx)
{
const char *p = ctx.data;
if (ctx.len) {
@@ -818,7 +818,7 @@
}
bool
-BaseRemoteGDB::cmd_async_cont(GdbCommand::Context &ctx)
+BaseRemoteGDB::cmdAsyncCont(GdbCommand::Context &ctx)
{
const char *p = ctx.data;
hex2i(&p);
@@ -831,14 +831,14 @@
}
bool
-BaseRemoteGDB::cmd_detach(GdbCommand::Context &ctx)
+BaseRemoteGDB::cmdDetach(GdbCommand::Context &ctx)
{
detach();
return false;
}
bool
-BaseRemoteGDB::cmd_reg_r(GdbCommand::Context &ctx)
+BaseRemoteGDB::cmdRegR(GdbCommand::Context &ctx)
{
char buf[2 * regCachePtr->size() + 1];
buf[2 * regCachePtr->size()] = '\0';
@@ -848,7 +848,7 @@
}
bool
-BaseRemoteGDB::cmd_reg_w(GdbCommand::Context &ctx)
+BaseRemoteGDB::cmdRegW(GdbCommand::Context &ctx)
{
const char *p = ctx.data;
p = hex2mem(regCachePtr->data(), p, regCachePtr->size());
@@ -862,7 +862,7 @@
}
bool
-BaseRemoteGDB::cmd_set_thread(GdbCommand::Context &ctx)
+BaseRemoteGDB::cmdSetThread(GdbCommand::Context &ctx)
{
const char *p = ctx.data + 1; // Ignore the subcommand byte.
if (hex2i(&p) != 0)
@@ -872,7 +872,7 @@
}
bool
-BaseRemoteGDB::cmd_mem_r(GdbCommand::Context &ctx)
+BaseRemoteGDB::cmdMemR(GdbCommand::Context &ctx)
{
const char *p = ctx.data;
Addr addr = hex2i(&p);
@@ -896,7 +896,7 @@
}
bool
-BaseRemoteGDB::cmd_mem_w(GdbCommand::Context &ctx)
+BaseRemoteGDB::cmdMemW(GdbCommand::Context &ctx)
{
const char *p = ctx.data;
Addr addr = hex2i(&p);
@@ -920,7 +920,7 @@
}
bool
-BaseRemoteGDB::cmd_query_var(GdbCommand::Context &ctx)
+BaseRemoteGDB::cmdQueryVar(GdbCommand::Context &ctx)
{
std::string s(ctx.data, ctx.len);
std::string xfer_read_prefix = "Xfer:features:read:";
@@ -1003,7 +1003,7 @@
}
bool
-BaseRemoteGDB::cmd_async_step(GdbCommand::Context &ctx)
+BaseRemoteGDB::cmdAsyncStep(GdbCommand::Context &ctx)
{
const char *p = ctx.data;
hex2i(&p); // Ignore the subcommand byte.
@@ -1016,7 +1016,7 @@
}
bool
-BaseRemoteGDB::cmd_step(GdbCommand::Context &ctx)
+BaseRemoteGDB::cmdStep(GdbCommand::Context &ctx)
{
if (ctx.len) {
const char *p = ctx.data;
@@ -1028,7 +1028,7 @@
}
bool
-BaseRemoteGDB::cmd_clr_hw_bkpt(GdbCommand::Context &ctx)
+BaseRemoteGDB::cmdClrHwBkpt(GdbCommand::Context &ctx)
{
const char *p = ctx.data;
char subcmd = *p++;
@@ -1061,7 +1061,7 @@
}
bool
-BaseRemoteGDB::cmd_set_hw_bkpt(GdbCommand::Context &ctx)
+BaseRemoteGDB::cmdSetHwBkpt(GdbCommand::Context &ctx)
{
const char *p = ctx.data;
char subcmd = *p++;
diff --git a/src/base/remote_gdb.hh b/src/base/remote_gdb.hh
index cbfb46f..1633e55 100644
--- a/src/base/remote_gdb.hh
+++ b/src/base/remote_gdb.hh
@@ -266,7 +266,7 @@
struct Context
{
const GdbCommand *cmd;
- char cmd_byte;
+ char cmdByte;
int type;
char *data;
int len;
@@ -280,24 +280,24 @@
GdbCommand(const char *_name, Func _func) : name(_name),
func(_func) {}
};
- static std::map<char, GdbCommand> command_map;
+ static std::map<char, GdbCommand> commandMap;
- bool cmd_unsupported(GdbCommand::Context &ctx);
+ bool cmdUnsupported(GdbCommand::Context &ctx);
- bool cmd_signal(GdbCommand::Context &ctx);
- bool cmd_cont(GdbCommand::Context &ctx);
- bool cmd_async_cont(GdbCommand::Context &ctx);
- bool cmd_detach(GdbCommand::Context &ctx);
- bool cmd_reg_r(GdbCommand::Context &ctx);
- bool cmd_reg_w(GdbCommand::Context &ctx);
- bool cmd_set_thread(GdbCommand::Context &ctx);
- bool cmd_mem_r(GdbCommand::Context &ctx);
- bool cmd_mem_w(GdbCommand::Context &ctx);
- bool cmd_query_var(GdbCommand::Context &ctx);
- bool cmd_step(GdbCommand::Context &ctx);
- bool cmd_async_step(GdbCommand::Context &ctx);
- bool cmd_clr_hw_bkpt(GdbCommand::Context &ctx);
- bool cmd_set_hw_bkpt(GdbCommand::Context &ctx);
+ bool cmdSignal(GdbCommand::Context &ctx);
+ bool cmdCont(GdbCommand::Context &ctx);
+ bool cmdAsyncCont(GdbCommand::Context &ctx);
+ bool cmdDetach(GdbCommand::Context &ctx);
+ bool cmdRegR(GdbCommand::Context &ctx);
+ bool cmdRegW(GdbCommand::Context &ctx);
+ bool cmdSetThread(GdbCommand::Context &ctx);
+ bool cmdMemR(GdbCommand::Context &ctx);
+ bool cmdMemW(GdbCommand::Context &ctx);
+ bool cmdQueryVar(GdbCommand::Context &ctx);
+ bool cmdStep(GdbCommand::Context &ctx);
+ bool cmdAsyncStep(GdbCommand::Context &ctx);
+ bool cmdClrHwBkpt(GdbCommand::Context &ctx);
+ bool cmdSetHwBkpt(GdbCommand::Context &ctx);
protected:
ThreadContext *context() { return tc; }
--
To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/44027
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: Ie646a19b6e2fc022078722c67a11d370af4e84fe
Gerrit-Change-Number: 44027
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