diff --git a/src/drivers/Qt/ConsoleDebugger.cpp b/src/drivers/Qt/ConsoleDebugger.cpp index 332533e5..ee966fc4 100644 --- a/src/drivers/Qt/ConsoleDebugger.cpp +++ b/src/drivers/Qt/ConsoleDebugger.cpp @@ -7,6 +7,8 @@ #include #include +#include +#include #include #include #include @@ -1105,6 +1107,20 @@ void ConsoleDebugger::resetCountersCB (void) updateRegisterView(); } //---------------------------------------------------------------------------- +void ConsoleDebugger::asmViewCtxMenuAddBP(void) +{ + watchpointinfo wp; + + wp.address = asmView->getCtxMenuAddr(); + wp.endaddress = 0; + wp.flags = WP_X | WP_E; + wp.condText = 0; + wp.desc = NULL; + + openBpEditWindow( -1, &wp ); + +} +//---------------------------------------------------------------------------- int QAsmView::getAsmLineFromAddr(int addr) { int line = -1; @@ -1668,6 +1684,12 @@ void ConsoleDebugger::updatePeriodic(void) emuStatLbl->setText( tr(" Emulator is Running") ); emuStatLbl->setStyleSheet("background-color: green; color: white;"); } + + if ( bpTree->topLevelItemCount() != numWPs ) + { + printf("Breakpoint Tree Update\n"); + bpListUpdate( true ); + } } //---------------------------------------------------------------------------- void ConsoleDebugger::breakPointNotify( int bpNum ) @@ -1770,6 +1792,7 @@ QAsmView::QAsmView(QWidget *parent) maxLineLen = 0; lineOffset = 0; maxLineOffset = 0; + ctxMenuAddr = -1; //setSizePolicy( QSizePolicy::Preferred, QSizePolicy::Expanding ); } @@ -1963,13 +1986,46 @@ void QAsmView::mouseMoveEvent(QMouseEvent * event) //---------------------------------------------------------------------------- void QAsmView::mousePressEvent(QMouseEvent * event) { - // TODO QPoint c = convPixToCursor( event->pos() ); + //int line; + //QPoint c = convPixToCursor( event->pos() ); + //line = lineOffset + c.y(); + // + //if ( line < asmEntry.size() ) + //{ + // int addr; + + // addr = asmEntry[line]->addr; + //} } //---------------------------------------------------------------------------- void QAsmView::contextMenuEvent(QContextMenuEvent *event) { - // TODO + int line; + QAction *act; + QMenu menu(this); + QPoint c = convPixToCursor( event->pos() ); + + line = lineOffset + c.y(); + + ctxMenuAddr = -1; + + if ( line < asmEntry.size() ) + { + int addr; + + ctxMenuAddr = addr = asmEntry[line]->addr; + + act = new QAction(tr("Add Breakpoint"), this); + menu.addAction(act); + connect( act, SIGNAL(triggered(void)), parent, SLOT(asmViewCtxMenuAddBP(void)) ); + + act = new QAction(tr("Add Symbolic Debug Name"), this); + menu.addAction(act); + //connect( act, SIGNAL(triggered(void)), this, SLOT(addBookMarkCB(void)) ); + + menu.exec(event->globalPos()); + } } //---------------------------------------------------------------------------- void QAsmView::paintEvent(QPaintEvent *event) diff --git a/src/drivers/Qt/ConsoleDebugger.h b/src/drivers/Qt/ConsoleDebugger.h index 4483e74c..41a1a4c5 100644 --- a/src/drivers/Qt/ConsoleDebugger.h +++ b/src/drivers/Qt/ConsoleDebugger.h @@ -67,6 +67,7 @@ class QAsmView : public QWidget void setLine(int lineNum); void scrollToPC(void); void setDisplayROMoffsets( bool value ); + int getCtxMenuAddr(void){ return ctxMenuAddr; }; protected: void paintEvent(QPaintEvent *event); void keyPressEvent(QKeyEvent *event); @@ -85,6 +86,7 @@ class QAsmView : public QWidget QScrollBar *vbar; QScrollBar *hbar; + int ctxMenuAddr; int maxLineLen; int pxCharWidth; int pxCharHeight; @@ -117,6 +119,7 @@ class ConsoleDebugger : public QDialog void updateWindowData(void); void updateRegisterView(void); void breakPointNotify(int bpNum); + void openBpEditWindow(int editIdx = -1, watchpointinfo *wp = NULL ); QLabel *asmLineSelLbl; protected: @@ -176,11 +179,11 @@ class ConsoleDebugger : public QDialog private: void setRegsFromEntry(void); - void openBpEditWindow(int editIdx = -1, watchpointinfo *wp = NULL ); void bpListUpdate( bool reset = false ); public slots: void closeWindow(void); + void asmViewCtxMenuAddBP(void); private slots: void updatePeriodic(void); void vbarChanged(int value);