Debugger: Fix breakpoints on delay slots.

This commit is contained in:
Unknown W. Brackets 2021-08-23 23:00:30 -07:00
parent 821a6a60aa
commit 52e9856b4b
4 changed files with 17 additions and 14 deletions

View File

@ -72,12 +72,12 @@ void DisassembleArm(const u8 *data, int size) {
}
}
static u32 JitBreakpoint() {
static u32 JitBreakpoint(uint32_t addr) {
// Should we skip this breakpoint?
if (CBreakPoints::CheckSkipFirst() == currentMIPS->pc)
if (CBreakPoints::CheckSkipFirst() == currentMIPS->pc || CBreakPoints::CheckSkipFirst() == addr)
return 0;
BreakAction result = CBreakPoints::ExecBreakPoint(currentMIPS->pc);
BreakAction result = CBreakPoints::ExecBreakPoint(addr);
if ((result & BREAK_ACTION_PAUSE) == 0)
return 0;
@ -746,7 +746,8 @@ bool ArmJit::CheckJitBreakpoint(u32 addr, int downcountOffset) {
MOVI2R(SCRATCHREG1, GetCompilerPC());
MovToPC(SCRATCHREG1);
RestoreRoundingMode();
QuickCallFunction(SCRATCHREG1, &JitBreakpoint);
MOVI2R(R0, addr);
QuickCallFunction(SCRATCHREG2, &JitBreakpoint);
// If 0, the conditional breakpoint wasn't taken.
CMPI2R(R0, 0, SCRATCHREG2);

View File

@ -62,12 +62,12 @@ static void DisassembleArm64Print(const u8 *data, int size) {
INFO_LOG(JIT, "===");*/
}
static u32 JitBreakpoint() {
static u32 JitBreakpoint(uint32_t addr) {
// Should we skip this breakpoint?
if (CBreakPoints::CheckSkipFirst() == currentMIPS->pc)
if (CBreakPoints::CheckSkipFirst() == currentMIPS->pc || CBreakPoints::CheckSkipFirst() == addr)
return 0;
BreakAction result = CBreakPoints::ExecBreakPoint(currentMIPS->pc);
BreakAction result = CBreakPoints::ExecBreakPoint(addr);
if ((result & BREAK_ACTION_PAUSE) == 0)
return 0;
@ -720,7 +720,9 @@ bool Arm64Jit::CheckJitBreakpoint(u32 addr, int downcountOffset) {
FlushAll();
MOVI2R(SCRATCH1, GetCompilerPC());
MovToPC(SCRATCH1);
SaveStaticRegisters();
RestoreRoundingMode();
MOVI2R(W0, addr);
QuickCallFunction(SCRATCH1_64, &JitBreakpoint);
// If 0, the conditional breakpoint wasn't taken.
@ -728,10 +730,12 @@ bool Arm64Jit::CheckJitBreakpoint(u32 addr, int downcountOffset) {
FixupBranch skip = B(CC_EQ);
WriteDownCount(downcountOffset);
ApplyRoundingMode();
LoadStaticRegisters();
B((const void *)dispatcherCheckCoreState);
SetJumpTarget(skip);
ApplyRoundingMode();
LoadStaticRegisters();
_MSR(FIELD_NZCV, FLAGTEMPREG);
return true;
}

View File

@ -57,13 +57,14 @@ std::pair<B,A> flip_pair(const std::pair<A,B> &p) {
return std::pair<B, A>(p.second, p.first);
}
u32 JitBreakpoint()
// This is called when Jit hits a breakpoint. Returns 1 when hit.
u32 JitBreakpoint(uint32_t addr)
{
// Should we skip this breakpoint?
if (CBreakPoints::CheckSkipFirst() == currentMIPS->pc)
if (CBreakPoints::CheckSkipFirst() == currentMIPS->pc || CBreakPoints::CheckSkipFirst() == addr)
return 0;
BreakAction result = CBreakPoints::ExecBreakPoint(currentMIPS->pc);
BreakAction result = CBreakPoints::ExecBreakPoint(addr);
if ((result & BREAK_ACTION_PAUSE) == 0)
return 0;
@ -795,7 +796,7 @@ bool Jit::CheckJitBreakpoint(u32 addr, int downcountOffset) {
FlushAll();
MOV(32, MIPSSTATE_VAR(pc), Imm32(GetCompilerPC()));
RestoreRoundingMode();
ABI_CallFunction(&JitBreakpoint);
ABI_CallFunctionC(&JitBreakpoint, addr);
// If 0, the conditional breakpoint wasn't taken.
CMP(32, R(EAX), Imm32(0));

View File

@ -36,9 +36,6 @@ class PointerWrap;
namespace MIPSComp {
// This is called when Jit hits a breakpoint. Returns 1 when hit.
u32 JitBreakpoint();
struct RegCacheState {
GPRRegCacheState gpr;
FPURegCacheState fpr;