From 8235c38df79bd48ae3d84fe35471befb6f0ce5eb Mon Sep 17 00:00:00 2001 From: Martino Fontana Date: Sat, 15 Jun 2024 11:15:23 +0200 Subject: Debugger: Small other cleanup Change misleading names. Fix function usage: Intepreter and Step Out will not check breakpoints in their own wrong way anymore (e.g. breaking on log-only breakpoints). --- Source/Core/DolphinQt/Debugger/CodeWidget.cpp | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'Source/Core/DolphinQt/Debugger/CodeWidget.cpp') diff --git a/Source/Core/DolphinQt/Debugger/CodeWidget.cpp b/Source/Core/DolphinQt/Debugger/CodeWidget.cpp index e5dd96014b..361f142c7c 100644 --- a/Source/Core/DolphinQt/Debugger/CodeWidget.cpp +++ b/Source/Core/DolphinQt/Debugger/CodeWidget.cpp @@ -484,7 +484,7 @@ void CodeWidget::StepOver() auto& breakpoints = m_system.GetPowerPC().GetBreakPoints(); breakpoints.ClearAllTemporary(); breakpoints.Add(m_system.GetPPCState().pc + 4, true); - cpu.EnableStepping(false); + cpu.SetStepping(false); Core::DisplayMessage(tr("Step over in progress...").toStdString(), 2000); } else @@ -547,8 +547,7 @@ void CodeWidget::StepOut() do { power_pc.SingleStep(); - } while (ppc_state.pc != next_pc && clock::now() < timeout && - !breakpoints.IsAddressBreakPoint(ppc_state.pc)); + } while (ppc_state.pc != next_pc && clock::now() < timeout && !power_pc.CheckBreakPoints()); } else { @@ -556,14 +555,14 @@ void CodeWidget::StepOut() } inst = PowerPC::MMU::HostRead_Instruction(guard, ppc_state.pc); - } while (clock::now() < timeout && !breakpoints.IsAddressBreakPoint(ppc_state.pc)); + } while (clock::now() < timeout && !power_pc.CheckBreakPoints()); power_pc.SetMode(old_mode); } emit Host::GetInstance()->UpdateDisasmDialog(); - if (breakpoints.IsAddressBreakPoint(ppc_state.pc)) + if (power_pc.CheckBreakPoints()) Core::DisplayMessage(tr("Breakpoint encountered! Step out aborted.").toStdString(), 2000); else if (clock::now() >= timeout) Core::DisplayMessage(tr("Step out timed out!").toStdString(), 2000); -- cgit v1.2.3 From bd3cf67cbc354dc93edf14a788e602c69c054d38 Mon Sep 17 00:00:00 2001 From: Martino Fontana Date: Sat, 15 Jun 2024 11:36:38 +0200 Subject: Debugger: Rework temporary breakpoints Before: 1. In theory there could be multiple, but in practice they were (manually) cleared before creating one 2. (Some of) the conditions to clear one were either to reach it, to create a new one (due to the point above), or to step. This created weird behavior: let's say you Step Over a `bl` (thus creating a temporary breakpoint on `pc+4`), and you reached a regular breakpoint inside the `bl`. The temporary one would still be there: if you resumed, the emulation would still stop there, as a sort of Step Out. But, if before resuming, you made a Step, then it wouldn't do that. 3. The breakpoint widget had no idea concept of them, and will treat them as regular breakpoints. Also, they'll be shown only when the widget is updated in some other way, leading to more confusion. 4. Because only one breakpoint could exist per address, the creation of a temporary breakpoint on a top of a regular one would delete it and inherit its properties (e.g. being log-only). This could happen, for instance, if you Stepped Over a `bl` specifically, and pc+4 had a regular breakpoint. Now there can only be one temporary breakpoint, which is automatically cleared whenever emulation is paused. So, removing some manual clearing from 1., and removing the weird behavior of 2. As it is stored in a separate variable, it won't be seen at all depending on the function used (fixing 3., and removing some checks in other places), and it won't replace a regular breakpoint, instead simply having priority (fixing 4.). --- Source/Core/DolphinQt/Debugger/CodeWidget.cpp | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) (limited to 'Source/Core/DolphinQt/Debugger/CodeWidget.cpp') diff --git a/Source/Core/DolphinQt/Debugger/CodeWidget.cpp b/Source/Core/DolphinQt/Debugger/CodeWidget.cpp index 361f142c7c..36d3d92284 100644 --- a/Source/Core/DolphinQt/Debugger/CodeWidget.cpp +++ b/Source/Core/DolphinQt/Debugger/CodeWidget.cpp @@ -455,7 +455,6 @@ void CodeWidget::Step() auto& power_pc = m_system.GetPowerPC(); PowerPC::CoreMode old_mode = power_pc.GetMode(); power_pc.SetMode(PowerPC::CoreMode::Interpreter); - power_pc.GetBreakPoints().ClearAllTemporary(); cpu.StepOpcode(&sync_event); sync_event.WaitFor(std::chrono::milliseconds(20)); power_pc.SetMode(old_mode); @@ -482,8 +481,7 @@ void CodeWidget::StepOver() if (inst.LK) { auto& breakpoints = m_system.GetPowerPC().GetBreakPoints(); - breakpoints.ClearAllTemporary(); - breakpoints.Add(m_system.GetPPCState().pc + 4, true); + breakpoints.SetTemporary(m_system.GetPPCState().pc + 4); cpu.SetStepping(false); Core::DisplayMessage(tr("Step over in progress...").toStdString(), 2000); } @@ -519,12 +517,9 @@ void CodeWidget::StepOut() auto& power_pc = m_system.GetPowerPC(); auto& ppc_state = power_pc.GetPPCState(); - auto& breakpoints = power_pc.GetBreakPoints(); { Core::CPUThreadGuard guard(m_system); - breakpoints.ClearAllTemporary(); - PowerPC::CoreMode old_mode = power_pc.GetMode(); power_pc.SetMode(PowerPC::CoreMode::Interpreter); -- cgit v1.2.3