1
0
Fork 0

GUI: data copy in disassembly

This commit is contained in:
mrexodia 2016-09-09 07:48:54 +02:00
parent a97977e7a8
commit b76cbd89be
No known key found for this signature in database
GPG Key ID: FC89E0AAA0C1AAD8
2 changed files with 14 additions and 0 deletions

View File

@ -20,6 +20,7 @@
#include "XrefBrowseDialog.h" #include "XrefBrowseDialog.h"
#include "SourceViewerManager.h" #include "SourceViewerManager.h"
#include "MiscUtil.h" #include "MiscUtil.h"
#include "DataCopyDialog.h"
CPUDisassembly::CPUDisassembly(CPUWidget* parent) : Disassembly(parent) CPUDisassembly::CPUDisassembly(CPUWidget* parent) : Disassembly(parent)
{ {
@ -237,6 +238,7 @@ void CPUDisassembly::setupRightClickContextMenu()
copyMenu->addAction(makeShortcutAction(DIcon("copy_address.png"), tr("&Address"), SLOT(copyAddressSlot()), "ActionCopyAddress")); copyMenu->addAction(makeShortcutAction(DIcon("copy_address.png"), tr("&Address"), SLOT(copyAddressSlot()), "ActionCopyAddress"));
copyMenu->addAction(makeAction(DIcon("copy_address.png"), tr("&RVA"), SLOT(copyRvaSlot()))); copyMenu->addAction(makeAction(DIcon("copy_address.png"), tr("&RVA"), SLOT(copyRvaSlot())));
copyMenu->addAction(makeAction(DIcon("copy_disassembly.png"), tr("Disassembly"), SLOT(copyDisassemblySlot()))); copyMenu->addAction(makeAction(DIcon("copy_disassembly.png"), tr("Disassembly"), SLOT(copyDisassemblySlot())));
copyMenu->addAction(makeAction(DIcon("data-copy.png"), tr("&Data..."), SLOT(copyDataSlot())));
mMenuBuilder->addMenu(makeMenu(DIcon("copy.png"), tr("&Copy")), copyMenu); mMenuBuilder->addMenu(makeMenu(DIcon("copy.png"), tr("&Copy")), copyMenu);
mMenuBuilder->addAction(makeShortcutAction(DIcon("eraser.png"), tr("&Restore selection"), SLOT(undoSelectionSlot()), "ActionUndoSelection"), [this](QMenu*) mMenuBuilder->addAction(makeShortcutAction(DIcon("eraser.png"), tr("&Restore selection"), SLOT(undoSelectionSlot()), "ActionUndoSelection"), [this](QMenu*)
@ -1412,6 +1414,17 @@ void CPUDisassembly::copyDisassemblySlot()
Bridge::CopyToClipboard(clipboard); Bridge::CopyToClipboard(clipboard);
} }
void CPUDisassembly::copyDataSlot()
{
dsint selStart = getSelectionStart();
dsint selSize = getSelectionEnd() - selStart + 1;
QVector<byte_t> data;
data.resize(selSize);
mMemPage->read(data.data(), selStart, selSize);
DataCopyDialog dataDialog(&data, this);
dataDialog.exec();
}
void CPUDisassembly::findCommandSlot() void CPUDisassembly::findCommandSlot()
{ {
if(!DbgIsDebugging()) if(!DbgIsDebugging())

View File

@ -84,6 +84,7 @@ public slots:
void copyAddressSlot(); void copyAddressSlot();
void copyRvaSlot(); void copyRvaSlot();
void copyDisassemblySlot(); void copyDisassemblySlot();
void copyDataSlot();
void findCommandSlot(); void findCommandSlot();
void openSourceSlot(); void openSourceSlot();
void decompileSelectionSlot(); void decompileSelectionSlot();