mirror of
https://github.com/yuzu-mirror/yuzu.git
synced 2024-11-03 09:29:59 +00:00
Merge pull request #2091 from FearlessTobi/port-4603
Port citra-emu/citra#4603: "gdbstub: only let Execute breakpoints write/restore BKPT opcodes into target memory"
This commit is contained in:
commit
ca482997fe
1 changed files with 10 additions and 4 deletions
|
@ -507,8 +507,11 @@ static void RemoveBreakpoint(BreakpointType type, VAddr addr) {
|
||||||
|
|
||||||
LOG_DEBUG(Debug_GDBStub, "gdb: removed a breakpoint: {:016X} bytes at {:016X} of type {}",
|
LOG_DEBUG(Debug_GDBStub, "gdb: removed a breakpoint: {:016X} bytes at {:016X} of type {}",
|
||||||
bp->second.len, bp->second.addr, static_cast<int>(type));
|
bp->second.len, bp->second.addr, static_cast<int>(type));
|
||||||
Memory::WriteBlock(bp->second.addr, bp->second.inst.data(), bp->second.inst.size());
|
|
||||||
Core::System::GetInstance().InvalidateCpuInstructionCaches();
|
if (type == BreakpointType::Execute) {
|
||||||
|
Memory::WriteBlock(bp->second.addr, bp->second.inst.data(), bp->second.inst.size());
|
||||||
|
Core::System::GetInstance().InvalidateCpuInstructionCaches();
|
||||||
|
}
|
||||||
p.erase(addr);
|
p.erase(addr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1057,9 +1060,12 @@ static bool CommitBreakpoint(BreakpointType type, VAddr addr, u64 len) {
|
||||||
breakpoint.addr = addr;
|
breakpoint.addr = addr;
|
||||||
breakpoint.len = len;
|
breakpoint.len = len;
|
||||||
Memory::ReadBlock(addr, breakpoint.inst.data(), breakpoint.inst.size());
|
Memory::ReadBlock(addr, breakpoint.inst.data(), breakpoint.inst.size());
|
||||||
|
|
||||||
static constexpr std::array<u8, 4> btrap{0x00, 0x7d, 0x20, 0xd4};
|
static constexpr std::array<u8, 4> btrap{0x00, 0x7d, 0x20, 0xd4};
|
||||||
Memory::WriteBlock(addr, btrap.data(), btrap.size());
|
if (type == BreakpointType::Execute) {
|
||||||
Core::System::GetInstance().InvalidateCpuInstructionCaches();
|
Memory::WriteBlock(addr, btrap.data(), btrap.size());
|
||||||
|
Core::System::GetInstance().InvalidateCpuInstructionCaches();
|
||||||
|
}
|
||||||
p.insert({addr, breakpoint});
|
p.insert({addr, breakpoint});
|
||||||
|
|
||||||
LOG_DEBUG(Debug_GDBStub, "gdb: added {} breakpoint: {:016X} bytes at {:016X}",
|
LOG_DEBUG(Debug_GDBStub, "gdb: added {} breakpoint: {:016X} bytes at {:016X}",
|
||||||
|
|
Loading…
Reference in a new issue