mortbopet / Ripes

A graphical processor simulator and assembly editor for the RISC-V ISA
https://ripes.me/
MIT License
2.52k stars 270 forks source link

Debugging breakpoint is not working #260

Closed giraldeau closed 1 year ago

giraldeau commented 1 year ago

It seems that adding a breakpoint to the assembly and running the code does not make the code pause at the instruction. Actually, the pause button does not work either.

Tested with the current master 976190de359dd683

Screencast from 2023-01-12 05:46:55 PM.webm

mortbopet commented 1 year ago

I can reproduce the error - Hopefully i have time to dive into this this weekend.

giraldeau commented 1 year ago

I tried to dig into the issue before checking your solution. Yeah, you were right, the auto clock was not stopped on breakpoint hit. As a quick fix I used the ProcessorHandler::stopping() signal. I confirm I tested your fix on the master branch and it is working just fine. Cheers!

diff --git a/src/processortab.cpp b/src/processortab.cpp
index a807966..f3d1474 100644
--- a/src/processortab.cpp
+++ b/src/processortab.cpp
@@ -232,6 +232,12 @@ void ProcessorTab::setupSimulatorActions(QToolBar *controlToolbar) {
   connect(m_autoClockTimer, &QTimer::timeout, this,
           [=] { ProcessorHandler::clock(); });

+  connect(ProcessorHandler::get(), &ProcessorHandler::stopping, [=]() {
+    if (m_autoClockTimer->isActive()) {
+      autoClock(false);
+    }
+  });
+
   const QIcon startAutoClockIcon = QIcon(":/icons/step-clock.svg");
   m_autoClockAction = new QAction(startAutoClockIcon, "Auto clock (F6)", this);
   m_autoClockAction->setShortcut(QKeySequence("F6"));