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