From 1efe2de1f7f7b535bba067c121035e32bca38fe9 Mon Sep 17 00:00:00 2001 From: mjbudd77 Date: Fri, 9 Jul 2021 00:01:32 -0400 Subject: [PATCH] Added logic to allow for quick toggling of breakpoints by just clicking left mouse button between the end of cdl end boundary and the beginning of the line address text. --- src/drivers/Qt/ConsoleDebugger.cpp | 44 ++++++++++++++++++++++++++++-- src/drivers/Qt/ConsoleDebugger.h | 3 +- 2 files changed, 44 insertions(+), 3 deletions(-) diff --git a/src/drivers/Qt/ConsoleDebugger.cpp b/src/drivers/Qt/ConsoleDebugger.cpp index 2bbcb594..1e6ccd17 100644 --- a/src/drivers/Qt/ConsoleDebugger.cpp +++ b/src/drivers/Qt/ConsoleDebugger.cpp @@ -1062,7 +1062,7 @@ void ConsoleDebugger::selBmAddrChanged(const QString &txt) //printf("selBmAddrVal = %04X\n", selBmAddrVal ); } //---------------------------------------------------------------------------- -void ConsoleDebugger::openBpEditWindow( int editIdx, watchpointinfo *wp ) +void ConsoleDebugger::openBpEditWindow( int editIdx, watchpointinfo *wp, bool forceAccept ) { int ret; QDialog dialog(this); @@ -1237,7 +1237,14 @@ void ConsoleDebugger::openBpEditWindow( int editIdx, watchpointinfo *wp ) dialog.setLayout( mainLayout ); - ret = dialog.exec(); + if ( forceAccept ) + { + ret = QDialog::Accepted; + } + else + { + ret = dialog.exec(); + } if ( ret == QDialog::Accepted ) { @@ -2260,6 +2267,32 @@ void QAsmView::setPC_placement( int mode, int ofs ) g_config->save(); } //---------------------------------------------------------------------------- +void QAsmView::toggleBreakpoint(int line) +{ + if ( line < asmEntry.size() ) + { + int bpNum = isBreakpointAtLine(line); + + if ( bpNum >= 0 ) + { + DeleteBreak( bpNum ); + } + else + { + watchpointinfo wp; + + wp.address = asmEntry[line]->addr; + wp.endaddress = 0; + wp.flags = WP_X | WP_E; + wp.condText = 0; + wp.desc = NULL; + + dbgWin->openBpEditWindow( -1, &wp, true ); + } + asmEntry[line]->bpNum = isBreakpointAtLine(line); + } +} +//---------------------------------------------------------------------------- int QAsmView::isBreakpointAtAddr( int addr ) { for (int i=0; i= 2) && (c.x() <= 3) ) + { + //printf("Toggle BP!\n"); + toggleBreakpoint(line); + } + } selAddrLine = -1; diff --git a/src/drivers/Qt/ConsoleDebugger.h b/src/drivers/Qt/ConsoleDebugger.h index 0d11c762..7182f474 100644 --- a/src/drivers/Qt/ConsoleDebugger.h +++ b/src/drivers/Qt/ConsoleDebugger.h @@ -133,6 +133,7 @@ class QAsmView : public QWidget void wheelEvent(QWheelEvent *event); void contextMenuEvent(QContextMenuEvent *event); void loadHighlightToClipboard(void); + void toggleBreakpoint(int line); void calcFontData(void); QPoint convPixToCursor( QPoint p ); @@ -230,7 +231,7 @@ class ConsoleDebugger : public QDialog void updateWindowData(void); void updateRegisterView(void); void breakPointNotify(int bpNum); - void openBpEditWindow(int editIdx = -1, watchpointinfo *wp = NULL ); + void openBpEditWindow(int editIdx = -1, watchpointinfo *wp = NULL, bool forceAccept = false ); void openDebugSymbolEditWindow( int addr ); void setBookmarkSelectedAddress( int addr ); int getBookmarkSelectedAddress(void){ return selBmAddrVal; };