Merge pull request #17423 from unknownbrackets/debugger

Debugger: Correct PC if replacement breaks
This commit is contained in:
Henrik Rydgård 2023-05-06 23:08:53 +02:00 committed by GitHub
commit 13815e6f5a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 26 additions and 0 deletions

View File

@ -411,6 +411,9 @@ static inline bool MergeRecentMemInfo(const PendingNotifyMem &info, size_t copyL
for (size_t i = 1; i <= 4; ++i) {
auto &prev = pendingNotifies[pendingNotifies.size() - i];
if (prev.flags != info.flags)
continue;
if (prev.start >= info.start + info.size || prev.start + prev.size <= info.start)
continue;

View File

@ -519,6 +519,14 @@ bool ArmJit::ReplaceJalTo(u32 dest) {
js.compilerPC += 4;
// No writing exits, keep going!
if (CBreakPoints::HasMemChecks()) {
// We could modify coreState, so we need to write PC and check.
// Otherwise, PC may end up on the jal. We add 4 to skip the delay slot.
FlushAll();
WriteExit(GetCompilerPC() + 4, js.nextExit++);
js.compiling = false;
}
// Add a trigger so that if the inlined code changes, we invalidate this block.
blocks.ProxyBlock(js.blockStart, dest, funcSize / sizeof(u32), GetCodePtr());
#endif

View File

@ -520,6 +520,14 @@ bool Arm64Jit::ReplaceJalTo(u32 dest) {
js.compilerPC += 4;
// No writing exits, keep going!
if (CBreakPoints::HasMemChecks()) {
// We could modify coreState, so we need to write PC and check.
// Otherwise, PC may end up on the jal. We add 4 to skip the delay slot.
FlushAll();
WriteExit(GetCompilerPC() + 4, js.nextExit++);
js.compiling = false;
}
// Add a trigger so that if the inlined code changes, we invalidate this block.
blocks.ProxyBlock(js.blockStart, dest, funcSize / sizeof(u32), GetCodePtr());
#endif

View File

@ -565,6 +565,13 @@ bool Jit::ReplaceJalTo(u32 dest) {
js.compilerPC += 4;
// No writing exits, keep going!
if (CBreakPoints::HasMemChecks()) {
// We could modify coreState, so we need to write PC and check.
// Otherwise, PC may end up on the jal. We add 4 to skip the delay slot.
MOV(32, MIPSSTATE_VAR(pc), Imm32(GetCompilerPC() + 4));
js.afterOp |= JitState::AFTER_CORE_STATE;
}
// Add a trigger so that if the inlined code changes, we invalidate this block.
blocks.ProxyBlock(js.blockStart, dest, funcSize / sizeof(u32), GetCodePtr());
return true;