GUI: added goto start/end of page + added follow DWORD/QWORD in dump + shortcut for goto file offset
This commit is contained in:
parent
3bfacacd87
commit
dcd4ee548f
|
@ -277,6 +277,7 @@ void CPUDisassembly::contextMenuEvent(QContextMenuEvent* event)
|
|||
wMenu->addAction(mSetNewOriginHere);
|
||||
|
||||
// Goto Menu
|
||||
mGotoMenu->clear();
|
||||
mGotoMenu->addAction(mGotoOrigin);
|
||||
if(historyHasPrevious())
|
||||
mGotoMenu->addAction(mGotoPrevious);
|
||||
|
@ -286,6 +287,8 @@ void CPUDisassembly::contextMenuEvent(QContextMenuEvent* event)
|
|||
char modname[MAX_MODULE_SIZE] = "";
|
||||
if(DbgGetModuleAt(wVA, modname))
|
||||
mGotoMenu->addAction(mGotoFileOffset);
|
||||
mGotoMenu->addAction(mGotoStart);
|
||||
mGotoMenu->addAction(mGotoEnd);
|
||||
wMenu->addMenu(mGotoMenu);
|
||||
wMenu->addSeparator();
|
||||
|
||||
|
@ -472,8 +475,22 @@ void CPUDisassembly::setupRightClickContextMenu()
|
|||
|
||||
// File offset action
|
||||
mGotoFileOffset = new QAction("File Offset", this);
|
||||
mGotoFileOffset->setShortcutContext(Qt::WidgetShortcut);
|
||||
this->addAction(mGotoFileOffset);
|
||||
connect(mGotoFileOffset, SIGNAL(triggered()), this, SLOT(gotoFileOffset()));
|
||||
|
||||
// Goto->Start of page
|
||||
mGotoStart = new QAction("Start of Page", this);
|
||||
mGotoStart->setShortcutContext(Qt::WidgetShortcut);
|
||||
this->addAction(mGotoStart);
|
||||
connect(mGotoStart, SIGNAL(triggered()), this, SLOT(gotoStartSlot()));
|
||||
|
||||
// Goto->End of page
|
||||
mGotoEnd = new QAction("End of Page", this);
|
||||
mGotoEnd->setShortcutContext(Qt::WidgetShortcut);
|
||||
this->addAction(mGotoEnd);
|
||||
connect(mGotoEnd, SIGNAL(triggered()), this, SLOT(gotoEndSlot()));
|
||||
|
||||
//-------------------- Follow in Dump ----------------------------
|
||||
// Menu
|
||||
mFollowMenu = new QMenu("&Follow in Dump", this);
|
||||
|
@ -589,6 +606,9 @@ void CPUDisassembly::refreshShortcutsSlot()
|
|||
mGotoPrevious->setShortcut(ConfigShortcut("ActionGotoPrevious"));
|
||||
mGotoNext->setShortcut(ConfigShortcut("ActionGotoNext"));
|
||||
mGotoExpression->setShortcut(ConfigShortcut("ActionGotoExpression"));
|
||||
mGotoStart->setShortcut(ConfigShortcut("ActionGotoStart"));
|
||||
mGotoEnd->setShortcut(ConfigShortcut("ActionGotoEnd"));
|
||||
mGotoFileOffset->setShortcut(ConfigShortcut("ActionGotoFileOffset"));
|
||||
mReferenceSelectedAddress->setShortcut(ConfigShortcut("ActionFindReferencesToSelectedAddress"));
|
||||
mSearchPattern->setShortcut(ConfigShortcut("ActionFindPattern"));
|
||||
mEnableHighlightingMode->setShortcut(ConfigShortcut("ActionHighlightingMode"));
|
||||
|
@ -968,6 +988,18 @@ void CPUDisassembly::gotoFileOffset()
|
|||
DbgCmdExec(QString().sprintf("disasm \"%p\"", value).toUtf8().constData());
|
||||
}
|
||||
|
||||
void CPUDisassembly::gotoStartSlot()
|
||||
{
|
||||
uint_t dest = mMemPage->getBase();
|
||||
DbgCmdExec(QString().sprintf("disasm \"%p\"", dest).toUtf8().constData());
|
||||
}
|
||||
|
||||
void CPUDisassembly::gotoEndSlot()
|
||||
{
|
||||
uint_t dest = mMemPage->getBase() + mMemPage->getSize() - (getViewableRowsCount() * 16);
|
||||
DbgCmdExec(QString().sprintf("disasm \"%p\"", dest).toUtf8().constData());
|
||||
}
|
||||
|
||||
void CPUDisassembly::followActionSlot()
|
||||
{
|
||||
QAction* action = qobject_cast<QAction*>(sender());
|
||||
|
|
|
@ -46,6 +46,8 @@ public slots:
|
|||
void assembleAt();
|
||||
void gotoExpression();
|
||||
void gotoFileOffset();
|
||||
void gotoStartSlot();
|
||||
void gotoEndSlot();
|
||||
void followActionSlot();
|
||||
void gotoPrevious();
|
||||
void gotoNext();
|
||||
|
@ -110,6 +112,8 @@ private:
|
|||
QAction* mGotoFileOffset;
|
||||
QAction* mGotoPrevious;
|
||||
QAction* mGotoNext;
|
||||
QAction* mGotoStart;
|
||||
QAction* mGotoEnd;
|
||||
QAction* mReferenceSelectedAddress;
|
||||
QAction* mSearchCommand;
|
||||
QAction* mSearchConstant;
|
||||
|
|
|
@ -142,6 +142,14 @@ void CPUDump::setupContextMenu()
|
|||
mFollowInDisasm = new QAction("Follow in Disassembler", this);
|
||||
connect(mFollowInDisasm, SIGNAL(triggered()), this, SLOT(followInDisasmSlot()));
|
||||
|
||||
//Follow DWORD/QWORD
|
||||
#ifdef _WIN64
|
||||
mFollowData = new QAction("&Follow QWORD in Disassembler", this);
|
||||
#else //x86
|
||||
mFollowData = new QAction("&Follow DWORD in Disassembler", this);
|
||||
#endif //_WIN64
|
||||
connect(mFollowData, SIGNAL(triggered()), this, SLOT(followDataSlot()));
|
||||
|
||||
//Label
|
||||
mSetLabelAction = new QAction("Set Label", this);
|
||||
mSetLabelAction->setShortcutContext(Qt::WidgetShortcut);
|
||||
|
@ -267,9 +275,25 @@ void CPUDump::setupContextMenu()
|
|||
|
||||
// Goto->File offset
|
||||
mGotoFileOffset = new QAction("File Offset", this);
|
||||
mGotoFileOffset->setShortcutContext(Qt::WidgetShortcut);
|
||||
this->addAction(mGotoFileOffset);
|
||||
connect(mGotoFileOffset, SIGNAL(triggered()), this, SLOT(gotoFileOffsetSlot()));
|
||||
mGotoMenu->addAction(mGotoFileOffset);
|
||||
|
||||
// Goto->Start of page
|
||||
mGotoStart = new QAction("Start of Page", this);
|
||||
mGotoStart->setShortcutContext(Qt::WidgetShortcut);
|
||||
this->addAction(mGotoStart);
|
||||
connect(mGotoStart, SIGNAL(triggered()), this, SLOT(gotoStartSlot()));
|
||||
mGotoMenu->addAction(mGotoStart);
|
||||
|
||||
// Goto->End of page
|
||||
mGotoEnd = new QAction("End of Page", this);
|
||||
mGotoEnd->setShortcutContext(Qt::WidgetShortcut);
|
||||
this->addAction(mGotoEnd);
|
||||
connect(mGotoEnd, SIGNAL(triggered()), this, SLOT(gotoEndSlot()));
|
||||
mGotoMenu->addAction(mGotoEnd);
|
||||
|
||||
//Hex menu
|
||||
mHexMenu = new QMenu("&Hex", this);
|
||||
//Hex->Ascii
|
||||
|
@ -380,6 +404,9 @@ void CPUDump::refreshShortcutsSlot()
|
|||
mFindPatternAction->setShortcut(ConfigShortcut("ActionFindPattern"));
|
||||
mFindReferencesAction->setShortcut(ConfigShortcut("ActionFindReferences"));
|
||||
mGotoExpression->setShortcut(ConfigShortcut("ActionGotoExpression"));
|
||||
mGotoStart->setShortcut(ConfigShortcut("ActionGotoStart"));
|
||||
mGotoEnd->setShortcut(ConfigShortcut("ActionGotoEnd"));
|
||||
mGotoFileOffset->setShortcut(ConfigShortcut("ActionGotoFileOffset"));
|
||||
mYaraAction->setShortcut(ConfigShortcut("ActionYara"));
|
||||
}
|
||||
|
||||
|
@ -472,6 +499,9 @@ void CPUDump::contextMenuEvent(QContextMenuEvent* event)
|
|||
{
|
||||
if(!DbgIsDebugging())
|
||||
return;
|
||||
|
||||
int_t selectedAddr = rvaToVa(getInitialSelection());
|
||||
|
||||
QMenu* wMenu = new QMenu(this); //create context menu
|
||||
wMenu->addMenu(mBinaryMenu);
|
||||
int_t start = rvaToVa(getSelectionStart());
|
||||
|
@ -481,6 +511,12 @@ void CPUDump::contextMenuEvent(QContextMenuEvent* event)
|
|||
if(DbgMemIsValidReadPtr(start) && DbgMemFindBaseAddr(start, 0) == DbgMemFindBaseAddr(DbgValFromString("csp"), 0))
|
||||
wMenu->addAction(mFollowStack);
|
||||
wMenu->addAction(mFollowInDisasm);
|
||||
|
||||
uint_t ptr = 0;
|
||||
DbgMemRead(selectedAddr, (unsigned char*)&ptr, sizeof(uint_t));
|
||||
if(DbgMemIsValidReadPtr(ptr))
|
||||
wMenu->addAction(mFollowData);
|
||||
|
||||
wMenu->addAction(mSetLabelAction);
|
||||
wMenu->addMenu(mBreakpointMenu);
|
||||
wMenu->addAction(mFindPatternAction);
|
||||
|
@ -496,7 +532,7 @@ void CPUDump::contextMenuEvent(QContextMenuEvent* event)
|
|||
wMenu->addAction(mAddressAction);
|
||||
wMenu->addAction(mDisassemblyAction);
|
||||
|
||||
int_t selectedAddr = rvaToVa(getInitialSelection());
|
||||
|
||||
if((DbgGetBpxTypeAt(selectedAddr) & bp_hardware) == bp_hardware) //hardware breakpoint set
|
||||
{
|
||||
mHardwareAccessMenu->menuAction()->setVisible(false);
|
||||
|
@ -625,6 +661,18 @@ void CPUDump::gotoFileOffsetSlot()
|
|||
DbgCmdExec(QString().sprintf("dump \"%p\"", value).toUtf8().constData());
|
||||
}
|
||||
|
||||
void CPUDump::gotoStartSlot()
|
||||
{
|
||||
uint_t dest = mMemPage->getBase();
|
||||
DbgCmdExec(QString().sprintf("dump \"%p\"", dest).toUtf8().constData());
|
||||
}
|
||||
|
||||
void CPUDump::gotoEndSlot()
|
||||
{
|
||||
uint_t dest = mMemPage->getBase() + mMemPage->getSize() - (getViewableRowsCount() * getBytePerRowCount());
|
||||
DbgCmdExec(QString().sprintf("dump \"%p\"", dest).toUtf8().constData());
|
||||
}
|
||||
|
||||
void CPUDump::hexAsciiSlot()
|
||||
{
|
||||
Config()->setUint("HexDump", "DefaultView", (uint_t)ViewHexAscii);
|
||||
|
@ -1343,6 +1391,12 @@ void CPUDump::followInDisasmSlot()
|
|||
DbgCmdExec(QString("disasm " + addrText).toUtf8().constData());
|
||||
}
|
||||
|
||||
void CPUDump::followDataSlot()
|
||||
{
|
||||
QString addrText = QString("%1").arg(rvaToVa(getSelectionStart()), sizeof(int_t) * 2, 16, QChar('0')).toUpper();
|
||||
DbgCmdExec(QString("disasm [%1]").arg(addrText).toUtf8().constData());
|
||||
}
|
||||
|
||||
void CPUDump::selectionUpdatedSlot()
|
||||
{
|
||||
QString selStart = QString("%1").arg(rvaToVa(getSelectionStart()), sizeof(int_t) * 2, 16, QChar('0')).toUpper();
|
||||
|
|
|
@ -41,6 +41,8 @@ public slots:
|
|||
void setLabelSlot();
|
||||
void gotoExpressionSlot();
|
||||
void gotoFileOffsetSlot();
|
||||
void gotoStartSlot();
|
||||
void gotoEndSlot();
|
||||
|
||||
void hexAsciiSlot();
|
||||
void hexUnicodeSlot();
|
||||
|
@ -78,6 +80,7 @@ public slots:
|
|||
void followStackSlot();
|
||||
void findReferencesSlot();
|
||||
void followInDisasmSlot();
|
||||
void followDataSlot();
|
||||
|
||||
void selectionUpdatedSlot();
|
||||
void yaraSlot();
|
||||
|
@ -118,6 +121,8 @@ private:
|
|||
QMenu* mGotoMenu;
|
||||
QAction* mGotoExpression;
|
||||
QAction* mGotoFileOffset;
|
||||
QAction* mGotoStart;
|
||||
QAction* mGotoEnd;
|
||||
|
||||
QAction* mFollowInDisasm;
|
||||
|
||||
|
@ -167,6 +172,7 @@ private:
|
|||
QAction* mYaraAction;
|
||||
QAction* mDataCopyAction;
|
||||
QAction* mUndoSelection;
|
||||
QAction* mFollowData;
|
||||
|
||||
QMenu* mSpecialMenu;
|
||||
QMenu* mCustomMenu;
|
||||
|
|
|
@ -251,6 +251,9 @@ Configuration::Configuration() : QObject()
|
|||
defaultShortcuts.insert("ActionGotoPrevious", Shortcut(tr("Actions -> Goto Previous"), "-"));
|
||||
defaultShortcuts.insert("ActionGotoNext", Shortcut(tr("Actions -> Goto Next"), "+"));
|
||||
defaultShortcuts.insert("ActionGotoExpression", Shortcut(tr("Actions -> Goto Expression"), "Ctrl+G"));
|
||||
defaultShortcuts.insert("ActionGotoStart", Shortcut(tr("Actions -> Goto Start of Page"), "Home"));
|
||||
defaultShortcuts.insert("ActionGotoEnd", Shortcut(tr("Actions -> Goto End of Page"), "End"));
|
||||
defaultShortcuts.insert("ActionGotoFileOffset", Shortcut(tr("Actions -> Goto File Offset"), "Ctrl+Shift+G"));
|
||||
defaultShortcuts.insert("ActionFindReferencesToSelectedAddress", Shortcut(tr("Actions -> Find References to Selected Address"), "Ctrl+R"));
|
||||
defaultShortcuts.insert("ActionFindPattern", Shortcut(tr("Actions -> Find Pattern"), "Ctrl+B"));
|
||||
defaultShortcuts.insert("ActionFindReferences", Shortcut(tr("Actions -> Find References"), "Ctrl+R"));
|
||||
|
|
Loading…
Reference in New Issue