Skip to content

Commit cdd0086

Browse files
committed
Qt: Fix toggling read/write breakpoints
1 parent 9576a3a commit cdd0086

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

src/duckstation-qt/debuggerwindow.cpp

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -235,10 +235,15 @@ void DebuggerWindow::onBreakpointListItemChanged(QTreeWidgetItem* item, int colu
235235
if (!ok)
236236
return;
237237

238+
const uint bp_type = item->data(2, Qt::UserRole).toUInt(&ok);
239+
if (!ok)
240+
return;
241+
238242
const bool enabled = (item->checkState(0) == Qt::Checked);
239243

240-
Host::RunOnCPUThread(
241-
[bp_addr, enabled]() { CPU::SetBreakpointEnabled(CPU::BreakpointType::Execute, bp_addr, enabled); });
244+
Host::RunOnCPUThread([bp_addr, bp_type, enabled]() {
245+
CPU::SetBreakpointEnabled(static_cast<CPU::BreakpointType>(bp_type), bp_addr, enabled);
246+
});
242247
}
243248

244249
void DebuggerWindow::onStepIntoActionTriggered()
@@ -312,7 +317,8 @@ void DebuggerWindow::onCodeViewContextMenuRequested(const QPoint& pt)
312317
menu.addAction(QStringLiteral("0x%1").arg(static_cast<uint>(address), 8, 16, QChar('0')))->setEnabled(false);
313318
menu.addSeparator();
314319

315-
QAction* action = menu.addAction(QIcon::fromTheme(QStringLiteral("debug-toggle-breakpoint")), tr("Toggle &Breakpoint"));
320+
QAction* action =
321+
menu.addAction(QIcon::fromTheme(QStringLiteral("debug-toggle-breakpoint")), tr("Toggle &Breakpoint"));
316322
connect(action, &QAction::triggered, this, [this, address]() { toggleBreakpoint(address); });
317323

318324
action = menu.addAction(QIcon::fromTheme(QStringLiteral("debugger-go-to-cursor")), tr("&Run To Cursor"));
@@ -736,7 +742,7 @@ void DebuggerWindow::refreshBreakpointList(const CPU::BreakpointList& bps)
736742
item->setText(3, QString::asprintf("%u", bp.hit_count));
737743
item->setData(0, Qt::UserRole, bp.number);
738744
item->setData(1, Qt::UserRole, QVariant(static_cast<uint>(bp.address)));
739-
item->setData(2, Qt::UserRole, static_cast<u32>(bp.type));
745+
item->setData(2, Qt::UserRole, QVariant(static_cast<uint>(bp.type)));
740746
m_ui.breakpointsWidget->addTopLevelItem(item);
741747
}
742748
}

0 commit comments

Comments
 (0)