mirror of
https://github.com/rizinorg/cutter.git
synced 2024-12-20 20:06:12 +00:00
Added ahb to disasm context menu
This commit is contained in:
parent
b119181757
commit
b229513620
@ -347,6 +347,17 @@ void CutterCore::setImmediateBase(const QString &r2BaseName, RVA offset)
|
||||
emit instructionChanged(offset);
|
||||
}
|
||||
|
||||
void CutterCore::setCurrentBits(int bits, RVA offset)
|
||||
{
|
||||
if (offset == RVA_INVALID)
|
||||
{
|
||||
offset = getOffset();
|
||||
}
|
||||
|
||||
this->cmd("ahb " + QString::number(bits) + " @ " + QString::number(offset));
|
||||
emit instructionChanged(offset);
|
||||
}
|
||||
|
||||
void CutterCore::seek(ut64 offset)
|
||||
{
|
||||
// Slower than using the API, but the API is not complete
|
||||
|
@ -258,6 +258,7 @@ public:
|
||||
void delComment(RVA addr);
|
||||
|
||||
void setImmediateBase(const QString &r2BaseName, RVA offset = RVA_INVALID);
|
||||
void setCurrentBits(int bits, RVA offset = RVA_INVALID);
|
||||
|
||||
bool loadFile(QString path, uint64_t loadaddr = 0LL, uint64_t mapaddr = 0LL, bool rw = false, int va = 0, int idx = 0, bool loadbin = false, const QString &forceBinPlugin = nullptr);
|
||||
bool tryFile(QString path, bool rw);
|
||||
|
@ -29,7 +29,10 @@ DisassemblyContextMenu::DisassemblyContextMenu(QWidget *parent)
|
||||
actionSetBasePort(this),
|
||||
actionSetBaseIPAddr(this),
|
||||
actionSetBaseSyscall(this),
|
||||
actionSetBaseString(this)
|
||||
actionSetBaseString(this),
|
||||
actionSetBits16(this),
|
||||
actionSetBits32(this),
|
||||
actionSetBits64(this)
|
||||
{
|
||||
createAction(&actionCopy, tr("Copy"), getCopySequence(), SLOT(on_actionCopy_triggered()));
|
||||
copySeparator = addSeparator();
|
||||
@ -61,6 +64,16 @@ DisassemblyContextMenu::DisassemblyContextMenu(QWidget *parent)
|
||||
setBaseMenu->addAction(&actionSetBaseSyscall);
|
||||
actionSetBaseString.setText(tr("String"));
|
||||
setBaseMenu->addAction(&actionSetBaseString);
|
||||
|
||||
setBitsMenu = new QMenu(tr("Set current bits to..."), this);
|
||||
setBitsMenuAction = addMenu(setBitsMenu);
|
||||
actionSetBits16.setText("16");
|
||||
setBitsMenu->addAction(&actionSetBits16);
|
||||
actionSetBits32.setText("32");
|
||||
setBitsMenu->addAction(&actionSetBits32);
|
||||
actionSetBits64.setText("64");
|
||||
setBitsMenu->addAction(&actionSetBits64);
|
||||
|
||||
addSeparator();
|
||||
createAction(&actionXRefs, tr("Show X-Refs"), getXRefSequence(), SLOT(on_actionXRefs_triggered()));
|
||||
createAction(&actionDisplayOptions, tr("Show Options"), getDisplayOptionsSequence(), SLOT(on_actionDisplayOptions_triggered()));
|
||||
@ -74,6 +87,10 @@ DisassemblyContextMenu::DisassemblyContextMenu(QWidget *parent)
|
||||
connect(&actionSetBaseSyscall, SIGNAL(triggered(bool)), this, SLOT(on_actionSetBaseSyscall_triggered()));
|
||||
connect(&actionSetBaseString, SIGNAL(triggered(bool)), this, SLOT(on_actionSetBaseString_triggered()));
|
||||
|
||||
connect(&actionSetBits16, SIGNAL(triggered(bool)), this, SLOT(on_actionSetBits16_triggered()));
|
||||
connect(&actionSetBits32, SIGNAL(triggered(bool)), this, SLOT(on_actionSetBits32_triggered()));
|
||||
connect(&actionSetBits64, SIGNAL(triggered(bool)), this, SLOT(on_actionSetBits64_triggered()));
|
||||
|
||||
connect(this, SIGNAL(aboutToShow()), this, SLOT(aboutToShowSlot()));
|
||||
}
|
||||
|
||||
@ -102,6 +119,7 @@ void DisassemblyContextMenu::aboutToShowSlot()
|
||||
auto keys = instObject.keys();
|
||||
bool immBase = keys.contains("val") || keys.contains("ptr");
|
||||
setBaseMenuAction->setVisible(immBase);
|
||||
setBitsMenuAction->setVisible(true);
|
||||
|
||||
actionCreateFunction.setVisible(true);
|
||||
|
||||
@ -411,6 +429,21 @@ void DisassemblyContextMenu::on_actionSetBaseString_triggered()
|
||||
Core()->setImmediateBase("s", offset);
|
||||
}
|
||||
|
||||
void DisassemblyContextMenu::on_actionSetBits16_triggered()
|
||||
{
|
||||
Core()->setCurrentBits(16, offset);
|
||||
}
|
||||
|
||||
void DisassemblyContextMenu::on_actionSetBits32_triggered()
|
||||
{
|
||||
Core()->setCurrentBits(32, offset);
|
||||
}
|
||||
|
||||
void DisassemblyContextMenu::on_actionSetBits64_triggered()
|
||||
{
|
||||
Core()->setCurrentBits(64, offset);
|
||||
}
|
||||
|
||||
void DisassemblyContextMenu::createAction(QString name, QKeySequence keySequence, const char *slot)
|
||||
{
|
||||
QAction *action = new QAction(this);
|
||||
|
@ -46,6 +46,10 @@ private slots:
|
||||
void on_actionSetBaseSyscall_triggered();
|
||||
void on_actionSetBaseString_triggered();
|
||||
|
||||
void on_actionSetBits16_triggered();
|
||||
void on_actionSetBits32_triggered();
|
||||
void on_actionSetBits64_triggered();
|
||||
|
||||
private:
|
||||
QKeySequence getCopySequence() const;
|
||||
QKeySequence getCommentSequence() const;
|
||||
@ -88,6 +92,12 @@ private:
|
||||
QAction actionSetBaseSyscall;
|
||||
QAction actionSetBaseString;
|
||||
|
||||
QMenu *setBitsMenu;
|
||||
QAction *setBitsMenuAction;
|
||||
QAction actionSetBits16;
|
||||
QAction actionSetBits32;
|
||||
QAction actionSetBits64;
|
||||
|
||||
// For creating anonymous entries (that are always visible)
|
||||
void createAction(QString name, QKeySequence keySequence, const char *slot);
|
||||
void createAction(QAction *action, QString name, QKeySequence keySequence, const char *slot);
|
||||
|
Loading…
Reference in New Issue
Block a user