Corrected issue with byte order expectations for target registers.

This was the cause for that issue with GDB using the incorrect memory addresses for local variables, after the PC and SP had been changed.
Also renamed SP start address parameter to make the byte order of the register clear.
This commit is contained in:
Nav
2021-07-02 01:34:17 +01:00
parent 9861c3652a
commit aa6395a002
5 changed files with 30 additions and 17 deletions

View File

@@ -312,10 +312,12 @@ void GdbRspDebugServer::handleGdbPacket(CommandPackets::ReadGeneralRegisters& pa
);
/*
* Finally, implode the register values, convert to hexadecimal form and send to the GDB client.
* Finally, reverse the register values (as they're all currently in MSB, but GDB expects them in LSB), implode
* the register values, convert to hexadecimal form and send to the GDB client.
*/
auto registers = std::vector<unsigned char>();
for (const auto& reg : registerSet) {
for (auto& reg : registerSet) {
std::reverse(reg.value.begin(), reg.value.end());
registers.insert(registers.end(), reg.value.begin(), reg.value.end());
}