diff --git a/src/core/gdbstub/gdbstub.cpp b/src/core/gdbstub/gdbstub.cpp index d155762f3..872314482 100644 --- a/src/core/gdbstub/gdbstub.cpp +++ b/src/core/gdbstub/gdbstub.cpp @@ -60,6 +60,59 @@ const u32 R15_REGISTER = 15; const u32 CPSR_REGISTER = 25; const u32 FPSCR_REGISTER = 58; +// for sample xmls see the gdb source /gdb/features +// gdb also wants the l character at the start +// this XML defines what the registers are for this specific ARM device +static const char* target_xml = +R"(l + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +)"; + namespace GDBStub { static int gdbserver_socket = -1; @@ -353,8 +406,15 @@ static void SendReply(const char* reply) { static void HandleQuery() { LOG_DEBUG(Debug_GDBStub, "gdb: query '%s'\n", command_buffer + 1); - if (!strcmp(reinterpret_cast(command_buffer + 1), "TStatus")) { + const char *query = reinterpret_cast(command_buffer + 1); + + if (strcmp(query, "TStatus") == 0 ) { SendReply("T0"); + } else if (strncmp(query, "Supported:",strlen("Supported:")) == 0) { + /// PacketSize needs to be large enough for target xml + SendReply("PacketSize=800;qXfer:features:read+"); + } else if (strncmp(query, "Xfer:features:read:target.xml:",strlen("Xfer:features:read:target.xml:")) == 0) { + SendReply(target_xml); } else { SendReply(""); } @@ -500,10 +560,6 @@ static void ReadRegisters() { IntToGdbHex(bufptr, Core::g_app_core->GetCPSR()); -// Still getting "Remote 'g' packet reply is too long" from gdb with this -// Need to figure out how to get gdb to expect vfp registers. - -/* bufptr += CHAR_BIT; for (int reg = 0; reg <= 31; reg++) { @@ -513,7 +569,7 @@ static void ReadRegisters() { bufptr += (32 * CHAR_BIT); IntToGdbHex(bufptr, Core::g_app_core->GetVFPSystemReg(VFP_FPSCR)); -*/ + SendReply(reinterpret_cast(buffer)); }