From 5e35c181c8aba00c2b872f608b4106d86cd402da Mon Sep 17 00:00:00 2001 From: Matthew Budd Date: Sun, 15 Nov 2020 18:55:03 -0500 Subject: [PATCH] Qt debugger slight change in main menu entry 'Run to Cursor' is now 'Run to Selected Line'. Run to Cursor option is still present in assembly viewer context menu. --- src/drivers/Qt/ConsoleDebugger.cpp | 45 ++++++++++++++++++++---------- src/drivers/Qt/ConsoleDebugger.h | 1 + 2 files changed, 32 insertions(+), 14 deletions(-) diff --git a/src/drivers/Qt/ConsoleDebugger.cpp b/src/drivers/Qt/ConsoleDebugger.cpp index 3ec19f02..a5a3f5fc 100644 --- a/src/drivers/Qt/ConsoleDebugger.cpp +++ b/src/drivers/Qt/ConsoleDebugger.cpp @@ -129,10 +129,10 @@ ConsoleDebugger::ConsoleDebugger(QWidget *parent) debugMenu->addAction(act); - // Debug -> Run to Cursor - act = new QAction(tr("Run to Cursor"), this); - act->setShortcut(QKeySequence( tr("Ctrl+F10") ) ); - act->setStatusTip(tr("Run to Cursor")); + // Debug -> Run to Selected Line + act = new QAction(tr("Run to Selected Line"), this); + act->setShortcut(QKeySequence( tr("F1") ) ); + act->setStatusTip(tr("Run to Selected Line")); connect( act, SIGNAL(triggered()), this, SLOT(debugRunToCursorCB(void)) ); debugMenu->addAction(act); @@ -1717,15 +1717,7 @@ void ConsoleDebugger::debugStepOverCB(void) //---------------------------------------------------------------------------- void ConsoleDebugger::debugRunToCursorCB(void) { - int addr = asmView->getCursorAddr(); - - if ( addr >= 0 ) - { - watchpoint[64].address = addr; - watchpoint[64].flags = WP_E|WP_X; - - FCEUI_SetEmulationPaused(0); - } + asmView->setBreakpointAtSelectedLine(); } //---------------------------------------------------------------------------- void ConsoleDebugger::debugRunLineCB(void) @@ -1803,10 +1795,12 @@ void ConsoleDebugger::resetCountersCB (void) //---------------------------------------------------------------------------- void ConsoleDebugger::asmViewCtxMenuRunToCursor(void) { + fceuWrapperLock(); watchpoint[64].address = asmView->getCtxMenuAddr(); watchpoint[64].flags = WP_E|WP_X; FCEUI_SetEmulationPaused(0); + fceuWrapperUnLock(); } //---------------------------------------------------------------------------- void ConsoleDebugger::asmViewCtxMenuAddBP(void) @@ -1884,6 +1878,29 @@ void QAsmView::setPC_placement( int mode, int ofs ) g_config->save(); } //---------------------------------------------------------------------------- +void QAsmView::setBreakpointAtSelectedLine(void) +{ + int addr = -1; + + if ( (selAddrLine >= 0) && (selAddrLine < asmEntry.size()) ) + { + if ( selAddrValue == asmEntry[ selAddrLine ]->addr ) + { + addr = selAddrValue; + } + } + + if ( addr >= 0 ) + { + fceuWrapperLock(); + watchpoint[64].address = addr; + watchpoint[64].flags = WP_E|WP_X; + + FCEUI_SetEmulationPaused(0); + fceuWrapperUnLock(); + } +} +//---------------------------------------------------------------------------- int QAsmView::getAsmLineFromAddr(int addr) { int line = -1; @@ -3817,7 +3834,7 @@ void QAsmView::contextMenuEvent(QContextMenuEvent *event) { act = new QAction(tr("Run To Cursor"), &menu); menu.addAction(act); - act->setShortcut( QKeySequence(tr("Ctrl+F10"))); + //act->setShortcut( QKeySequence(tr("Ctrl+F10"))); connect( act, SIGNAL(triggered(void)), parent, SLOT(asmViewCtxMenuRunToCursor(void)) ); } diff --git a/src/drivers/Qt/ConsoleDebugger.h b/src/drivers/Qt/ConsoleDebugger.h index 6d47059a..20f9a1a4 100644 --- a/src/drivers/Qt/ConsoleDebugger.h +++ b/src/drivers/Qt/ConsoleDebugger.h @@ -114,6 +114,7 @@ class QAsmView : public QWidget int getCtxMenuAddr(void){ return ctxMenuAddr; }; int getCursorAddr(void){ return cursorLineAddr; }; void setPC_placement( int mode, int ofs = 0 ); + void setBreakpointAtSelectedLine(void); protected: void paintEvent(QPaintEvent *event); void keyPressEvent(QKeyEvent *event);