1
0
Fork 0

ADDED: trace file can now auto-scroll the disassembly view to current selection

This commit is contained in:
Manuel 2018-10-05 11:56:44 +02:00 committed by Duncan Ogilvie
parent da69e828ea
commit 69db4494cd
2 changed files with 30 additions and 0 deletions

View File

@ -31,6 +31,8 @@ TraceBrowser::TraceBrowser(QWidget* parent) : AbstractTableView(parent)
mRvaDisplayBase = 0;
mRvaDisplayEnabled = false;
mAutoDisassemblyFollowSelection = false;
int maxModuleSize = (int)ConfigUint("Disassembler", "MaxModuleSize");
mDisasm = new QBeaEngine(maxModuleSize);
mHighlightingMode = false;
@ -564,6 +566,19 @@ void TraceBrowser::setupRightClickContextMenu()
return true;
});
mMenuBuilder->addMenu(makeMenu(tr("Information")), infoMenu);
QAction* toggleAutoDisassemblyFollowSelection = makeAction(tr("Toggle Auto Disassembly Scroll (off)"), SLOT(toggleAutoDisassemblyFollowSelection()));
mMenuBuilder->addAction(toggleAutoDisassemblyFollowSelection, [this, toggleAutoDisassemblyFollowSelection](QMenu*)
{
if(!DbgIsDebugging())
return false;
if(mAutoDisassemblyFollowSelection)
toggleAutoDisassemblyFollowSelection->setText(tr("Toggle Auto Disassembly Scroll (on)"));
else
toggleAutoDisassemblyFollowSelection->setText(tr("Toggle Auto Disassembly Scroll (off)"));
return true;
});
}
void TraceBrowser::contextMenuEvent(QContextMenuEvent* event)
@ -628,6 +643,10 @@ void TraceBrowser::mousePressEvent(QMouseEvent* event)
setSingleSelection(index);
mHistory.addVaToHistory(index);
updateViewport();
if(mAutoDisassemblyFollowSelection)
followDisassemblySlot();
return;
}
break;
@ -756,6 +775,9 @@ void TraceBrowser::keyPressEvent(QKeyEvent* event)
makeVisible(visibleindex);
mHistory.addVaToHistory(visibleindex);
updateViewport();
if(mAutoDisassemblyFollowSelection)
followDisassemblySlot();
}
else
AbstractTableView::keyPressEvent(event);
@ -1373,3 +1395,8 @@ void TraceBrowser::updateSlot()
reloadData();
}
}
void TraceBrowser::toggleAutoDisassemblyFollowSelection()
{
mAutoDisassemblyFollowSelection = !mAutoDisassemblyFollowSelection;
}

View File

@ -59,6 +59,7 @@ private:
CapstoneTokenizer::SingleToken mHighlightToken;
bool mHighlightingMode;
bool mPermanentHighlightingMode;
bool mAutoDisassemblyFollowSelection;
TraceFileReader* mTraceFile;
QBeaEngine* mDisasm;
@ -131,6 +132,8 @@ public slots:
void searchMemRefSlot();
void updateSlot(); //debug
void toggleAutoDisassemblyFollowSelection();
};
#endif //TRACEBROWSER_H