diff options
Diffstat (limited to 'gdbremote.cpp')
-rw-r--r-- | gdbremote.cpp | 23 |
1 files changed, 20 insertions, 3 deletions
diff --git a/gdbremote.cpp b/gdbremote.cpp index a093192..eb0fed8 100644 --- a/gdbremote.cpp +++ b/gdbremote.cpp @@ -56,6 +56,24 @@ static int setup_socket(uint16_t port) return socket_fd; } +static std::string CreateResponse(const GDBRemote::Packet& packet) +{ + using namespace GDBRemote; + if (0) { + } else if (packet.type == PacketType::kQueryHaltReason) { + return "S05"; + } else if (packet.type == PacketType::kSetThreadForCont) { + return "OK"; + } else if (packet.type == PacketType::kQueryAttached) { + return "1"; + } else if (packet.type == PacketType::kInterrupt) { + return "OK"; + } else if (packet.type == PacketType::kReadGeneralRegisters) { + return std::string(2*4*17, '0') + "00000200"; // 17 registers + PC + } + return ""; +} + int main(int argc, char *argv[]) { const int port = argc > 1 ? atoi(argv[1]) : 3333; @@ -94,9 +112,8 @@ int main(int argc, char *argv[]) } if (res->packet.length() > 0) { const auto packet = GDBRemote::Packet::Parse(res->packet); - - (void) packet; - const auto response = exchange_ctx.WrapDataToSend(); + const auto response = + exchange_ctx.WrapDataToSend(CreateResponse(packet)); printf("-> \"%s\"\n", response.c_str()); if (send(conn_fd, &response[0], response.length(), 0) == -1) perror("Send failed (response)"); |