Added a run to cursor debugger feature to Qt debugger window assembly view context menu.

This commit is contained in:
Matthew Budd 2020-11-15 11:57:43 -05:00
parent 13ea28dad4
commit d3b779a4e3
2 changed files with 28 additions and 1 deletions

View File

@ -1663,6 +1663,14 @@ void ConsoleDebugger::resetCountersCB (void)
updateRegisterView(); updateRegisterView();
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
void ConsoleDebugger::asmViewCtxMenuRunToCursor(void)
{
watchpoint[64].address = asmView->getCtxMenuAddr();
watchpoint[64].flags = WP_E|WP_X;
FCEUI_SetEmulationPaused(0);
}
//----------------------------------------------------------------------------
void ConsoleDebugger::asmViewCtxMenuAddBP(void) void ConsoleDebugger::asmViewCtxMenuAddBP(void)
{ {
watchpointinfo wp; watchpointinfo wp;
@ -2958,7 +2966,12 @@ void QAsmView::scrollToPC(void)
{ {
if ( asmPC != NULL ) if ( asmPC != NULL )
{ {
lineOffset = asmPC->line; lineOffset = asmPC->line - (viewLines / 2);
if ( lineOffset < 0 )
{
lineOffset = 0;
}
vbar->setValue( lineOffset ); vbar->setValue( lineOffset );
} }
} }
@ -3579,6 +3592,7 @@ void QAsmView::contextMenuEvent(QContextMenuEvent *event)
QAction *act; QAction *act;
QMenu menu(this); QMenu menu(this);
QPoint c = convPixToCursor( event->pos() ); QPoint c = convPixToCursor( event->pos() );
bool enableRunToCursor = false;
line = lineOffset + c.y(); line = lineOffset + c.y();
@ -3591,10 +3605,22 @@ void QAsmView::contextMenuEvent(QContextMenuEvent *event)
if ( selAddrValue < 0 ) if ( selAddrValue < 0 )
{ {
ctxMenuAddr = addr = asmEntry[line]->addr; ctxMenuAddr = addr = asmEntry[line]->addr;
enableRunToCursor = true;
} }
else else
{ {
ctxMenuAddr = addr = selAddrValue; ctxMenuAddr = addr = selAddrValue;
enableRunToCursor = (selAddrValue == asmEntry[line]->addr);
}
if ( enableRunToCursor )
{
act = new QAction(tr("Run To Cursor"), &menu);
menu.addAction(act);
act->setShortcut( QKeySequence(tr("Ctrl+F10")));
connect( act, SIGNAL(triggered(void)), parent, SLOT(asmViewCtxMenuRunToCursor(void)) );
} }
act = new QAction(tr("Add Breakpoint"), &menu); act = new QAction(tr("Add Breakpoint"), &menu);

View File

@ -291,6 +291,7 @@ class ConsoleDebugger : public QDialog
void asmViewCtxMenuAddBM(void); void asmViewCtxMenuAddBM(void);
void asmViewCtxMenuAddSym(void); void asmViewCtxMenuAddSym(void);
void asmViewCtxMenuOpenHexEdit(void); void asmViewCtxMenuOpenHexEdit(void);
void asmViewCtxMenuRunToCursor(void);
private slots: private slots:
void updatePeriodic(void); void updatePeriodic(void);
void hbarChanged(int value); void hbarChanged(int value);