From c9b75f7490745339b36c9e238a55543edb9e6414 Mon Sep 17 00:00:00 2001 From: PugsyMAME Date: Wed, 30 Dec 2020 00:59:59 +0000 Subject: [PATCH] Updated DebuggerWindow Files for Tracer --- src/duckstation-qt/debuggerwindow.cpp | 21 +++++++++++++++++++-- src/duckstation-qt/debuggerwindow.h | 2 ++ src/duckstation-qt/debuggerwindow.ui | 22 ++++++++++++++++++++++ 3 files changed, 43 insertions(+), 2 deletions(-) diff --git a/src/duckstation-qt/debuggerwindow.cpp b/src/duckstation-qt/debuggerwindow.cpp index 73e19bb27..5ce024dfd 100644 --- a/src/duckstation-qt/debuggerwindow.cpp +++ b/src/duckstation-qt/debuggerwindow.cpp @@ -121,6 +121,22 @@ void DebuggerWindow::onDumpAddressTriggered() scrollToMemoryAddress(address.value()); } +void DebuggerWindow::onTraceTriggered() +{ + if (!CPU::IsTraceEnabled()) + { + QMessageBox::critical( + this, windowTitle(), + tr("Trace logging started to cpu_log.txt.\nThis file can be several gigabytes, so be aware of SSD wear.")); + CPU::StartTrace(); + } + else + { + CPU::StopTrace(); + QMessageBox::critical(this, windowTitle(), tr("Trace logging to cpu_log.txt stopped.")); + } +} + void DebuggerWindow::onFollowAddressTriggered() { // @@ -129,7 +145,7 @@ void DebuggerWindow::onFollowAddressTriggered() void DebuggerWindow::onAddBreakpointTriggered() { std::optional address = - QtUtils::PromptForAddress(this, windowTitle(), tr("Enter code address:") , true); + QtUtils::PromptForAddress(this, windowTitle(), tr("Enter code address:"), true); if (!address.has_value()) return; @@ -372,6 +388,7 @@ void DebuggerWindow::connectSignals() connect(m_ui.actionGoToPC, &QAction::triggered, this, &DebuggerWindow::onGoToPCTriggered); connect(m_ui.actionGoToAddress, &QAction::triggered, this, &DebuggerWindow::onGoToAddressTriggered); connect(m_ui.actionDumpAddress, &QAction::triggered, this, &DebuggerWindow::onDumpAddressTriggered); + connect(m_ui.actionTrace, &QAction::triggered, this, &DebuggerWindow::onTraceTriggered); connect(m_ui.actionStepInto, &QAction::triggered, this, &DebuggerWindow::onStepIntoActionTriggered); connect(m_ui.actionStepOver, &QAction::triggered, this, &DebuggerWindow::onStepOverActionTriggered); connect(m_ui.actionStepOut, &QAction::triggered, this, &DebuggerWindow::onStepOutActionTriggered); @@ -379,7 +396,6 @@ void DebuggerWindow::connectSignals() connect(m_ui.actionToggleBreakpoint, &QAction::triggered, this, &DebuggerWindow::onToggleBreakpointTriggered); connect(m_ui.actionClearBreakpoints, &QAction::triggered, this, &DebuggerWindow::onClearBreakpointsTriggered); connect(m_ui.actionClose, &QAction::triggered, this, &DebuggerWindow::close); - connect(m_ui.codeView, &QTreeView::activated, this, &DebuggerWindow::onCodeViewItemActivated); connect(m_ui.memoryRegionRAM, &QRadioButton::clicked, [this]() { setMemoryViewRegion(Bus::MemoryRegion::RAM); }); @@ -440,6 +456,7 @@ void DebuggerWindow::setUIEnabled(bool enabled) m_ui.actionStepOut->setEnabled(enabled); m_ui.actionGoToAddress->setEnabled(enabled); m_ui.actionGoToPC->setEnabled(enabled); + m_ui.actionTrace->setEnabled(enabled); m_ui.memoryRegionRAM->setEnabled(enabled); m_ui.memoryRegionEXP1->setEnabled(enabled); m_ui.memoryRegionScratchpad->setEnabled(enabled); diff --git a/src/duckstation-qt/debuggerwindow.h b/src/duckstation-qt/debuggerwindow.h index b937788bb..e7486b7a2 100644 --- a/src/duckstation-qt/debuggerwindow.h +++ b/src/duckstation-qt/debuggerwindow.h @@ -43,6 +43,7 @@ private Q_SLOTS: void onGoToAddressTriggered(); void onDumpAddressTriggered(); void onFollowAddressTriggered(); + void onTraceTriggered(); void onAddBreakpointTriggered(); void onToggleBreakpointTriggered(); void onClearBreakpointsTriggered(); @@ -53,6 +54,7 @@ private Q_SLOTS: void onMemorySearchTriggered(); void onMemorySearchStringChanged(const QString&); + private: void setupAdditionalUi(); void connectSignals(); diff --git a/src/duckstation-qt/debuggerwindow.ui b/src/duckstation-qt/debuggerwindow.ui index 016e42f83..ac04ec0e4 100644 --- a/src/duckstation-qt/debuggerwindow.ui +++ b/src/duckstation-qt/debuggerwindow.ui @@ -36,12 +36,15 @@ + + + @@ -79,6 +82,8 @@ + + @@ -461,6 +466,23 @@ Ctrl+D + + + + :/icons/debug-trace.png:/icons/debug-trace.png + + + Trace + + + &Trace + + + Ctrl+T + + + +