Send VFP registers

This commit is contained in:
Dave Murphy 2016-02-01 12:59:32 +00:00
parent 9c4d9f4aa5
commit c99a407998

View File

@ -60,6 +60,59 @@ const u32 R15_REGISTER = 15;
const u32 CPSR_REGISTER = 25; const u32 CPSR_REGISTER = 25;
const u32 FPSCR_REGISTER = 58; 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<?xml version="1.0"?>
<!DOCTYPE target SYSTEM "gdb-target.dtd">
<target version="1.0">
<feature name="org.gnu.gdb.arm.core">
<reg name="r0" bitsize="32"/>
<reg name="r1" bitsize="32"/>
<reg name="r2" bitsize="32"/>
<reg name="r3" bitsize="32"/>
<reg name="r4" bitsize="32"/>
<reg name="r5" bitsize="32"/>
<reg name="r6" bitsize="32"/>
<reg name="r7" bitsize="32"/>
<reg name="r8" bitsize="32"/>
<reg name="r9" bitsize="32"/>
<reg name="r10" bitsize="32"/>
<reg name="r11" bitsize="32"/>
<reg name="r12" bitsize="32"/>
<reg name="sp" bitsize="32" type="data_ptr"/>
<reg name="lr" bitsize="32"/>
<reg name="pc" bitsize="32" type="code_ptr"/>
<!-- The CPSR is register 25, rather than register 16, because
the FPA registers historically were placed between the PC
and the CPSR in the "g" packet. -->
<reg name="cpsr" bitsize="32" regnum="25"/>
</feature>
<feature name="org.gnu.gdb.arm.vfp">
<reg name="d0" bitsize="64" type="float"/>
<reg name="d1" bitsize="64" type="float"/>
<reg name="d2" bitsize="64" type="float"/>
<reg name="d3" bitsize="64" type="float"/>
<reg name="d4" bitsize="64" type="float"/>
<reg name="d5" bitsize="64" type="float"/>
<reg name="d6" bitsize="64" type="float"/>
<reg name="d7" bitsize="64" type="float"/>
<reg name="d8" bitsize="64" type="float"/>
<reg name="d9" bitsize="64" type="float"/>
<reg name="d10" bitsize="64" type="float"/>
<reg name="d11" bitsize="64" type="float"/>
<reg name="d12" bitsize="64" type="float"/>
<reg name="d13" bitsize="64" type="float"/>
<reg name="d14" bitsize="64" type="float"/>
<reg name="d15" bitsize="64" type="float"/>
<reg name="fpscr" bitsize="32" type="int" group="float"/>
</feature>
</target>
)";
namespace GDBStub { namespace GDBStub {
static int gdbserver_socket = -1; static int gdbserver_socket = -1;
@ -353,8 +406,15 @@ static void SendReply(const char* reply) {
static void HandleQuery() { static void HandleQuery() {
LOG_DEBUG(Debug_GDBStub, "gdb: query '%s'\n", command_buffer + 1); LOG_DEBUG(Debug_GDBStub, "gdb: query '%s'\n", command_buffer + 1);
if (!strcmp(reinterpret_cast<const char*>(command_buffer + 1), "TStatus")) { const char *query = reinterpret_cast<const char*>(command_buffer + 1);
if (strcmp(query, "TStatus") == 0 ) {
SendReply("T0"); 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 { } else {
SendReply(""); SendReply("");
} }
@ -500,10 +560,6 @@ static void ReadRegisters() {
IntToGdbHex(bufptr, Core::g_app_core->GetCPSR()); 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; bufptr += CHAR_BIT;
for (int reg = 0; reg <= 31; reg++) { for (int reg = 0; reg <= 31; reg++) {
@ -513,7 +569,7 @@ static void ReadRegisters() {
bufptr += (32 * CHAR_BIT); bufptr += (32 * CHAR_BIT);
IntToGdbHex(bufptr, Core::g_app_core->GetVFPSystemReg(VFP_FPSCR)); IntToGdbHex(bufptr, Core::g_app_core->GetVFPSystemReg(VFP_FPSCR));
*/
SendReply(reinterpret_cast<char*>(buffer)); SendReply(reinterpret_cast<char*>(buffer));
} }