summaryrefslogtreecommitdiff
path: root/Source/Core/DolphinQt/Debugger/BreakpointWidget.cpp
diff options
context:
space:
mode:
authorsmurf3tte <75271109+smurf3tte@users.noreply.github.com>2020-12-16 15:40:20 -0800
committerTryTwo <taolas@gmail.com>2022-10-06 21:34:44 -0700
commit7842f9a715f143e5bae2e3886148379279976bbc (patch)
treec64c5c0dc1039872d20993bd6dff1c3e7bcb4237 /Source/Core/DolphinQt/Debugger/BreakpointWidget.cpp
parent9ca1c0f53349b3a736942ebd1f89f8e70e954a32 (diff)
Debugger: Initial implementation of conditional breakpoints
Expression class to store compiled expressions and associated variable list. Co-authored-by: TryTwo <taolas@gmail.com>
Diffstat (limited to 'Source/Core/DolphinQt/Debugger/BreakpointWidget.cpp')
-rw-r--r--Source/Core/DolphinQt/Debugger/BreakpointWidget.cpp21
1 files changed, 16 insertions, 5 deletions
diff --git a/Source/Core/DolphinQt/Debugger/BreakpointWidget.cpp b/Source/Core/DolphinQt/Debugger/BreakpointWidget.cpp
index c8d98aabae..5a88814a24 100644
--- a/Source/Core/DolphinQt/Debugger/BreakpointWidget.cpp
+++ b/Source/Core/DolphinQt/Debugger/BreakpointWidget.cpp
@@ -15,6 +15,7 @@
#include "Core/ConfigManager.h"
#include "Core/Core.h"
#include "Core/PowerPC/BreakPoints.h"
+#include "Core/PowerPC/Expression.h"
#include "Core/PowerPC/PPCSymbolDB.h"
#include "Core/PowerPC/PowerPC.h"
@@ -86,7 +87,7 @@ void BreakpointWidget::CreateWidgets()
m_table = new QTableWidget;
m_table->setTabKeyNavigation(false);
m_table->setContentsMargins(0, 0, 0, 0);
- m_table->setColumnCount(5);
+ m_table->setColumnCount(6);
m_table->setSelectionMode(QAbstractItemView::SingleSelection);
m_table->setSelectionBehavior(QAbstractItemView::SelectRows);
m_table->setEditTriggers(QAbstractItemView::NoEditTriggers);
@@ -160,7 +161,7 @@ void BreakpointWidget::Update()
m_table->clear();
m_table->setHorizontalHeaderLabels(
- {tr("Active"), tr("Type"), tr("Function"), tr("Address"), tr("Flags")});
+ {tr("Active"), tr("Type"), tr("Function"), tr("Address"), tr("Flags"), tr("Condition")});
int i = 0;
m_table->setRowCount(i);
@@ -203,6 +204,13 @@ void BreakpointWidget::Update()
m_table->setItem(i, 4, create_item(flags));
+ QString condition;
+
+ if (bp.condition)
+ condition = QString::fromStdString(bp.condition->GetText());
+
+ m_table->setItem(i, 5, create_item(condition));
+
i++;
}
@@ -387,12 +395,15 @@ void BreakpointWidget::OnContextMenu()
void BreakpointWidget::AddBP(u32 addr)
{
- AddBP(addr, false, true, true);
+ AddBP(addr, false, true, true, {});
}
-void BreakpointWidget::AddBP(u32 addr, bool temp, bool break_on_hit, bool log_on_hit)
+void BreakpointWidget::AddBP(u32 addr, bool temp, bool break_on_hit, bool log_on_hit,
+ const QString& condition)
{
- PowerPC::breakpoints.Add(addr, temp, break_on_hit, log_on_hit);
+ PowerPC::breakpoints.Add(
+ addr, temp, break_on_hit, log_on_hit,
+ !condition.isEmpty() ? Expression::TryParse(condition.toUtf8().constData()) : std::nullopt);
emit BreakpointsChanged();
Update();