mirror of
https://github.com/rizinorg/cutter.git
synced 2024-12-24 05:45:27 +00:00
Use cmdRaw and cmdRawAt in DisassemblyContextMenu
This commit is contained in:
parent
1f41983923
commit
34e2cdf960
@ -460,10 +460,11 @@ void DisassemblyContextMenu::aboutToShowSlot()
|
|||||||
actionAnalyzeFunction.setVisible(true);
|
actionAnalyzeFunction.setVisible(true);
|
||||||
|
|
||||||
// Show the option to remove a defined string only if a string is defined in this address
|
// Show the option to remove a defined string only if a string is defined in this address
|
||||||
QString stringDefinition = Core()->cmd("Cs. @ " + RAddressString(offset));
|
QString stringDefinition = Core()->cmdRawAt("Cs.", offset);
|
||||||
actionSetAsStringRemove.setVisible(!stringDefinition.isEmpty());
|
actionSetAsStringRemove.setVisible(!stringDefinition.isEmpty());
|
||||||
|
|
||||||
QString comment = Core()->cmd("CC." + RAddressString(offset));
|
QString comment = Core()->cmdRawAt("CC.", offset);
|
||||||
|
|
||||||
if (comment.isNull() || comment.isEmpty()) {
|
if (comment.isNull() || comment.isEmpty()) {
|
||||||
actionDeleteComment.setVisible(false);
|
actionDeleteComment.setVisible(false);
|
||||||
actionAddComment.setText(tr("Add Comment"));
|
actionAddComment.setText(tr("Add Comment"));
|
||||||
@ -841,7 +842,7 @@ void DisassemblyContextMenu::on_actionRenameUsedHere_triggered()
|
|||||||
if (dialog.exec()) {
|
if (dialog.exec()) {
|
||||||
QString newName = dialog.getName().trimmed();
|
QString newName = dialog.getName().trimmed();
|
||||||
if (!newName.isEmpty()) {
|
if (!newName.isEmpty()) {
|
||||||
Core()->cmd("an " + newName + " @ " + QString::number(offset));
|
Core()->cmdRawAt(QString("an %1").arg(newName), offset);
|
||||||
|
|
||||||
if (type == ThingUsedHere::Type::Address || type == ThingUsedHere::Type::Flag) {
|
if (type == ThingUsedHere::Type::Address || type == ThingUsedHere::Type::Flag) {
|
||||||
Core()->triggerFlagsChanged();
|
Core()->triggerFlagsChanged();
|
||||||
@ -1006,7 +1007,7 @@ void DisassemblyContextMenu::on_actionEditFunction_triggered()
|
|||||||
stackSizeText.sprintf("%d", fcn->stack);
|
stackSizeText.sprintf("%d", fcn->stack);
|
||||||
dialog.setStackSizeText(stackSizeText);
|
dialog.setStackSizeText(stackSizeText);
|
||||||
|
|
||||||
QStringList callConList = Core()->cmd("afcl").split("\n");
|
QStringList callConList = Core()->cmdRaw("afcl").split("\n");
|
||||||
callConList.removeLast();
|
callConList.removeLast();
|
||||||
dialog.setCallConList(callConList);
|
dialog.setCallConList(callConList);
|
||||||
dialog.setCallConSelected(fcn->cc);
|
dialog.setCallConSelected(fcn->cc);
|
||||||
@ -1019,7 +1020,7 @@ void DisassemblyContextMenu::on_actionEditFunction_triggered()
|
|||||||
fcn->addr = Core()->math(new_start_addr);
|
fcn->addr = Core()->math(new_start_addr);
|
||||||
QString new_stack_size = dialog.getStackSizeText();
|
QString new_stack_size = dialog.getStackSizeText();
|
||||||
fcn->stack = int(Core()->math(new_stack_size));
|
fcn->stack = int(Core()->math(new_stack_size));
|
||||||
Core()->cmd("afc " + dialog.getCallConSelected());
|
Core()->cmdRaw("afc " + dialog.getCallConSelected());
|
||||||
emit Core()->functionsChanged();
|
emit Core()->functionsChanged();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -62,6 +62,8 @@ void CutterSamplePluginWidget::on_seekChanged(RVA addr)
|
|||||||
void CutterSamplePluginWidget::on_buttonClicked()
|
void CutterSamplePluginWidget::on_buttonClicked()
|
||||||
{
|
{
|
||||||
QString fortune = Core()->cmd("fo").replace("\n", "");
|
QString fortune = Core()->cmd("fo").replace("\n", "");
|
||||||
|
// cmdRaw can be used to execute single raw commands
|
||||||
|
// this is especially good for user-controlled input
|
||||||
QString res = Core()->cmdRaw("?E " + fortune);
|
QString res = Core()->cmdRaw("?E " + fortune);
|
||||||
text->setText(res);
|
text->setText(res);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user