Added option to Nop instructions (#355)

This commit is contained in:
fcasal 2018-03-05 14:20:55 +00:00 committed by xarkes
parent 4a8352169b
commit fa7da352cf
4 changed files with 19 additions and 0 deletions

View File

@ -329,6 +329,12 @@ void CutterCore::editInstruction(RVA addr, const QString &inst)
emit instructionChanged(addr);
}
void CutterCore::nopInstruction(RVA addr)
{
cmd("wao nop @ " + RAddressString(addr));
emit instructionChanged(addr);
}
void CutterCore::editBytes(RVA addr, const QString &bytes)
{
cmd("wx " + bytes + " @ " + RAddressString(addr));

View File

@ -262,6 +262,8 @@ public:
void delFlag(RVA addr);
void editInstruction(RVA addr, const QString &inst);
void nopInstruction(RVA addr);
void editBytes(RVA addr, const QString &inst);
void setComment(RVA addr, const QString &cmt);

View File

@ -14,6 +14,7 @@ DisassemblyContextMenu::DisassemblyContextMenu(QWidget *parent)
offset(0),
canCopy(false),
actionEditInstruction(this),
actionNopInstruction(this),
actionEditBytes(this),
actionCopy(this),
actionAddComment(this),
@ -87,10 +88,13 @@ DisassemblyContextMenu::DisassemblyContextMenu(QWidget *parent)
editMenuAction = addMenu(editMenu);
actionEditInstruction.setText(tr("Instruction"));
editMenu->addAction(&actionEditInstruction);
actionNopInstruction.setText(tr("Nop Instruction"));
editMenu->addAction(&actionNopInstruction);
actionEditBytes.setText(tr("Bytes"));
editMenu->addAction(&actionEditBytes);
connect(&actionEditInstruction, SIGNAL(triggered(bool)), this, SLOT(on_actionEditInstruction_triggered()));
connect(&actionNopInstruction, SIGNAL(triggered(bool)), this, SLOT(on_actionNopInstruction_triggered()));
connect(&actionEditBytes, SIGNAL(triggered(bool)), this, SLOT(on_actionEditBytes_triggered()));
connect(&actionSetBaseBinary, SIGNAL(triggered(bool)), this, SLOT(on_actionSetBaseBinary_triggered()));
@ -253,6 +257,11 @@ void DisassemblyContextMenu::on_actionEditInstruction_triggered()
}
}
void DisassemblyContextMenu::on_actionNopInstruction_triggered()
{
Core()->nopInstruction(offset);
}
void DisassemblyContextMenu::on_actionEditBytes_triggered()
{
EditInstructionDialog *e = new EditInstructionDialog(this);

View File

@ -24,6 +24,7 @@ private slots:
void aboutToShowSlot();
void on_actionEditInstruction_triggered();
void on_actionNopInstruction_triggered();
void on_actionEditBytes_triggered();
void on_actionCopy_triggered();
@ -70,6 +71,7 @@ private:
QMenu *editMenu;
QAction *editMenuAction;
QAction actionEditInstruction;
QAction actionNopInstruction;
QAction actionEditBytes;
QAction actionCopy;