Check delay breakpoint condition

isBreakpointNeeded returns if breakpoints are needed for any combination
of the current pc and delay slot.
dynarecCheckBreakpoint checks conditions for each breakpoint slot.
This commit is contained in:
NZJenkins 2016-02-26 20:04:28 +13:00
parent edef3ad8c3
commit ba706b6dab
2 changed files with 22 additions and 5 deletions

View File

@ -602,17 +602,19 @@ inline bool isBranchOrJump(u32 addr)
// The next two functions return 0 if no breakpoint is needed,
// 1 if it's needed on the current pc, 2 if it's needed in the delay slot
// 3 if needed in both
int isBreakpointNeeded(u32 addr)
{
int bpFlags = 0;
if (CBreakPoints::IsAddressBreakPoint(addr))
return 1;
bpFlags += 1;
// there may be a breakpoint in the delay slot
if (isBranchOrJump(addr) && CBreakPoints::IsAddressBreakPoint(addr+4))
return 2;
bpFlags += 2;
return 0;
return bpFlags;
}
int isMemcheckNeeded(u32 pc)

View File

@ -1088,8 +1088,23 @@ void dynarecCheckBreakpoint()
if (CBreakPoints::CheckSkipFirst(pc) != 0)
return;
int bpFlags = isBreakpointNeeded(pc);
bool hit = false;
//check breakpoint at current pc
if (bpFlags & 1) {
auto cond = CBreakPoints::GetBreakPointCondition(pc);
if (cond && !cond->Evaluate())
if (cond == NULL || cond->Evaluate()) {
hit = true;
}
}
//check breakpoint in delay slot
if (bpFlags & 2) {
auto cond = CBreakPoints::GetBreakPointCondition(pc + 4);
if (cond == NULL || cond->Evaluate())
hit = true;
}
if (!hit)
return;
CBreakPoints::SetBreakpointTriggered(true);