Intepreter: Step before checking for breakpoints

This way, by pressing Continue on top of a breakpoint, the emulation will actually continue (like on Cached Interpreter and JIT), instead of doing nothing.
This commit is contained in:
Martino Fontana 2024-06-15 18:20:04 +02:00
parent 719af828e5
commit 5b13903e6a

View File

@ -85,23 +85,20 @@ void CPUManager::Run()
m_state_cpu_thread_active = true; m_state_cpu_thread_active = true;
state_lock.unlock(); state_lock.unlock();
// Adjust PC for JIT when debugging // Adjust PC when debugging
// SingleStep so that the "continue", "step over" and "step out" debugger functions // SingleStep so that the "continue", "step over" and "step out" debugger functions
// work when the PC is at a breakpoint at the beginning of the block // work when the PC is at a breakpoint at the beginning of the block
// Don't use PowerPCManager::CheckBreakPoints, otherwise you get double logging // Don't use PowerPCManager::CheckBreakPoints, otherwise you get double logging
// If watchpoints are enabled, any instruction could be a breakpoint. // If watchpoints are enabled, any instruction could be a breakpoint.
if (power_pc.GetMode() != PowerPC::CoreMode::Interpreter) if (power_pc.GetBreakPoints().IsAddressBreakPoint(power_pc.GetPPCState().pc) ||
power_pc.GetMemChecks().HasAny())
{ {
if (power_pc.GetBreakPoints().IsAddressBreakPoint(power_pc.GetPPCState().pc) || m_state = State::Stepping;
power_pc.GetMemChecks().HasAny()) PowerPC::CoreMode old_mode = power_pc.GetMode();
{ power_pc.SetMode(PowerPC::CoreMode::Interpreter);
m_state = State::Stepping; power_pc.SingleStep();
PowerPC::CoreMode old_mode = power_pc.GetMode(); power_pc.SetMode(old_mode);
power_pc.SetMode(PowerPC::CoreMode::Interpreter); m_state = State::Running;
power_pc.SingleStep();
power_pc.SetMode(old_mode);
m_state = State::Running;
}
} }
// Enter a fast runloop // Enter a fast runloop