From f6e2185c9cedfa179d043426b61ca8fbfb5584e1 Mon Sep 17 00:00:00 2001 From: chaoticgd <43898262+chaoticgd@users.noreply.github.com> Date: Tue, 18 Mar 2025 00:11:17 +0000 Subject: [PATCH] Debugger: Don't jump to PC if the breakpoint code paused the core --- pcsx2-qt/Debugger/DebuggerWindow.cpp | 7 +++++++ pcsx2-qt/Debugger/DebuggerWindow.h | 5 +++++ pcsx2-qt/Debugger/DisassemblyWidget.cpp | 6 ++++-- 3 files changed, 16 insertions(+), 2 deletions(-) diff --git a/pcsx2-qt/Debugger/DebuggerWindow.cpp b/pcsx2-qt/Debugger/DebuggerWindow.cpp index 01903fdac4..9f4f55c683 100644 --- a/pcsx2-qt/Debugger/DebuggerWindow.cpp +++ b/pcsx2-qt/Debugger/DebuggerWindow.cpp @@ -323,6 +323,13 @@ void DebuggerWindow::onVMPaused() CBreakPoints::SetSkipFirst(BREAKPOINT_IOP, r3000Debug.getPC()); }); } + + // Stops us from telling the disassembly widget to jump somwhere because + // breakpoint code paused the core. + if (!CBreakPoints::GetCorePaused()) + emit onVMActuallyPaused(); + else + CBreakPoints::SetCorePaused(false); } void DebuggerWindow::onVMResumed() diff --git a/pcsx2-qt/Debugger/DebuggerWindow.h b/pcsx2-qt/Debugger/DebuggerWindow.h index 40cd195216..a35748b8dd 100644 --- a/pcsx2-qt/Debugger/DebuggerWindow.h +++ b/pcsx2-qt/Debugger/DebuggerWindow.h @@ -51,6 +51,11 @@ public slots: void onStepOver(); void onStepOut(); +Q_SIGNALS: + // Only emitted if the pause wasn't a temporary one triggered by the + // breakpoint code. + void onVMActuallyPaused(); + protected: void closeEvent(QCloseEvent* event); diff --git a/pcsx2-qt/Debugger/DisassemblyWidget.cpp b/pcsx2-qt/Debugger/DisassemblyWidget.cpp index 8edf1c262e..6e2b1eb30d 100644 --- a/pcsx2-qt/Debugger/DisassemblyWidget.cpp +++ b/pcsx2-qt/Debugger/DisassemblyWidget.cpp @@ -3,8 +3,9 @@ #include "DisassemblyWidget.h" -#include "Debugger/Breakpoints/BreakpointModel.h" +#include "Debugger/DebuggerWindow.h" #include "Debugger/JsonValueWrapper.h" +#include "Debugger/Breakpoints/BreakpointModel.h" #include "DebugTools/DebugInterface.h" #include "DebugTools/DisassemblyManager.h" @@ -35,7 +36,8 @@ DisassemblyWidget::DisassemblyWidget(const DebuggerWidgetParameters& parameters) setContextMenuPolicy(Qt::CustomContextMenu); connect(this, &DisassemblyWidget::customContextMenuRequested, this, &DisassemblyWidget::openContextMenu); - connect(g_emu_thread, &EmuThread::onVMPaused, this, &DisassemblyWidget::gotoProgramCounterOnPause); + connect(g_debugger_window, &DebuggerWindow::onVMActuallyPaused, + this, &DisassemblyWidget::gotoProgramCounterOnPause); receiveEvent([this](const DebuggerEvents::Refresh& event) -> bool { update();