mirror of
https://github.com/rizinorg/cutter.git
synced 2025-02-22 06:33:46 +00:00
Add more shortcuts to DisassemblyContextMenu (#1782)
This commit is contained in:
parent
d1d1f97592
commit
2d34eb286a
@ -33,6 +33,7 @@ Widget shortcuts
|
|||||||
|
|
||||||
Disassembly view shortcuts
|
Disassembly view shortcuts
|
||||||
--------------------------
|
--------------------------
|
||||||
|
*Most of these shortcuts are also applied to Disassembly Graph view*
|
||||||
|
|
||||||
+------------+----------------------------------+
|
+------------+----------------------------------+
|
||||||
| Shortcut | Function |
|
| Shortcut | Function |
|
||||||
@ -45,10 +46,24 @@ Disassembly view shortcuts
|
|||||||
+------------+----------------------------------+
|
+------------+----------------------------------+
|
||||||
| ; | Add comment |
|
| ; | Add comment |
|
||||||
+------------+----------------------------------+
|
+------------+----------------------------------+
|
||||||
|
| P | Define a new function |
|
||||||
|
+------------+----------------------------------+
|
||||||
|
| Shift+P | Edit function |
|
||||||
|
+------------+----------------------------------+
|
||||||
|
| U | Undefine a function |
|
||||||
|
+------------+----------------------------------+
|
||||||
| N | Rename current function/flag |
|
| N | Rename current function/flag |
|
||||||
+------------+----------------------------------+
|
+------------+----------------------------------+
|
||||||
| Shift+N | Rename flag/function used here |
|
| Shift+N | Rename flag/function used here |
|
||||||
+------------+----------------------------------+
|
+------------+----------------------------------+
|
||||||
|
| Y | Edit\rename local variables |
|
||||||
|
+------------+----------------------------------+
|
||||||
|
| L | Link a type\struct to address |
|
||||||
|
+------------+----------------------------------+
|
||||||
|
| A | Set current address to String |
|
||||||
|
+------------+----------------------------------+
|
||||||
|
| C | Set current address to Code |
|
||||||
|
+------------+----------------------------------+
|
||||||
| X | Show Xrefs |
|
| X | Show Xrefs |
|
||||||
+------------+----------------------------------+
|
+------------+----------------------------------+
|
||||||
| \+ | Zoom in |
|
| \+ | Zoom in |
|
||||||
|
@ -943,6 +943,13 @@ void CutterCore::cmdEsil(const char *command)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QString CutterCore::createFunctionAt(RVA addr)
|
||||||
|
{
|
||||||
|
QString ret = cmd("af " + RAddressString(addr));
|
||||||
|
emit functionsChanged();
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
QString CutterCore::createFunctionAt(RVA addr, QString name)
|
QString CutterCore::createFunctionAt(RVA addr, QString name)
|
||||||
{
|
{
|
||||||
static const QRegExp regExp("[^a-zA-Z0-9_]");
|
static const QRegExp regExp("[^a-zA-Z0-9_]");
|
||||||
|
@ -76,6 +76,7 @@ public:
|
|||||||
RVA getLastFunctionInstruction(RVA addr);
|
RVA getLastFunctionInstruction(RVA addr);
|
||||||
QString cmdFunctionAt(QString addr);
|
QString cmdFunctionAt(QString addr);
|
||||||
QString cmdFunctionAt(RVA addr);
|
QString cmdFunctionAt(RVA addr);
|
||||||
|
QString createFunctionAt(RVA addr);
|
||||||
QString createFunctionAt(RVA addr, QString name);
|
QString createFunctionAt(RVA addr, QString name);
|
||||||
QStringList getDisassemblyPreview(RVA address, int num_of_lines);
|
QStringList getDisassemblyPreview(RVA address, int num_of_lines);
|
||||||
|
|
||||||
|
@ -49,7 +49,7 @@ DisassemblyContextMenu::DisassemblyContextMenu(QWidget *parent, MainWindow *main
|
|||||||
addAction(&actionRename);
|
addAction(&actionRename);
|
||||||
|
|
||||||
initAction(&actionEditFunction, tr("Edit function"),
|
initAction(&actionEditFunction, tr("Edit function"),
|
||||||
SLOT(on_actionEditFunction_triggered()));
|
SLOT(on_actionEditFunction_triggered()), getEditFunctionSequence());
|
||||||
addAction(&actionEditFunction);
|
addAction(&actionEditFunction);
|
||||||
|
|
||||||
initAction(&actionRenameUsedHere, tr("Rename Flag/Fcn/Var Used Here"),
|
initAction(&actionRenameUsedHere, tr("Rename Flag/Fcn/Var Used Here"),
|
||||||
@ -67,11 +67,11 @@ DisassemblyContextMenu::DisassemblyContextMenu(QWidget *parent, MainWindow *main
|
|||||||
addAction(&actionDeleteFlag);
|
addAction(&actionDeleteFlag);
|
||||||
|
|
||||||
initAction(&actionDeleteFunction, tr("Undefine function"),
|
initAction(&actionDeleteFunction, tr("Undefine function"),
|
||||||
SLOT(on_actionDeleteFunction_triggered()));
|
SLOT(on_actionDeleteFunction_triggered()), getUndefineFunctionSequence());
|
||||||
addAction(&actionDeleteFunction);
|
addAction(&actionDeleteFunction);
|
||||||
|
|
||||||
initAction(&actionAnalyzeFunction, tr("Define function here"),
|
initAction(&actionAnalyzeFunction, tr("Define function here"),
|
||||||
SLOT(on_actionAnalyzeFunction_triggered()));
|
SLOT(on_actionAnalyzeFunction_triggered()), getDefineNewFunctionSequence());
|
||||||
addAction(&actionAnalyzeFunction);
|
addAction(&actionAnalyzeFunction);
|
||||||
|
|
||||||
addSeparator();
|
addSeparator();
|
||||||
@ -530,6 +530,22 @@ QList<QKeySequence> DisassemblyContextMenu::getAddBPSequence() const
|
|||||||
return {Qt::Key_F2, Qt::CTRL + Qt::Key_B};
|
return {Qt::Key_F2, Qt::CTRL + Qt::Key_B};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QKeySequence DisassemblyContextMenu::getDefineNewFunctionSequence() const
|
||||||
|
{
|
||||||
|
return {Qt::Key_P};
|
||||||
|
}
|
||||||
|
|
||||||
|
QKeySequence DisassemblyContextMenu::getEditFunctionSequence() const
|
||||||
|
{
|
||||||
|
return {Qt::SHIFT + Qt::Key_P};
|
||||||
|
}
|
||||||
|
|
||||||
|
QKeySequence DisassemblyContextMenu::getUndefineFunctionSequence() const
|
||||||
|
{
|
||||||
|
return {Qt::Key_U};
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void DisassemblyContextMenu::on_actionEditInstruction_triggered()
|
void DisassemblyContextMenu::on_actionEditInstruction_triggered()
|
||||||
{
|
{
|
||||||
EditInstructionDialog e(EDIT_TEXT, this);
|
EditInstructionDialog e(EDIT_TEXT, this);
|
||||||
|
@ -90,6 +90,9 @@ private:
|
|||||||
QKeySequence getRetypeSequence() const;
|
QKeySequence getRetypeSequence() const;
|
||||||
QKeySequence getXRefSequence() const;
|
QKeySequence getXRefSequence() const;
|
||||||
QKeySequence getDisplayOptionsSequence() const;
|
QKeySequence getDisplayOptionsSequence() const;
|
||||||
|
QKeySequence getDefineNewFunctionSequence() const;
|
||||||
|
QKeySequence getUndefineFunctionSequence() const;
|
||||||
|
QKeySequence getEditFunctionSequence() const;
|
||||||
QList<QKeySequence> getAddBPSequence() const;
|
QList<QKeySequence> getAddBPSequence() const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
Reference in New Issue
Block a user