From c99a4079980822255f7c6ee5e7ba99957c741aaa Mon Sep 17 00:00:00 2001 From: Dave Murphy Date: Mon, 1 Feb 2016 12:59:32 +0000 Subject: [PATCH] Send VFP registers --- src/core/gdbstub/gdbstub.cpp | 68 ++++++++++++++++++++++++++++++++---- 1 file changed, 62 insertions(+), 6 deletions(-) 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)); }