mirror of
https://github.com/rizinorg/cutter.git
synced 2024-12-19 19:36:11 +00:00
Implement Set As String (#940)
This commit is contained in:
parent
1dc636a325
commit
b17656632c
@ -399,6 +399,12 @@ void CutterCore::setToCode(RVA addr)
|
||||
emit instructionChanged(addr);
|
||||
}
|
||||
|
||||
void CutterCore::setAsString(RVA addr)
|
||||
{
|
||||
cmd("Cs @ " + RAddressString(addr));
|
||||
emit instructionChanged(addr);
|
||||
}
|
||||
|
||||
void CutterCore::setToData(RVA addr, int size, int repeat)
|
||||
{
|
||||
if (size <= 0 || repeat <= 0) {
|
||||
|
@ -423,6 +423,7 @@ public:
|
||||
|
||||
/* Code/Data */
|
||||
void setToCode(RVA addr);
|
||||
void setAsString(RVA addr);
|
||||
void setToData(RVA addr, int size, int repeat = 1);
|
||||
int sizeofDataMeta(RVA addr);
|
||||
|
||||
|
@ -70,10 +70,14 @@ DisassemblyContextMenu::DisassemblyContextMenu(QWidget *parent)
|
||||
|
||||
addSetBitsMenu();
|
||||
|
||||
initAction(&actionSetToCode, tr("Set to Code"),
|
||||
initAction(&actionSetToCode, tr("Set as Code"),
|
||||
SLOT(on_actionSetToCode_triggered()), getSetToCodeSequence());
|
||||
addAction(&actionSetToCode);
|
||||
|
||||
initAction(&actionSetAsString, tr("Set as String"),
|
||||
SLOT(on_actionSetAsString_triggered()), getSetAsStringSequence());
|
||||
addAction(&actionSetAsString);
|
||||
|
||||
addSetToDataMenu();
|
||||
|
||||
addSeparator();
|
||||
@ -330,6 +334,12 @@ QKeySequence DisassemblyContextMenu::getSetToCodeSequence() const
|
||||
return {Qt::Key_C};
|
||||
}
|
||||
|
||||
QKeySequence DisassemblyContextMenu::getSetAsStringSequence() const
|
||||
{
|
||||
return {Qt::Key_A};
|
||||
}
|
||||
|
||||
|
||||
QKeySequence DisassemblyContextMenu::getSetToDataSequence() const
|
||||
{
|
||||
return {Qt::Key_D};
|
||||
@ -664,6 +674,12 @@ void DisassemblyContextMenu::on_actionSetToCode_triggered()
|
||||
Core()->setToCode(offset);
|
||||
}
|
||||
|
||||
void DisassemblyContextMenu::on_actionSetAsString_triggered()
|
||||
{
|
||||
Core()->setAsString(offset);
|
||||
}
|
||||
|
||||
|
||||
void DisassemblyContextMenu::on_actionSetToData_triggered()
|
||||
{
|
||||
int size = Core()->sizeofDataMeta(offset);
|
||||
|
@ -51,6 +51,7 @@ private slots:
|
||||
void on_actionSetPC_triggered();
|
||||
|
||||
void on_actionSetToCode_triggered();
|
||||
void on_actionSetAsString_triggered();
|
||||
void on_actionSetToData_triggered();
|
||||
void on_actionSetToDataEx_triggered();
|
||||
|
||||
@ -58,6 +59,7 @@ private:
|
||||
QKeySequence getCopySequence() const;
|
||||
QKeySequence getCommentSequence() const;
|
||||
QKeySequence getSetToCodeSequence() const;
|
||||
QKeySequence getSetAsStringSequence() const;
|
||||
QKeySequence getSetToDataSequence() const;
|
||||
QKeySequence getSetToDataExSequence() const;
|
||||
QKeySequence getAddFlagSequence() const;
|
||||
@ -119,6 +121,7 @@ private:
|
||||
QAction actionSetPC;
|
||||
|
||||
QAction actionSetToCode;
|
||||
QAction actionSetAsString;
|
||||
|
||||
QMenu *setToDataMenu;
|
||||
QAction actionSetToDataEx;
|
||||
|
Loading…
Reference in New Issue
Block a user