diff --git a/src/Cutter.cpp b/src/Cutter.cpp index 4c60e938..905c0a8e 100644 --- a/src/Cutter.cpp +++ b/src/Cutter.cpp @@ -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)); diff --git a/src/Cutter.h b/src/Cutter.h index 5c7b7e12..d41f37e0 100644 --- a/src/Cutter.h +++ b/src/Cutter.h @@ -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); diff --git a/src/menus/DisassemblyContextMenu.cpp b/src/menus/DisassemblyContextMenu.cpp index ff9b1096..8564516c 100644 --- a/src/menus/DisassemblyContextMenu.cpp +++ b/src/menus/DisassemblyContextMenu.cpp @@ -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); diff --git a/src/menus/DisassemblyContextMenu.h b/src/menus/DisassemblyContextMenu.h index 693ad1e9..4c3e3dfc 100644 --- a/src/menus/DisassemblyContextMenu.h +++ b/src/menus/DisassemblyContextMenu.h @@ -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;