summaryrefslogtreecommitdiffstats
path: root/src/core/gdbstub/gdbstub.cpp
diff options
context:
space:
mode:
authorpolaris- <nagatospam@gmail.com>2015-10-21 13:45:35 +0200
committerpolaris- <nagatospam@gmail.com>2015-10-21 13:45:35 +0200
commitd1f73c424ff90d0de22bcd20d04b6ebef3a86645 (patch)
tree8a9a56c2ed5b3b8385bbef122097c0897261c64f /src/core/gdbstub/gdbstub.cpp
parentUpdate register read loops to go with last commit (diff)
downloadyuzu-d1f73c424ff90d0de22bcd20d04b6ebef3a86645.tar
yuzu-d1f73c424ff90d0de22bcd20d04b6ebef3a86645.tar.gz
yuzu-d1f73c424ff90d0de22bcd20d04b6ebef3a86645.tar.bz2
yuzu-d1f73c424ff90d0de22bcd20d04b6ebef3a86645.tar.lz
yuzu-d1f73c424ff90d0de22bcd20d04b6ebef3a86645.tar.xz
yuzu-d1f73c424ff90d0de22bcd20d04b6ebef3a86645.tar.zst
yuzu-d1f73c424ff90d0de22bcd20d04b6ebef3a86645.zip
Diffstat (limited to 'src/core/gdbstub/gdbstub.cpp')
-rw-r--r--src/core/gdbstub/gdbstub.cpp15
1 files changed, 9 insertions, 6 deletions
diff --git a/src/core/gdbstub/gdbstub.cpp b/src/core/gdbstub/gdbstub.cpp
index e7fed68f7..6c21b5998 100644
--- a/src/core/gdbstub/gdbstub.cpp
+++ b/src/core/gdbstub/gdbstub.cpp
@@ -488,17 +488,18 @@ static void ReadRegisters() {
memset(buffer, 0, sizeof(buffer));
u8* bufptr = buffer;
- for (int i = 0; i <= MAX_REGISTERS; i++) {
+ for (int i = 0, reg = 0; i <= MAX_REGISTERS; i++, reg++) {
if (i <= R15_REGISTER) {
- IntToHex(bufptr + i * 8, Core::g_app_core->GetReg(i));
+ IntToHex(bufptr + i * 8, Core::g_app_core->GetReg(reg));
} else if (i == CSPR_REGISTER) {
IntToHex(bufptr + i * 8, Core::g_app_core->GetCPSR());
} else if (i < CSPR_REGISTER) {
IntToHex(bufptr + i * 8, 0);
IntToHex(bufptr + (i + 1) * 8, 0);
i++; // These registers seem to be all 64bit instead of 32bit, so skip two instead of one
+ reg++;
} else if (i > CSPR_REGISTER && i < MAX_REGISTERS) {
- IntToHex(bufptr + i * 8, Core::g_app_core->GetVFPReg(i - CSPR_REGISTER - 1));
+ IntToHex(bufptr + i * 8, Core::g_app_core->GetVFPReg(reg - CSPR_REGISTER - 1));
IntToHex(bufptr + (i + 1) * 8, 0);
i++;
} else if (i == MAX_REGISTERS) {
@@ -542,15 +543,17 @@ static void WriteRegisters() {
if (command_buffer[0] != 'G')
return SendReply("E01");
- for (int i = 0; i <= MAX_REGISTERS; i++) {
+ for (int i = 0, reg = 0; i <= MAX_REGISTERS; i++, reg++) {
if (i <= R15_REGISTER) {
- Core::g_app_core->SetReg(i, HexToInt(buffer_ptr + i * 8));
+ Core::g_app_core->SetReg(reg, HexToInt(buffer_ptr + i * 8));
} else if (i == CSPR_REGISTER) {
Core::g_app_core->SetCPSR(HexToInt(buffer_ptr + i * 8));
} else if (i < CSPR_REGISTER) {
i++; // These registers seem to be all 64bit instead of 32bit, so skip two instead of one
+ reg++;
} else if (i > CSPR_REGISTER && i < MAX_REGISTERS) {
- Core::g_app_core->SetVFPReg(i - CSPR_REGISTER - 1, HexToInt(buffer_ptr + i * 8));
+ Core::g_app_core->SetVFPReg(reg - CSPR_REGISTER - 1, HexToInt(buffer_ptr + i * 8));
+ i++; // Skip padding
} else if (i == MAX_REGISTERS) {
Core::g_app_core->SetVFPSystemReg(VFP_FPSCR, HexToInt(buffer_ptr + i * 8));
}