Skip to content

Commit

Permalink
Fix annoying watchpoint behavior of raising memory docks
Browse files Browse the repository at this point in the history
  • Loading branch information
calc84maniac committed Sep 3, 2024
1 parent b526e16 commit 4f2c6f1
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 9 deletions.
25 changes: 16 additions & 9 deletions gui/qt/debugger.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -447,9 +447,11 @@ void MainWindow::debugCommand(int reason, uint32_t data) {
}

text = tr("Hit ") + type + tr(" watchpoint ") + input + QStringLiteral(" (") + label + QStringLiteral(")");

gotoMemAddr(static_cast<uint32_t>(hex2int(input)));
break;
// Raise the debugger before going to the memory address so the memory docks are updated
ui->debuggerLabel->setText(text);
debugRaise();
gotoMemAddrNoRaise(static_cast<uint32_t>(hex2int(input)));
return;
case DBG_PORT_READ:
case DBG_PORT_WRITE:
input = int2hex(data, 4);
Expand Down Expand Up @@ -1996,6 +1998,14 @@ QAction *MainWindow::gotoDisasmAction(QMenu *menu) {
}

void MainWindow::gotoMemAddr(uint32_t address) {
HexWidget *memWidget = gotoMemAddrNoRaise(address);
if (memWidget != Q_NULLPTR) {
raiseContainingDock(memWidget);
memWidget->setFocus();
}
}

HexWidget *MainWindow::gotoMemAddrNoRaise(uint32_t address) {
HexWidget *memWidget = m_memWidget;
bool didGoto = false;
if (memWidget == Q_NULLPTR && !ui->debugMemoryWidget->isVisible()) {
Expand All @@ -2018,13 +2028,10 @@ void MainWindow::gotoMemAddr(uint32_t address) {
memWidget = firstMemWidget();
}
}
if (memWidget != Q_NULLPTR) {
if (!didGoto) {
memGoto(memWidget, address);
}
raiseContainingDock(memWidget);
memWidget->setFocus();
if (memWidget != Q_NULLPTR && !didGoto) {
memGoto(memWidget, address);
}
return memWidget;
}

QAction *MainWindow::gotoMemAction(QMenu *menu, bool vat) {
Expand Down
1 change: 1 addition & 0 deletions gui/qt/mainwindow.h
Original file line number Diff line number Diff line change
Expand Up @@ -315,6 +315,7 @@ class MainWindow : public QMainWindow {
void gotoDisasmAddr(uint32_t addr);
QAction *gotoDisasmAction(QMenu *menu);
void gotoMemAddr(uint32_t addr);
HexWidget *gotoMemAddrNoRaise(uint32_t addr);
QAction *gotoMemAction(QMenu *menu, bool vat = false);

void handleCtrlClickText(QPlainTextEdit *edit);
Expand Down

0 comments on commit 4f2c6f1

Please sign in to comment.