mirror of
https://github.com/rizinorg/cutter.git
synced 2024-12-21 04:16:12 +00:00
Added option to Nop instructions (#355)
This commit is contained in:
parent
4a8352169b
commit
fa7da352cf
@ -329,6 +329,12 @@ void CutterCore::editInstruction(RVA addr, const QString &inst)
|
|||||||
emit instructionChanged(addr);
|
emit instructionChanged(addr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CutterCore::nopInstruction(RVA addr)
|
||||||
|
{
|
||||||
|
cmd("wao nop @ " + RAddressString(addr));
|
||||||
|
emit instructionChanged(addr);
|
||||||
|
}
|
||||||
|
|
||||||
void CutterCore::editBytes(RVA addr, const QString &bytes)
|
void CutterCore::editBytes(RVA addr, const QString &bytes)
|
||||||
{
|
{
|
||||||
cmd("wx " + bytes + " @ " + RAddressString(addr));
|
cmd("wx " + bytes + " @ " + RAddressString(addr));
|
||||||
|
@ -262,6 +262,8 @@ public:
|
|||||||
void delFlag(RVA addr);
|
void delFlag(RVA addr);
|
||||||
|
|
||||||
void editInstruction(RVA addr, const QString &inst);
|
void editInstruction(RVA addr, const QString &inst);
|
||||||
|
void nopInstruction(RVA addr);
|
||||||
|
|
||||||
void editBytes(RVA addr, const QString &inst);
|
void editBytes(RVA addr, const QString &inst);
|
||||||
|
|
||||||
void setComment(RVA addr, const QString &cmt);
|
void setComment(RVA addr, const QString &cmt);
|
||||||
|
@ -14,6 +14,7 @@ DisassemblyContextMenu::DisassemblyContextMenu(QWidget *parent)
|
|||||||
offset(0),
|
offset(0),
|
||||||
canCopy(false),
|
canCopy(false),
|
||||||
actionEditInstruction(this),
|
actionEditInstruction(this),
|
||||||
|
actionNopInstruction(this),
|
||||||
actionEditBytes(this),
|
actionEditBytes(this),
|
||||||
actionCopy(this),
|
actionCopy(this),
|
||||||
actionAddComment(this),
|
actionAddComment(this),
|
||||||
@ -87,10 +88,13 @@ DisassemblyContextMenu::DisassemblyContextMenu(QWidget *parent)
|
|||||||
editMenuAction = addMenu(editMenu);
|
editMenuAction = addMenu(editMenu);
|
||||||
actionEditInstruction.setText(tr("Instruction"));
|
actionEditInstruction.setText(tr("Instruction"));
|
||||||
editMenu->addAction(&actionEditInstruction);
|
editMenu->addAction(&actionEditInstruction);
|
||||||
|
actionNopInstruction.setText(tr("Nop Instruction"));
|
||||||
|
editMenu->addAction(&actionNopInstruction);
|
||||||
actionEditBytes.setText(tr("Bytes"));
|
actionEditBytes.setText(tr("Bytes"));
|
||||||
editMenu->addAction(&actionEditBytes);
|
editMenu->addAction(&actionEditBytes);
|
||||||
|
|
||||||
connect(&actionEditInstruction, SIGNAL(triggered(bool)), this, SLOT(on_actionEditInstruction_triggered()));
|
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(&actionEditBytes, SIGNAL(triggered(bool)), this, SLOT(on_actionEditBytes_triggered()));
|
||||||
|
|
||||||
connect(&actionSetBaseBinary, SIGNAL(triggered(bool)), this, SLOT(on_actionSetBaseBinary_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()
|
void DisassemblyContextMenu::on_actionEditBytes_triggered()
|
||||||
{
|
{
|
||||||
EditInstructionDialog *e = new EditInstructionDialog(this);
|
EditInstructionDialog *e = new EditInstructionDialog(this);
|
||||||
|
@ -24,6 +24,7 @@ private slots:
|
|||||||
void aboutToShowSlot();
|
void aboutToShowSlot();
|
||||||
|
|
||||||
void on_actionEditInstruction_triggered();
|
void on_actionEditInstruction_triggered();
|
||||||
|
void on_actionNopInstruction_triggered();
|
||||||
void on_actionEditBytes_triggered();
|
void on_actionEditBytes_triggered();
|
||||||
|
|
||||||
void on_actionCopy_triggered();
|
void on_actionCopy_triggered();
|
||||||
@ -70,6 +71,7 @@ private:
|
|||||||
QMenu *editMenu;
|
QMenu *editMenu;
|
||||||
QAction *editMenuAction;
|
QAction *editMenuAction;
|
||||||
QAction actionEditInstruction;
|
QAction actionEditInstruction;
|
||||||
|
QAction actionNopInstruction;
|
||||||
QAction actionEditBytes;
|
QAction actionEditBytes;
|
||||||
|
|
||||||
QAction actionCopy;
|
QAction actionCopy;
|
||||||
|
Loading…
Reference in New Issue
Block a user