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; mRvaDisplayBase = 0;
mRvaDisplayEnabled = false; mRvaDisplayEnabled = false;
mAutoDisassemblyFollowSelection = false;
int maxModuleSize = (int)ConfigUint("Disassembler", "MaxModuleSize"); int maxModuleSize = (int)ConfigUint("Disassembler", "MaxModuleSize");
mDisasm = new QBeaEngine(maxModuleSize); mDisasm = new QBeaEngine(maxModuleSize);
mHighlightingMode = false; mHighlightingMode = false;
@ -564,6 +566,19 @@ void TraceBrowser::setupRightClickContextMenu()
return true; return true;
}); });
mMenuBuilder->addMenu(makeMenu(tr("Information")), infoMenu); 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) void TraceBrowser::contextMenuEvent(QContextMenuEvent* event)
@ -628,6 +643,10 @@ void TraceBrowser::mousePressEvent(QMouseEvent* event)
setSingleSelection(index); setSingleSelection(index);
mHistory.addVaToHistory(index); mHistory.addVaToHistory(index);
updateViewport(); updateViewport();
if(mAutoDisassemblyFollowSelection)
followDisassemblySlot();
return; return;
} }
break; break;
@ -756,6 +775,9 @@ void TraceBrowser::keyPressEvent(QKeyEvent* event)
makeVisible(visibleindex); makeVisible(visibleindex);
mHistory.addVaToHistory(visibleindex); mHistory.addVaToHistory(visibleindex);
updateViewport(); updateViewport();
if(mAutoDisassemblyFollowSelection)
followDisassemblySlot();
} }
else else
AbstractTableView::keyPressEvent(event); AbstractTableView::keyPressEvent(event);
@ -1373,3 +1395,8 @@ void TraceBrowser::updateSlot()
reloadData(); reloadData();
} }
} }
void TraceBrowser::toggleAutoDisassemblyFollowSelection()
{
mAutoDisassemblyFollowSelection = !mAutoDisassemblyFollowSelection;
}

View File

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