diff options
Diffstat (limited to 'src/core/gdbstub')
-rw-r--r-- | src/core/gdbstub/gdbstub.cpp | 39 |
1 files changed, 20 insertions, 19 deletions
diff --git a/src/core/gdbstub/gdbstub.cpp b/src/core/gdbstub/gdbstub.cpp index f96cbde64..9acdd402b 100644 --- a/src/core/gdbstub/gdbstub.cpp +++ b/src/core/gdbstub/gdbstub.cpp @@ -30,6 +30,7 @@ #include <unistd.h> #endif +#include "core/loader/loader.h" #include "common/logging/log.h" #include "common/string_util.h" #include "core/arm/arm_interface.h" @@ -450,8 +451,8 @@ static void SendSignal(u32 signal) { latest_signal = signal; std::string buffer = Common::StringFromFormat("T%02x%02x:%08x;%02x:%08x;", latest_signal, 15, - htonl(Core::g_app_core->GetPC()), 13, - htonl(Core::g_app_core->GetReg(13))); + htonl(Core::AppCore().GetPC()), 13, + htonl(Core::AppCore().GetReg(13))); LOG_DEBUG(Debug_GDBStub, "Response: %s", buffer.c_str()); SendReply(buffer.c_str()); } @@ -538,15 +539,15 @@ static void ReadRegister() { } if (id <= R15_REGISTER) { - IntToGdbHex(reply, Core::g_app_core->GetReg(id)); + IntToGdbHex(reply, Core::AppCore().GetReg(id)); } else if (id == CPSR_REGISTER) { - IntToGdbHex(reply, Core::g_app_core->GetCPSR()); + IntToGdbHex(reply, Core::AppCore().GetCPSR()); } else if (id > CPSR_REGISTER && id < FPSCR_REGISTER) { - IntToGdbHex(reply, Core::g_app_core->GetVFPReg( + IntToGdbHex(reply, Core::AppCore().GetVFPReg( id - CPSR_REGISTER - 1)); // VFP registers should start at 26, so one after CSPR_REGISTER } else if (id == FPSCR_REGISTER) { - IntToGdbHex(reply, Core::g_app_core->GetVFPSystemReg(VFP_FPSCR)); // Get FPSCR + IntToGdbHex(reply, Core::AppCore().GetVFPSystemReg(VFP_FPSCR)); // Get FPSCR IntToGdbHex(reply + 8, 0); } else { return SendReply("E01"); @@ -563,22 +564,22 @@ static void ReadRegisters() { u8* bufptr = buffer; for (int reg = 0; reg <= R15_REGISTER; reg++) { - IntToGdbHex(bufptr + reg * CHAR_BIT, Core::g_app_core->GetReg(reg)); + IntToGdbHex(bufptr + reg * CHAR_BIT, Core::AppCore().GetReg(reg)); } bufptr += (16 * CHAR_BIT); - IntToGdbHex(bufptr, Core::g_app_core->GetCPSR()); + IntToGdbHex(bufptr, Core::AppCore().GetCPSR()); bufptr += CHAR_BIT; for (int reg = 0; reg <= 31; reg++) { - IntToGdbHex(bufptr + reg * CHAR_BIT, Core::g_app_core->GetVFPReg(reg)); + IntToGdbHex(bufptr + reg * CHAR_BIT, Core::AppCore().GetVFPReg(reg)); } bufptr += (32 * CHAR_BIT); - IntToGdbHex(bufptr, Core::g_app_core->GetVFPSystemReg(VFP_FPSCR)); + IntToGdbHex(bufptr, Core::AppCore().GetVFPSystemReg(VFP_FPSCR)); SendReply(reinterpret_cast<char*>(buffer)); } @@ -595,13 +596,13 @@ static void WriteRegister() { } if (id <= R15_REGISTER) { - Core::g_app_core->SetReg(id, GdbHexToInt(buffer_ptr)); + Core::AppCore().SetReg(id, GdbHexToInt(buffer_ptr)); } else if (id == CPSR_REGISTER) { - Core::g_app_core->SetCPSR(GdbHexToInt(buffer_ptr)); + Core::AppCore().SetCPSR(GdbHexToInt(buffer_ptr)); } else if (id > CPSR_REGISTER && id < FPSCR_REGISTER) { - Core::g_app_core->SetVFPReg(id - CPSR_REGISTER - 1, GdbHexToInt(buffer_ptr)); + Core::AppCore().SetVFPReg(id - CPSR_REGISTER - 1, GdbHexToInt(buffer_ptr)); } else if (id == FPSCR_REGISTER) { - Core::g_app_core->SetVFPSystemReg(VFP_FPSCR, GdbHexToInt(buffer_ptr)); + Core::AppCore().SetVFPSystemReg(VFP_FPSCR, GdbHexToInt(buffer_ptr)); } else { return SendReply("E01"); } @@ -618,20 +619,20 @@ static void WriteRegisters() { for (int i = 0, reg = 0; reg <= FPSCR_REGISTER; i++, reg++) { if (reg <= R15_REGISTER) { - Core::g_app_core->SetReg(reg, GdbHexToInt(buffer_ptr + i * CHAR_BIT)); + Core::AppCore().SetReg(reg, GdbHexToInt(buffer_ptr + i * CHAR_BIT)); } else if (reg == CPSR_REGISTER) { - Core::g_app_core->SetCPSR(GdbHexToInt(buffer_ptr + i * CHAR_BIT)); + Core::AppCore().SetCPSR(GdbHexToInt(buffer_ptr + i * CHAR_BIT)); } else if (reg == CPSR_REGISTER - 1) { // Dummy FPA register, ignore } else if (reg < CPSR_REGISTER) { // Dummy FPA registers, ignore i += 2; } else if (reg > CPSR_REGISTER && reg < FPSCR_REGISTER) { - Core::g_app_core->SetVFPReg(reg - CPSR_REGISTER - 1, + Core::AppCore().SetVFPReg(reg - CPSR_REGISTER - 1, GdbHexToInt(buffer_ptr + i * CHAR_BIT)); i++; // Skip padding } else if (reg == FPSCR_REGISTER) { - Core::g_app_core->SetVFPSystemReg(VFP_FPSCR, GdbHexToInt(buffer_ptr + i * CHAR_BIT)); + Core::AppCore().SetVFPSystemReg(VFP_FPSCR, GdbHexToInt(buffer_ptr + i * CHAR_BIT)); } } @@ -908,7 +909,7 @@ void ToggleServer(bool status) { server_enabled = status; // Start server - if (!IsConnected() && Core::g_sys_core != nullptr) { + if (!IsConnected() && Core::System().GetInstance().IsPoweredOn()) { Init(); } } else { |