mirror of
https://github.com/rizinorg/cutter.git
synced 2025-01-19 02:48:49 +00:00
Added option to break esil execution on invalid instructions (#597)
* Added option to break esil execution on invalid instructions * update r2
This commit is contained in:
parent
4424c3c45d
commit
94f417c1ff
2
radare2
2
radare2
@ -1 +1 @@
|
||||
Subproject commit f260195ad5c3ac3e02768ff48670cd2e4780a4c9
|
||||
Subproject commit 3e55b5f57d3d8eb2c38e681f125e7b9517191fde
|
@ -645,6 +645,14 @@ QString CutterCore::cmdFunctionAt(RVA addr)
|
||||
return cmdFunctionAt(QString::number(addr));
|
||||
}
|
||||
|
||||
void CutterCore::cmdEsil(QString command)
|
||||
{
|
||||
QString res = cmd(command);
|
||||
if (res.contains("[ESIL] Stopped execution in an invalid instruction")) {
|
||||
msgBox.showMessage("Stopped when attempted to run an invalid instruction. You can disable this in Preferences");
|
||||
}
|
||||
}
|
||||
|
||||
QString CutterCore::createFunctionAt(RVA addr, QString name)
|
||||
{
|
||||
name.remove(QRegExp("[^a-zA-Z0-9_]"));
|
||||
@ -905,7 +913,7 @@ void CutterCore::continueUntilDebug(QString offset)
|
||||
if (!currentlyEmulating) {
|
||||
cmd("dcu " + offset);
|
||||
} else {
|
||||
cmd("aecu " + offset);
|
||||
cmdEsil("aecu " + offset);
|
||||
}
|
||||
emit registersChanged();
|
||||
emit refreshCodeViews();
|
||||
@ -926,7 +934,7 @@ void CutterCore::continueUntilSyscall()
|
||||
{
|
||||
if (currentlyDebugging) {
|
||||
if (currentlyEmulating) {
|
||||
cmd("aecs");
|
||||
cmdEsil("aecs");
|
||||
} else {
|
||||
cmd("dcs");
|
||||
}
|
||||
@ -939,7 +947,7 @@ void CutterCore::continueUntilSyscall()
|
||||
void CutterCore::stepDebug()
|
||||
{
|
||||
if (currentlyDebugging) {
|
||||
cmd("ds");
|
||||
cmdEsil("ds");
|
||||
QString programCounterValue = cmd("dr?`drn PC`").trimmed();
|
||||
seek(programCounterValue);
|
||||
emit registersChanged();
|
||||
@ -949,7 +957,7 @@ void CutterCore::stepDebug()
|
||||
void CutterCore::stepOverDebug()
|
||||
{
|
||||
if (currentlyDebugging) {
|
||||
cmd("dso");
|
||||
cmdEsil("dso");
|
||||
QString programCounterValue = cmd("dr?`drn PC`").trimmed();
|
||||
seek(programCounterValue);
|
||||
emit registersChanged();
|
||||
|
@ -15,6 +15,7 @@
|
||||
#include <QStringList>
|
||||
#include <QMessageBox>
|
||||
#include <QJsonDocument>
|
||||
#include <QErrorMessage>
|
||||
|
||||
#define HAVE_LATEST_LIBR2 false
|
||||
|
||||
@ -385,6 +386,7 @@ public:
|
||||
}
|
||||
QString cmdTask(const QString &str);
|
||||
QJsonDocument cmdjTask(const QString &str);
|
||||
void cmdEsil(QString command);
|
||||
QString getVersionInformation();
|
||||
|
||||
QJsonDocument parseJson(const char *res, const QString &cmd = QString());
|
||||
@ -641,6 +643,7 @@ private:
|
||||
RCore *core_;
|
||||
AsyncTaskManager *asyncTaskManager;
|
||||
RVA offsetPriorDebugging = RVA_INVALID;
|
||||
QErrorMessage msgBox;
|
||||
|
||||
QList<CutterPlugin*> plugins;
|
||||
};
|
||||
|
@ -10,10 +10,11 @@
|
||||
#include "utils/Helpers.h"
|
||||
#include "utils/Configuration.h"
|
||||
|
||||
DebugOptionsWidget::DebugOptionsWidget(PreferencesDialog */*dialog*/, QWidget *parent)
|
||||
DebugOptionsWidget::DebugOptionsWidget(PreferencesDialog *dialog, QWidget *parent)
|
||||
: QDialog(parent),
|
||||
ui(new Ui::DebugOptionsWidget)
|
||||
{
|
||||
Q_UNUSED(dialog);
|
||||
ui->setupUi(this);
|
||||
|
||||
updateDebugPlugin();
|
||||
@ -23,6 +24,7 @@ DebugOptionsWidget::~DebugOptionsWidget() {}
|
||||
|
||||
void DebugOptionsWidget::updateDebugPlugin()
|
||||
{
|
||||
ui->esilBreakOnInvalid->setChecked(Config()->getConfigBool("esil.breakoninvalid"));
|
||||
disconnect(ui->pluginComboBox, SIGNAL(currentIndexChanged(const QString &)), this,
|
||||
SLOT(on_pluginComboBox_currentIndexChanged(const QString &)));
|
||||
|
||||
@ -76,3 +78,8 @@ void DebugOptionsWidget::updateStackAddr()
|
||||
Core()->setConfig("esil.stack.addr", newAddr);
|
||||
ui->stackAddr->setPlaceholderText(newAddr);
|
||||
}
|
||||
|
||||
void DebugOptionsWidget::on_esilBreakOnInvalid_toggled(bool checked)
|
||||
{
|
||||
Config()->setConfig("esil.breakoninvalid", checked);
|
||||
}
|
||||
|
@ -28,4 +28,5 @@ private slots:
|
||||
void updateStackAddr();
|
||||
void updateStackSize();
|
||||
void on_pluginComboBox_currentIndexChanged(const QString &index);
|
||||
void on_esilBreakOnInvalid_toggled(bool checked);
|
||||
};
|
||||
|
@ -103,6 +103,13 @@
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="4" column="0">
|
||||
<widget class="QCheckBox" name="esilBreakOnInvalid">
|
||||
<property name="text">
|
||||
<string>Break esil execution when instruction is invalid (esil.breakoninvalid)</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
|
@ -36,7 +36,8 @@ static const QHash<QString, QVariant> asmOptions = {
|
||||
{ "asm.var.sub", true },
|
||||
{ "asm.var.subonly", true },
|
||||
{ "asm.tabs", 5 },
|
||||
{ "asm.tabs.off", 5 }
|
||||
{ "asm.tabs.off", 5 },
|
||||
{ "esil.breakoninvalid", true }
|
||||
};
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user