GUI: add copy header VA to disassembly menu
This commit is contained in:
parent
2665df4eb3
commit
05378fabb2
|
|
@ -23,14 +23,13 @@ Disassembly::Disassembly(QWidget* parent) : AbstractTableView(parent), mDisassem
|
|||
|
||||
mHighlightToken.text = "";
|
||||
mHighlightingMode = false;
|
||||
mPermanentHighlightingMode = false;
|
||||
mShowMnemonicBrief = false;
|
||||
|
||||
int maxModuleSize = (int)ConfigUint("Disassembler", "MaxModuleSize");
|
||||
Config()->writeUints();
|
||||
|
||||
mDisasm = new QBeaEngine(maxModuleSize);
|
||||
mDisasm->UpdateConfig();
|
||||
tokenizerConfigUpdatedSlot();
|
||||
|
||||
mCodeFoldingManager = nullptr;
|
||||
duint setting;
|
||||
|
|
@ -147,6 +146,7 @@ void Disassembly::tokenizerConfigUpdatedSlot()
|
|||
{
|
||||
mDisasm->UpdateConfig();
|
||||
mPermanentHighlightingMode = ConfigBool("Disassembler", "PermanentHighlightingMode");
|
||||
mNoCurrentModuleText = ConfigBool("Disassembler", "NoCurrentModuleText");
|
||||
}
|
||||
|
||||
/************************************************************************************
|
||||
|
|
@ -2107,7 +2107,7 @@ QString Disassembly::getAddrText(dsint cur_addr, char label[MAX_LABEL_SIZE], boo
|
|||
if(getLabel && DbgGetLabelAt(cur_addr, SEG_DEFAULT, label_)) //has label
|
||||
{
|
||||
char module[MAX_MODULE_SIZE] = "";
|
||||
if(DbgGetModuleAt(cur_addr, module) && !QString(label_).startsWith("JMP.&"))
|
||||
if(DbgGetModuleAt(cur_addr, module) && !QString(label_).startsWith("JMP.&") && !mNoCurrentModuleText)
|
||||
addrText += " <" + QString(module) + "." + QString(label_) + ">";
|
||||
else
|
||||
addrText += " <" + QString(label_) + ">";
|
||||
|
|
|
|||
|
|
@ -252,6 +252,7 @@ protected:
|
|||
DisassemblyPopup mDisassemblyPopup;
|
||||
CapstoneTokenizer::SingleToken mHighlightToken;
|
||||
bool mPermanentHighlightingMode;
|
||||
bool mNoCurrentModuleText;
|
||||
};
|
||||
|
||||
#endif // DISASSEMBLY_H
|
||||
|
|
|
|||
|
|
@ -276,6 +276,7 @@ void CPUDisassembly::setupRightClickContextMenu()
|
|||
copyMenu->addAction(makeShortcutAction(DIcon("copy_address.png"), tr("&Address"), SLOT(copyAddressSlot()), "ActionCopyAddress"));
|
||||
copyMenu->addAction(makeShortcutAction(DIcon("copy_address.png"), tr("&RVA"), SLOT(copyRvaSlot()), "ActionCopyRva"));
|
||||
copyMenu->addAction(makeShortcutAction(DIcon("fileoffset.png"), tr("&File Offset"), SLOT(copyFileOffsetSlot()), "ActionCopyFileOffset"));
|
||||
copyMenu->addAction(makeAction(tr("&Header VA"), SLOT(copyHeaderVaSlot())));
|
||||
copyMenu->addAction(makeAction(DIcon("copy_disassembly.png"), tr("Disassembly"), SLOT(copyDisassemblySlot())));
|
||||
|
||||
copyMenu->addMenu(makeMenu(DIcon("copy_selection.png"), tr("Symbolic Name")), [this](QMenu * menu)
|
||||
|
|
@ -1638,6 +1639,30 @@ void CPUDisassembly::copyFileOffsetSlot()
|
|||
Bridge::CopyToClipboard(clipboard);
|
||||
}
|
||||
|
||||
void CPUDisassembly::copyHeaderVaSlot()
|
||||
{
|
||||
QString clipboard = "";
|
||||
prepareDataRange(getSelectionStart(), getSelectionEnd(), [&](int i, const Instruction_t & inst)
|
||||
{
|
||||
if(i)
|
||||
clipboard += "\r\n";
|
||||
duint addr = rvaToVa(inst.rva);
|
||||
duint base = DbgFunctions()->ModBaseFromAddr(addr);
|
||||
if(base)
|
||||
{
|
||||
auto expr = QString("mod.headerva(0x%1)").arg(ToPtrString(addr));
|
||||
clipboard += ToPtrString(DbgValFromString(expr.toUtf8().constData()));
|
||||
}
|
||||
else
|
||||
{
|
||||
SimpleWarningBox(this, tr("Error!"), tr("Selection not in a module..."));
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
});
|
||||
Bridge::CopyToClipboard(clipboard);
|
||||
}
|
||||
|
||||
void CPUDisassembly::copyDisassemblySlot()
|
||||
{
|
||||
QString clipboardHtml = QString("<div style=\"font-family: %1; font-size: %2px\">").arg(font().family()).arg(getRowHeight());
|
||||
|
|
|
|||
|
|
@ -86,6 +86,7 @@ public slots:
|
|||
void copyAddressSlot();
|
||||
void copyRvaSlot();
|
||||
void copyFileOffsetSlot();
|
||||
void copyHeaderVaSlot();
|
||||
void copyDisassemblySlot();
|
||||
void labelCopySlot();
|
||||
void findCommandSlot();
|
||||
|
|
|
|||
Loading…
Reference in New Issue