Remove unneeded method
This commit is contained in:
parent
6ea396a974
commit
64f9d10b4c
11
cmdbuf.c
11
cmdbuf.c
|
@ -13,17 +13,6 @@ bool cmd_match_str(CommandBuf *cmd, const char *str) {
|
|||
return false;
|
||||
}
|
||||
|
||||
bool cmd_match_only_str(CommandBuf *cmd, const char *str) {
|
||||
size_t len = strlen(str);
|
||||
if (cmd->len != len) return false;
|
||||
if (!strncmp(cmd->buf, str, len)) {
|
||||
cmd->buf += len;
|
||||
cmd->len -= len;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool cmd_match_hex_number(CommandBuf *cmd, uint32_t *value) {
|
||||
size_t read = 0;
|
||||
size_t max_len = cmd->len;
|
||||
|
|
|
@ -12,8 +12,6 @@ typedef struct CommandBuf {
|
|||
|
||||
/* Try to consume a string literal. */
|
||||
bool cmd_match_str(CommandBuf *cmd, const char *str);
|
||||
/* Try to consume a string literal, if it is the only thing left in the buffer. */
|
||||
bool cmd_match_only_str(CommandBuf *cmd, const char *str);
|
||||
/* Try to consume a base-16 number, and return the value. */
|
||||
bool cmd_match_hex_number(CommandBuf *cmd, uint32_t *value);
|
||||
/* Try to consume a hex-encoded list of bytes, and return the value. */
|
||||
|
|
24
server.c
24
server.c
|
@ -72,7 +72,7 @@ const uint32_t PC_INDEX = 32 + 13;
|
|||
int handle_command(RdbResponse *res, CommandBuf *cmd, VB *sim, bool *running) {
|
||||
rdb_response_begin_packet(res);
|
||||
|
||||
if (cmd_match_only_str(cmd, "QStartNoAckMode")) {
|
||||
if (cmd_match_str(cmd, "QStartNoAckMode")) {
|
||||
// The debugger is asking us to no longer ACK messages.
|
||||
// Note that we ack THIS response, because we already called rdb_response_begin_packet.
|
||||
res->should_ack = false;
|
||||
|
@ -84,24 +84,24 @@ int handle_command(RdbResponse *res, CommandBuf *cmd, VB *sim, bool *running) {
|
|||
rdb_response_write_str(res, "no-resumed+;multiprocess;vContSupported;QNonStop+");
|
||||
return rdb_response_send_packet(res);
|
||||
}
|
||||
if (cmd_match_only_str(cmd, "QThreadSuffixSupported")) {
|
||||
if (cmd_match_str(cmd, "QThreadSuffixSupported")) {
|
||||
// The debugger is asking us to include the current thread as a suffix to some responses.
|
||||
rdb_response_write_str(res, "OK");
|
||||
return rdb_response_send_packet(res);
|
||||
}
|
||||
if (cmd_match_only_str(cmd, "QListThreadsInStopReply")) {
|
||||
if (cmd_match_str(cmd, "QListThreadsInStopReply")) {
|
||||
// The debugger is asking us to list all threads whenever we stop running.
|
||||
rdb_response_write_str(res, "OK");
|
||||
return rdb_response_send_packet(res);
|
||||
}
|
||||
if (cmd_match_only_str(cmd, "qHostInfo")) {
|
||||
if (cmd_match_str(cmd, "qHostInfo")) {
|
||||
// The debugger is asking us to describe the "host machine" getting debugged.
|
||||
rdb_response_write_str(res, "triple:");
|
||||
rdb_response_write_str_hex(res, "v810-unknown-vb");
|
||||
rdb_response_write_str(res, ";endian:little;ptrsize:4;");
|
||||
return rdb_response_send_packet(res);
|
||||
}
|
||||
if (cmd_match_only_str(cmd, "qProcessInfo")) {
|
||||
if (cmd_match_str(cmd, "qProcessInfo")) {
|
||||
// The debugger is asking us to describe the "process" getting debugged.
|
||||
// We make up a process with id 1.
|
||||
rdb_response_write_str(res, "pid:1;triple:");
|
||||
|
@ -118,22 +118,22 @@ int handle_command(RdbResponse *res, CommandBuf *cmd, VB *sim, bool *running) {
|
|||
}
|
||||
return rdb_response_send_packet(res);
|
||||
}
|
||||
if (cmd_match_only_str(cmd, "qfThreadInfo")) {
|
||||
if (cmd_match_str(cmd, "qfThreadInfo")) {
|
||||
// The debugger is asking us to list all threads. Return a list with "thread 1".
|
||||
rdb_response_write_str(res, "mp1.t1");
|
||||
return rdb_response_send_packet(res);
|
||||
}
|
||||
if (cmd_match_only_str(cmd, "qsThreadInfo")) {
|
||||
if (cmd_match_str(cmd, "qsThreadInfo")) {
|
||||
// The debugger is asking us to list all threads.
|
||||
rdb_response_write_str(res, "l");
|
||||
return rdb_response_send_packet(res);
|
||||
}
|
||||
if (cmd_match_only_str(cmd, "vCont?")) {
|
||||
if (cmd_match_str(cmd, "vCont?")) {
|
||||
// The debugger is asking which vCont commands we support.
|
||||
rdb_response_write_str(res, "c;C;s;S");
|
||||
return rdb_response_send_packet(res);
|
||||
}
|
||||
if (cmd_match_only_str(cmd, "qC")) {
|
||||
if (cmd_match_str(cmd, "qC")) {
|
||||
// The debugger is asking for the current thread id. Return "thread 1".
|
||||
rdb_response_write_str(res, "QCp1.t1");
|
||||
return rdb_response_send_packet(res);
|
||||
|
@ -188,20 +188,20 @@ int handle_command(RdbResponse *res, CommandBuf *cmd, VB *sim, bool *running) {
|
|||
rdb_response_write_str(res, "OK");
|
||||
return rdb_response_send_packet(res);
|
||||
}
|
||||
if (cmd_match_only_str(cmd, "c")) {
|
||||
if (cmd_match_str(cmd, "c")) {
|
||||
// The debugger has told us to run until we are stopped.
|
||||
// Don't send a response to this until we receive an ETX (when the debugger pauses us).
|
||||
*running = true;
|
||||
return 0;
|
||||
}
|
||||
if (cmd_match_only_str(cmd, "\x03")) {
|
||||
if (cmd_match_str(cmd, "\x03")) {
|
||||
// Received an ETX, indicating that the server wants to cancel the "c" command from before.
|
||||
*running = false;
|
||||
// Send the response to the "c" command from before.
|
||||
rdb_response_write_str(res, "T05thread:p1.t1;threads:p1.t1");
|
||||
return rdb_response_send_packet(res);
|
||||
}
|
||||
if (cmd_match_only_str(cmd, "?")) {
|
||||
if (cmd_match_str(cmd, "?")) {
|
||||
// The debugger has asked us why we stopped
|
||||
rdb_response_write_str(res, "T");
|
||||
rdb_response_write_str(res, *running ? "00" : "05");
|
||||
|
|
Loading…
Reference in New Issue