mirror of
https://github.com/rizinorg/cutter.git
synced 2024-12-20 11:56:12 +00:00
added debug option to change debug plugin
This commit is contained in:
parent
ffb3903311
commit
ac4751eb4a
@ -818,6 +818,29 @@ void CutterCore::stepOverDebug()
|
|||||||
emit registersChanged();
|
emit registersChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QStringList CutterCore::getDebugPlugins()
|
||||||
|
{
|
||||||
|
QStringList plugins;
|
||||||
|
QJsonArray pluginArray = cmdj("dLj").array();
|
||||||
|
|
||||||
|
for (QJsonValue value : pluginArray) {
|
||||||
|
QJsonObject pluginObject = value.toObject();
|
||||||
|
QString plugin = pluginObject["name"].toString();
|
||||||
|
plugins << plugin;
|
||||||
|
}
|
||||||
|
return plugins;
|
||||||
|
}
|
||||||
|
|
||||||
|
QString CutterCore::getActiveDebugPlugin()
|
||||||
|
{
|
||||||
|
return getConfig("dbg.backend");
|
||||||
|
}
|
||||||
|
|
||||||
|
void CutterCore::setDebugPlugin(QString plugin)
|
||||||
|
{
|
||||||
|
setConfig("dbg.backend", plugin);
|
||||||
|
}
|
||||||
|
|
||||||
void CutterCore::addBreakpoint(RVA addr)
|
void CutterCore::addBreakpoint(RVA addr)
|
||||||
{
|
{
|
||||||
cmd("db " + RAddressString(addr));
|
cmd("db " + RAddressString(addr));
|
||||||
|
@ -477,6 +477,9 @@ public:
|
|||||||
void stepDebug();
|
void stepDebug();
|
||||||
void stepOverDebug();
|
void stepOverDebug();
|
||||||
void addBreakpoint(RVA offset);
|
void addBreakpoint(RVA offset);
|
||||||
|
QString getActiveDebugPlugin();
|
||||||
|
QStringList getDebugPlugins();
|
||||||
|
void setDebugPlugin(QString plugin);
|
||||||
|
|
||||||
RVA getOffsetJump(RVA addr);
|
RVA getOffsetJump(RVA addr);
|
||||||
QString getDecompiledCode(RVA addr);
|
QString getDecompiledCode(RVA addr);
|
||||||
|
@ -177,7 +177,8 @@ SOURCES += \
|
|||||||
utils/ProgressIndicator.cpp \
|
utils/ProgressIndicator.cpp \
|
||||||
utils/R2Task.cpp \
|
utils/R2Task.cpp \
|
||||||
widgets/DebugToolbar.cpp \
|
widgets/DebugToolbar.cpp \
|
||||||
widgets/MemoryMapWidget.cpp
|
widgets/MemoryMapWidget.cpp \
|
||||||
|
dialogs/preferences/DebugOptionsWidget.cpp
|
||||||
|
|
||||||
HEADERS += \
|
HEADERS += \
|
||||||
Cutter.h \
|
Cutter.h \
|
||||||
@ -266,7 +267,8 @@ HEADERS += \
|
|||||||
plugins/CutterPlugin.h \
|
plugins/CutterPlugin.h \
|
||||||
utils/R2Task.h \
|
utils/R2Task.h \
|
||||||
widgets/DebugToolbar.h \
|
widgets/DebugToolbar.h \
|
||||||
widgets/MemoryMapWidget.h
|
widgets/MemoryMapWidget.h \
|
||||||
|
dialogs/preferences/DebugOptionsWidget.h
|
||||||
|
|
||||||
FORMS += \
|
FORMS += \
|
||||||
dialogs/AboutDialog.ui \
|
dialogs/AboutDialog.ui \
|
||||||
@ -315,7 +317,9 @@ FORMS += \
|
|||||||
widgets/RegistersWidget.ui \
|
widgets/RegistersWidget.ui \
|
||||||
widgets/BacktraceWidget.ui \
|
widgets/BacktraceWidget.ui \
|
||||||
dialogs/OpenFileDialog.ui \
|
dialogs/OpenFileDialog.ui \
|
||||||
widgets/MemoryMapWidget.ui
|
widgets/MemoryMapWidget.ui \
|
||||||
|
widgets/MemoryMapWidget.ui \
|
||||||
|
dialogs/preferences/DebugOptionsWidget.ui
|
||||||
|
|
||||||
RESOURCES += \
|
RESOURCES += \
|
||||||
resources.qrc \
|
resources.qrc \
|
||||||
|
42
src/dialogs/preferences/DebugOptionsWidget.cpp
Normal file
42
src/dialogs/preferences/DebugOptionsWidget.cpp
Normal file
@ -0,0 +1,42 @@
|
|||||||
|
#include <QLabel>
|
||||||
|
#include <QFontDialog>
|
||||||
|
|
||||||
|
#include "DebugOptionsWidget.h"
|
||||||
|
#include "ui_DebugOptionsWidget.h"
|
||||||
|
#include <QComboBox>
|
||||||
|
#include "PreferencesDialog.h"
|
||||||
|
|
||||||
|
#include "utils/Helpers.h"
|
||||||
|
#include "utils/Configuration.h"
|
||||||
|
|
||||||
|
DebugOptionsWidget::DebugOptionsWidget(PreferencesDialog */*dialog*/, QWidget *parent)
|
||||||
|
: QDialog(parent),
|
||||||
|
ui(new Ui::DebugOptionsWidget)
|
||||||
|
{
|
||||||
|
ui->setupUi(this);
|
||||||
|
|
||||||
|
updateDebugPlugin();
|
||||||
|
}
|
||||||
|
|
||||||
|
DebugOptionsWidget::~DebugOptionsWidget() {}
|
||||||
|
|
||||||
|
void DebugOptionsWidget::updateDebugPlugin()
|
||||||
|
{
|
||||||
|
disconnect(ui->pluginComboBox, SIGNAL(currentIndexChanged(const QString &)), this,
|
||||||
|
SLOT(on_pluginComboBox_currentIndexChanged(const QString &)));
|
||||||
|
|
||||||
|
QStringList plugins = Core()->getDebugPlugins();
|
||||||
|
for (QString str : plugins)
|
||||||
|
ui->pluginComboBox->addItem(str);
|
||||||
|
|
||||||
|
QString plugin = Core()->getActiveDebugPlugin();
|
||||||
|
ui->pluginComboBox->setCurrentText(plugin);
|
||||||
|
|
||||||
|
connect(ui->pluginComboBox, SIGNAL(currentIndexChanged(const QString &)), this,
|
||||||
|
SLOT(on_pluginComboBox_currentIndexChanged(const QString &)));
|
||||||
|
}
|
||||||
|
|
||||||
|
void DebugOptionsWidget::on_pluginComboBox_currentIndexChanged(const QString &plugin)
|
||||||
|
{
|
||||||
|
Core()->setDebugPlugin(plugin);
|
||||||
|
}
|
29
src/dialogs/preferences/DebugOptionsWidget.h
Normal file
29
src/dialogs/preferences/DebugOptionsWidget.h
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <memory>
|
||||||
|
|
||||||
|
#include "Cutter.h"
|
||||||
|
|
||||||
|
class PreferencesDialog;
|
||||||
|
|
||||||
|
namespace Ui {
|
||||||
|
class DebugOptionsWidget;
|
||||||
|
}
|
||||||
|
|
||||||
|
class DebugOptionsWidget : public QDialog
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
|
public:
|
||||||
|
explicit DebugOptionsWidget(PreferencesDialog *dialog, QWidget *parent = nullptr);
|
||||||
|
~DebugOptionsWidget();
|
||||||
|
|
||||||
|
private:
|
||||||
|
std::unique_ptr<Ui::DebugOptionsWidget> ui;
|
||||||
|
|
||||||
|
private slots:
|
||||||
|
void updateDebugPlugin();
|
||||||
|
|
||||||
|
void on_pluginComboBox_currentIndexChanged(const QString &index);
|
||||||
|
};
|
45
src/dialogs/preferences/DebugOptionsWidget.ui
Normal file
45
src/dialogs/preferences/DebugOptionsWidget.ui
Normal file
@ -0,0 +1,45 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<ui version="4.0">
|
||||||
|
<class>DebugOptionsWidget</class>
|
||||||
|
<widget class="QWidget" name="DebugOptionsWidget">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>0</x>
|
||||||
|
<y>0</y>
|
||||||
|
<width>442</width>
|
||||||
|
<height>225</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="windowTitle">
|
||||||
|
<string>Debug</string>
|
||||||
|
</property>
|
||||||
|
<layout class="QVBoxLayout" name="verticalLayout">
|
||||||
|
<property name="sizeConstraint">
|
||||||
|
<enum>QLayout::SetMinAndMaxSize</enum>
|
||||||
|
</property>
|
||||||
|
<item>
|
||||||
|
<layout class="QFormLayout" name="formLayout">
|
||||||
|
<item row="0" column="0">
|
||||||
|
<widget class="QLabel" name="pluginLabel">
|
||||||
|
<property name="text">
|
||||||
|
<string>Debug Plugin:</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="0" column="1">
|
||||||
|
<widget class="QComboBox" name="pluginComboBox">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Maximum" vsizetype="Fixed">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
<resources/>
|
||||||
|
<connections/>
|
||||||
|
</ui>
|
@ -6,6 +6,7 @@
|
|||||||
#include "GeneralOptionsWidget.h"
|
#include "GeneralOptionsWidget.h"
|
||||||
#include "AsmOptionsWidget.h"
|
#include "AsmOptionsWidget.h"
|
||||||
#include "GraphOptionsWidget.h"
|
#include "GraphOptionsWidget.h"
|
||||||
|
#include "DebugOptionsWidget.h"
|
||||||
|
|
||||||
#include "PreferenceCategory.h"
|
#include "PreferenceCategory.h"
|
||||||
|
|
||||||
@ -24,20 +25,25 @@ PreferencesDialog::PreferencesDialog(QWidget *parent)
|
|||||||
{
|
{
|
||||||
"General",
|
"General",
|
||||||
new GeneralOptionsWidget(this),
|
new GeneralOptionsWidget(this),
|
||||||
QIcon(":/img/icons/cog.svg")
|
QIcon(":/img/icons/cog_light.svg")
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"Assembly",
|
"Assembly",
|
||||||
new AsmOptionsWidget(this),
|
new AsmOptionsWidget(this),
|
||||||
QIcon(":/img/icons/disas.svg"),
|
QIcon(":/img/icons/disas_light.svg"),
|
||||||
{
|
{
|
||||||
{
|
{
|
||||||
"Graph",
|
"Graph",
|
||||||
new GraphOptionsWidget(this),
|
new GraphOptionsWidget(this),
|
||||||
QIcon(":/img/icons/graph.svg")
|
QIcon(":/img/icons/graph_light.svg")
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"Debug",
|
||||||
|
new DebugOptionsWidget(this),
|
||||||
|
QIcon(":/img/icons/bug_light.svg")
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
for (auto &c : prefs)
|
for (auto &c : prefs)
|
||||||
|
4
src/img/icons/bug_light.svg
Normal file
4
src/img/icons/bug_light.svg
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
<svg xmlns="http://www.w3.org/2000/svg" width="8" height="8" viewBox="0 0 8 8">
|
||||||
|
<path d="M3.5 0c-1.19 0-1.98 1.69-1.19 2.5-.09.07-.2.14-.28.22l-1.31-.66a.5.5 0 0 0-.34-.06.5.5 0 0 0-.09.94l1.16.56c-.09.16-.19.33-.25.5h-.69a.5.5 0 0 0-.09 0 .5.5 0 1 0 .09 1h.5c0 .23.02.45.06.66l-.78.41a.5.5 0 1 0 .44.88l.66-.34c.25.46.62.85 1.03 1.09.35-.19.59-.44.59-.72v-1.44a.5.5 0 0 0 0-.09v-.81a.5.5 0 0 0 0-.22c.05-.23.26-.41.5-.41.28 0 .5.22.5.5v.88a.5.5 0 0 0 0 .09v.06a.5.5 0 0 0 0 .09v1.34c0 .27.24.53.59.72.41-.25.79-.63 1.03-1.09l.66.34a.5.5 0 1 0 .44-.88l-.78-.41c.04-.21.06-.43.06-.66h.5a.5.5 0 1 0 0-1h-.69c-.06-.17-.16-.34-.25-.5l1.16-.56a.5.5 0 0 0-.31-.94.5.5 0 0 0-.13.06l-1.31.66c-.09-.08-.19-.15-.28-.22.78-.83 0-2.5-1.19-2.5z" fill="#aaacaf"
|
||||||
|
/>
|
||||||
|
</svg>
|
After Width: | Height: | Size: 761 B |
@ -44,6 +44,7 @@
|
|||||||
<file>img/icons/graph.svg</file>
|
<file>img/icons/graph.svg</file>
|
||||||
<file>img/icons/hexdump_light.svg</file>
|
<file>img/icons/hexdump_light.svg</file>
|
||||||
<file>img/icons/hexdump_white.svg</file>
|
<file>img/icons/hexdump_white.svg</file>
|
||||||
|
<file>img/icons/bug_light.svg</file>
|
||||||
<file>img/icons/cog_light.svg</file>
|
<file>img/icons/cog_light.svg</file>
|
||||||
<file>img/icons/cog_white.svg</file>
|
<file>img/icons/cog_white.svg</file>
|
||||||
<file>img/icons/new_light.svg</file>
|
<file>img/icons/new_light.svg</file>
|
||||||
|
Loading…
Reference in New Issue
Block a user