summaryrefslogtreecommitdiff
path: root/src/core/gdbstub/gdbstub.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/core/gdbstub/gdbstub.cpp')
-rw-r--r--src/core/gdbstub/gdbstub.cpp14
1 files changed, 10 insertions, 4 deletions
diff --git a/src/core/gdbstub/gdbstub.cpp b/src/core/gdbstub/gdbstub.cpp
index a1cad4fcb..dafb32aae 100644
--- a/src/core/gdbstub/gdbstub.cpp
+++ b/src/core/gdbstub/gdbstub.cpp
@@ -507,8 +507,11 @@ static void RemoveBreakpoint(BreakpointType type, VAddr addr) {
507 507
508 LOG_DEBUG(Debug_GDBStub, "gdb: removed a breakpoint: {:016X} bytes at {:016X} of type {}", 508 LOG_DEBUG(Debug_GDBStub, "gdb: removed a breakpoint: {:016X} bytes at {:016X} of type {}",
509 bp->second.len, bp->second.addr, static_cast<int>(type)); 509 bp->second.len, bp->second.addr, static_cast<int>(type));
510 Memory::WriteBlock(bp->second.addr, bp->second.inst.data(), bp->second.inst.size()); 510
511 Core::System::GetInstance().InvalidateCpuInstructionCaches(); 511 if (type == BreakpointType::Execute) {
512 Memory::WriteBlock(bp->second.addr, bp->second.inst.data(), bp->second.inst.size());
513 Core::System::GetInstance().InvalidateCpuInstructionCaches();
514 }
512 p.erase(addr); 515 p.erase(addr);
513} 516}
514 517
@@ -1057,9 +1060,12 @@ static bool CommitBreakpoint(BreakpointType type, VAddr addr, u64 len) {
1057 breakpoint.addr = addr; 1060 breakpoint.addr = addr;
1058 breakpoint.len = len; 1061 breakpoint.len = len;
1059 Memory::ReadBlock(addr, breakpoint.inst.data(), breakpoint.inst.size()); 1062 Memory::ReadBlock(addr, breakpoint.inst.data(), breakpoint.inst.size());
1063
1060 static constexpr std::array<u8, 4> btrap{0x00, 0x7d, 0x20, 0xd4}; 1064 static constexpr std::array<u8, 4> btrap{0x00, 0x7d, 0x20, 0xd4};
1061 Memory::WriteBlock(addr, btrap.data(), btrap.size()); 1065 if (type == BreakpointType::Execute) {
1062 Core::System::GetInstance().InvalidateCpuInstructionCaches(); 1066 Memory::WriteBlock(addr, btrap.data(), btrap.size());
1067 Core::System::GetInstance().InvalidateCpuInstructionCaches();
1068 }
1063 p.insert({addr, breakpoint}); 1069 p.insert({addr, breakpoint});
1064 1070
1065 LOG_DEBUG(Debug_GDBStub, "gdb: added {} breakpoint: {:016X} bytes at {:016X}", 1071 LOG_DEBUG(Debug_GDBStub, "gdb: added {} breakpoint: {:016X} bytes at {:016X}",