1
0
Fork 0

GUI: add simple 'Find references to region' in memory map

This commit is contained in:
Duncan Ogilvie 2020-04-10 03:58:43 +02:00
parent 99f7d096a8
commit c139a94c08
No known key found for this signature in database
GPG Key ID: FC89E0AAA0C1AAD8
2 changed files with 15 additions and 0 deletions

View File

@ -166,6 +166,10 @@ void MemoryMapView::setupContextMenu()
mAddVirtualMod = new QAction(DIcon("virtual.png"), tr("Add virtual module"), this);
connect(mAddVirtualMod, SIGNAL(triggered()), this, SLOT(addVirtualModSlot()));
//References
mReferences = new QAction(DIcon("find.png"), tr("Find references to region"), this);
connect(mReferences, SIGNAL(triggered()), this, SLOT(findReferencesSlot()));
//Comment
mComment = new QAction(DIcon("comment.png"), tr("&Comment"), this);
this->addAction(mComment);
@ -203,6 +207,7 @@ void MemoryMapView::contextMenuSlot(const QPoint & pos)
wMenu.addAction(mComment);
wMenu.addAction(mFindPattern);
wMenu.addAction(mSwitchView);
wMenu.addAction(mReferences);
wMenu.addSeparator();
wMenu.addAction(mMemoryAllocate);
wMenu.addAction(mMemoryFree);
@ -618,6 +623,14 @@ void MemoryMapView::addVirtualModSlot()
DbgCmdExec(QString("virtualmod \"%1\", %2, %3").arg(modname).arg(ToHexString(base)).arg(ToHexString(size)).toUtf8().constData());
}
void MemoryMapView::findReferencesSlot()
{
auto base = duint(getCellContent(getInitialSelection(), 0).toULongLong(nullptr, 16));
auto size = duint(getCellContent(getInitialSelection(), 1).toULongLong(nullptr, 16));
DbgCmdExec(QString("reffindrange %1, %2, dis.sel()").arg(ToPtrString(base)).arg(ToPtrString(base + size)).toUtf8().constData());
emit showReferences();
}
void MemoryMapView::selectionGetSlot(SELECTIONDATA* selection)
{
selection->start = selection->end = duint(getCellContent(getInitialSelection(), 0).toULongLong(nullptr, 16));

View File

@ -36,6 +36,7 @@ public slots:
void gotoOriginSlot();
void gotoExpressionSlot();
void addVirtualModSlot();
void findReferencesSlot();
void selectionGetSlot(SELECTIONDATA* selection);
void disassembleAtSlot(dsint va, dsint cip);
@ -74,6 +75,7 @@ private:
QAction* mMemoryFree;
QAction* mAddVirtualMod;
QAction* mComment;
QAction* mReferences;
QMenu* mPluginMenu;
duint mCipBase;