From 9aeeea37620cf7c554d1462188ad06c2f6d32617 Mon Sep 17 00:00:00 2001 From: Martino Fontana Date: Sat, 15 Jun 2024 11:02:15 +0200 Subject: Debugger: Small Breakpoint cleanup Reuse more code, change misleading names, remove useless documentation, add useful documentation --- Source/Core/DolphinQt/Debugger/BreakpointWidget.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'Source/Core/DolphinQt/Debugger/BreakpointWidget.cpp') diff --git a/Source/Core/DolphinQt/Debugger/BreakpointWidget.cpp b/Source/Core/DolphinQt/Debugger/BreakpointWidget.cpp index 130e68e860..3bed35c576 100644 --- a/Source/Core/DolphinQt/Debugger/BreakpointWidget.cpp +++ b/Source/Core/DolphinQt/Debugger/BreakpointWidget.cpp @@ -215,9 +215,9 @@ void BreakpointWidget::OnClicked(QTableWidgetItem* item) if (item->column() == ENABLED_COLUMN) { if (item->data(IS_MEMCHECK_ROLE).toBool()) - m_system.GetPowerPC().GetMemChecks().ToggleBreakPoint(address); + m_system.GetPowerPC().GetMemChecks().ToggleEnable(address); else - m_system.GetPowerPC().GetBreakPoints().ToggleBreakPoint(address); + m_system.GetPowerPC().GetBreakPoints().ToggleEnable(address); emit BreakpointsChanged(); Update(); -- 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/BreakpointWidget.cpp | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) (limited to 'Source/Core/DolphinQt/Debugger/BreakpointWidget.cpp') diff --git a/Source/Core/DolphinQt/Debugger/BreakpointWidget.cpp b/Source/Core/DolphinQt/Debugger/BreakpointWidget.cpp index 3bed35c576..0bf6c5b29c 100644 --- a/Source/Core/DolphinQt/Debugger/BreakpointWidget.cpp +++ b/Source/Core/DolphinQt/Debugger/BreakpointWidget.cpp @@ -443,8 +443,8 @@ void BreakpointWidget::OnEditBreakpoint(u32 address, bool is_instruction_bp) { if (is_instruction_bp) { - auto* dialog = - new BreakpointDialog(this, m_system.GetPowerPC().GetBreakPoints().GetBreakpoint(address)); + auto* dialog = new BreakpointDialog( + this, m_system.GetPowerPC().GetBreakPoints().GetRegularBreakpoint(address)); dialog->setAttribute(Qt::WA_DeleteOnClose, true); SetQWidgetWindowDecorations(dialog); dialog->exec(); @@ -602,14 +602,13 @@ void BreakpointWidget::OnItemChanged(QTableWidgetItem* item) void BreakpointWidget::AddBP(u32 addr) { - AddBP(addr, false, true, true, {}); + AddBP(addr, true, true, {}); } -void BreakpointWidget::AddBP(u32 addr, bool temp, bool break_on_hit, bool log_on_hit, - const QString& condition) +void BreakpointWidget::AddBP(u32 addr, bool break_on_hit, bool log_on_hit, const QString& condition) { m_system.GetPowerPC().GetBreakPoints().Add( - addr, temp, break_on_hit, log_on_hit, + addr, break_on_hit, log_on_hit, !condition.isEmpty() ? Expression::TryParse(condition.toUtf8().constData()) : std::nullopt); emit BreakpointsChanged(); @@ -619,7 +618,7 @@ void BreakpointWidget::AddBP(u32 addr, bool temp, bool break_on_hit, bool log_on void BreakpointWidget::EditBreakpoint(u32 address, int edit, std::optional string) { TBreakPoint bp; - const TBreakPoint* old_bp = m_system.GetPowerPC().GetBreakPoints().GetBreakpoint(address); + const TBreakPoint* old_bp = m_system.GetPowerPC().GetBreakPoints().GetRegularBreakpoint(address); bp.is_enabled = edit == ENABLED_COLUMN ? !old_bp->is_enabled : old_bp->is_enabled; bp.log_on_hit = edit == LOG_COLUMN ? !old_bp->log_on_hit : old_bp->log_on_hit; bp.break_on_hit = edit == BREAK_COLUMN ? !old_bp->break_on_hit : old_bp->break_on_hit; -- cgit v1.2.3 From 719af828e57fa032536953028c5906bfbed7f121 Mon Sep 17 00:00:00 2001 From: Martino Fontana Date: Sat, 15 Jun 2024 11:46:28 +0200 Subject: BreakpointWidget: Can create new breakpoints when emulation isn't running It works perfectly fine, so why not? Also, consistency with CodeViewWidget. --- Source/Core/DolphinQt/Debugger/BreakpointWidget.cpp | 2 -- 1 file changed, 2 deletions(-) (limited to 'Source/Core/DolphinQt/Debugger/BreakpointWidget.cpp') diff --git a/Source/Core/DolphinQt/Debugger/BreakpointWidget.cpp b/Source/Core/DolphinQt/Debugger/BreakpointWidget.cpp index 0bf6c5b29c..5b983ceb78 100644 --- a/Source/Core/DolphinQt/Debugger/BreakpointWidget.cpp +++ b/Source/Core/DolphinQt/Debugger/BreakpointWidget.cpp @@ -173,7 +173,6 @@ void BreakpointWidget::CreateWidgets() m_load = m_toolbar->addAction(tr("Load"), this, &BreakpointWidget::OnLoad); m_save = m_toolbar->addAction(tr("Save"), this, &BreakpointWidget::OnSave); - m_new->setEnabled(false); m_load->setEnabled(false); m_save->setEnabled(false); @@ -252,7 +251,6 @@ void BreakpointWidget::UpdateButtonsEnabled() return; const bool is_initialised = Core::GetState(m_system) != Core::State::Uninitialized; - m_new->setEnabled(is_initialised); m_load->setEnabled(is_initialised); m_save->setEnabled(is_initialised); } -- cgit v1.2.3