mirror of
https://github.com/rizinorg/cutter.git
synced 2024-12-18 10:56:11 +00:00
Add more options to the Analysis widget (#2405)
This commit is contained in:
parent
d7ef6e9e91
commit
2c84e07bfa
Binary file not shown.
Before Width: | Height: | Size: 64 KiB After Width: | Height: | Size: 84 KiB |
@ -19,6 +19,19 @@ command, taking into account the configured values of the analysis options.
|
||||
|
||||
**Steps to open:** ``Edit -> Preferences -> Analysis``
|
||||
|
||||
Search boundaries for analysis
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
Select the boundaries in which the analyis will be performed. The different options are:
|
||||
|
||||
- All executable maps (``io.maps.x``)
|
||||
- All maps (``io.maps``)
|
||||
- Current map (``io.map``)
|
||||
- Raw (``raw``)
|
||||
- Current mapped section (``bin.section``)
|
||||
- All mapped sections (``bin.sections``)
|
||||
|
||||
**Configuration variable:** ``anal.in``
|
||||
|
||||
Speculatively set a name for the functions
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
Try to name functions without symbols by using artifacts in the functions such as API calls and strings.
|
||||
@ -72,3 +85,15 @@ Print warnings encountered while preforming type analysis. These warnings can he
|
||||
wrong in the analysis.
|
||||
|
||||
**Configuration variable:** ``anal.types.verbose``
|
||||
|
||||
Pointer depth
|
||||
~~~~~~~~~~~~~
|
||||
The maximum number of nested pointers to follow in analysis.
|
||||
|
||||
**Configuration variable:** ``anal.ptrdepth``
|
||||
|
||||
Functions prelude
|
||||
~~~~~~~
|
||||
Hex value that represents certain opcodes that will be used to identify functions.
|
||||
|
||||
**Configuration variable:** ``anal.prelude``
|
||||
|
@ -8,6 +8,15 @@
|
||||
|
||||
#include "core/MainWindow.h"
|
||||
|
||||
static const QHash<QString, QString> analBoundaries {
|
||||
{"io.maps.x", "All executable maps"},
|
||||
{"io.maps", "All maps"},
|
||||
{"io.map", "Current map"},
|
||||
{"raw", "Raw"},
|
||||
{"bin.section", "Current mapped section"},
|
||||
{"bin.sections", "All mapped sections"},
|
||||
};
|
||||
|
||||
AnalOptionsWidget::AnalOptionsWidget(PreferencesDialog *dialog)
|
||||
: QDialog(dialog),
|
||||
ui(new Ui::AnalOptionsWidget)
|
||||
@ -24,6 +33,9 @@ AnalOptionsWidget::AnalOptionsWidget(PreferencesDialog *dialog)
|
||||
{ ui->verboseCheckBox, "anal.verbose" }
|
||||
};
|
||||
|
||||
// Create list of options for the anal.in selector
|
||||
createAnalInOptionsList();
|
||||
|
||||
// Connect each checkbox from "checkboxes" to the generic signal "checkboxEnabler"
|
||||
for (ConfigCheckbox &confCheckbox : checkboxes) {
|
||||
QString val = confCheckbox.config;
|
||||
@ -33,7 +45,13 @@ AnalOptionsWidget::AnalOptionsWidget(PreferencesDialog *dialog)
|
||||
|
||||
ui->analyzePushButton->setToolTip("Analyze the program using radare2's \"aaa\" command");
|
||||
auto *mainWindow = new MainWindow(this);
|
||||
connect(ui->analyzePushButton, &QPushButton::clicked, mainWindow, &MainWindow::on_actionAnalyze_triggered);
|
||||
connect(ui->analyzePushButton, &QPushButton::clicked, mainWindow,
|
||||
&MainWindow::on_actionAnalyze_triggered);
|
||||
connect<void (QComboBox::*)(int)>(ui->analInComboBox, &QComboBox::currentIndexChanged, this,
|
||||
&AnalOptionsWidget::updateAnalIn);
|
||||
connect<void (QSpinBox::*)(int)>(ui->ptrDepthSpinBox, &QSpinBox::valueChanged, this,
|
||||
&AnalOptionsWidget::updateAnalPtrDepth);
|
||||
connect(ui->preludeLineEdit, &QLineEdit::textChanged, this, &AnalOptionsWidget::updateAnalPrelude);
|
||||
updateAnalOptionsFromVars();
|
||||
}
|
||||
|
||||
@ -49,4 +67,37 @@ void AnalOptionsWidget::updateAnalOptionsFromVars()
|
||||
for (ConfigCheckbox &confCheckbox : checkboxes) {
|
||||
qhelpers::setCheckedWithoutSignals(confCheckbox.checkBox, Core()->getConfigb(confCheckbox.config));
|
||||
}
|
||||
}
|
||||
|
||||
// Update the rest of analysis options that are not checkboxes
|
||||
ui->analInComboBox->setCurrentIndex(ui->analInComboBox->findData(Core()->getConfig("anal.in")));
|
||||
ui->ptrDepthSpinBox->setValue(Core()->getConfigi("anal.ptrdepth"));
|
||||
ui->preludeLineEdit->setText(Core()->getConfig("anal.prelude"));
|
||||
}
|
||||
|
||||
void AnalOptionsWidget::updateAnalIn(int index)
|
||||
{
|
||||
Config()->setConfig("anal.in", ui->analInComboBox->itemData(index).toString());
|
||||
}
|
||||
|
||||
void AnalOptionsWidget::updateAnalPtrDepth(int value)
|
||||
{
|
||||
Config()->setConfig("anal.ptrdepth", value);
|
||||
}
|
||||
|
||||
void AnalOptionsWidget::updateAnalPrelude(const QString &prelude)
|
||||
{
|
||||
Config()->setConfig("anal.prelude", prelude);
|
||||
}
|
||||
|
||||
void AnalOptionsWidget::createAnalInOptionsList()
|
||||
{
|
||||
QHash<QString, QString>::const_iterator mapIter;
|
||||
|
||||
mapIter = analBoundaries.cbegin();
|
||||
ui->analInComboBox->blockSignals(true);
|
||||
ui->analInComboBox->clear();
|
||||
for (; mapIter != analBoundaries.cend(); ++mapIter) {
|
||||
ui->analInComboBox->addItem(mapIter.value(), mapIter.key());
|
||||
}
|
||||
ui->analInComboBox->blockSignals(false);
|
||||
}
|
||||
|
@ -28,6 +28,11 @@ private:
|
||||
};
|
||||
QList<ConfigCheckbox> checkboxes;
|
||||
|
||||
/**
|
||||
* @brief This function creates the list with the different options shown in the selector for anal.in
|
||||
*/
|
||||
void createAnalInOptionsList();
|
||||
|
||||
private slots:
|
||||
/**
|
||||
* @brief A slot to display the options in the dialog according to the current anal.* configuration
|
||||
@ -41,6 +46,24 @@ private slots:
|
||||
* @param config - the configuration string to be toggled
|
||||
*/
|
||||
static void checkboxEnabler(QCheckBox *checkbox, const QString &config);
|
||||
|
||||
/**
|
||||
* @brief A slot to update the value of anal.in when a different option is selected
|
||||
* @param index - The index of the selected option for anal.in
|
||||
*/
|
||||
void updateAnalIn(int index);
|
||||
|
||||
/**
|
||||
* @brief A slot to update the value of anal.ptrdepth when a new value is selected
|
||||
* @param value - The new value for anal.ptrdepth
|
||||
*/
|
||||
static void updateAnalPtrDepth(int value);
|
||||
|
||||
/**
|
||||
* @brief slot to update the value of anal.prelude when a new value is introduced in the corresponding textbox
|
||||
* @param prelude - The new value for anal.prelude
|
||||
*/
|
||||
static void updateAnalPrelude(const QString &prelude);
|
||||
};
|
||||
|
||||
#endif // ANALOPTIONSWIDGET_H
|
||||
|
@ -46,7 +46,7 @@
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>10</x>
|
||||
<y>190</y>
|
||||
<y>240</y>
|
||||
<width>601</width>
|
||||
<height>23</height>
|
||||
</rect>
|
||||
@ -59,7 +59,7 @@
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>10</x>
|
||||
<y>130</y>
|
||||
<y>180</y>
|
||||
<width>601</width>
|
||||
<height>23</height>
|
||||
</rect>
|
||||
@ -72,7 +72,7 @@
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>10</x>
|
||||
<y>160</y>
|
||||
<y>210</y>
|
||||
<width>601</width>
|
||||
<height>23</height>
|
||||
</rect>
|
||||
@ -85,7 +85,7 @@
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>10</x>
|
||||
<y>10</y>
|
||||
<y>60</y>
|
||||
<width>601</width>
|
||||
<height>23</height>
|
||||
</rect>
|
||||
@ -98,7 +98,7 @@
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>10</x>
|
||||
<y>40</y>
|
||||
<y>90</y>
|
||||
<width>601</width>
|
||||
<height>23</height>
|
||||
</rect>
|
||||
@ -111,7 +111,7 @@
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>10</x>
|
||||
<y>70</y>
|
||||
<y>120</y>
|
||||
<width>601</width>
|
||||
<height>23</height>
|
||||
</rect>
|
||||
@ -124,7 +124,7 @@
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>10</x>
|
||||
<y>100</y>
|
||||
<y>150</y>
|
||||
<width>601</width>
|
||||
<height>23</height>
|
||||
</rect>
|
||||
@ -133,6 +133,125 @@
|
||||
<string>Analyze jump tables in switch statements (anal.jmp.tbl)</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QWidget" name="verticalLayoutWidget">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>10</x>
|
||||
<y>20</y>
|
||||
<width>581</width>
|
||||
<height>27</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QFormLayout" name="formLayout">
|
||||
<property name="fieldGrowthPolicy">
|
||||
<enum>QFormLayout::ExpandingFieldsGrow</enum>
|
||||
</property>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="analInLabel">
|
||||
<property name="enabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Search boundaries for analysis (anal.in): </string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QComboBox" name="analInComboBox"/>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="verticalLayoutWidget_2">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>10</x>
|
||||
<y>270</y>
|
||||
<width>581</width>
|
||||
<height>28</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QFormLayout" name="formLayout_2">
|
||||
<property name="fieldGrowthPolicy">
|
||||
<enum>QFormLayout::ExpandingFieldsGrow</enum>
|
||||
</property>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="ptrDepthLabel">
|
||||
<property name="enabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Pointer depth (anal.ptrdepth):</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QSpinBox" name="ptrDepthSpinBox">
|
||||
<property name="minimum">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="value">
|
||||
<number>0</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="verticalLayoutWidget_3">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>10</x>
|
||||
<y>300</y>
|
||||
<width>581</width>
|
||||
<height>28</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QFormLayout" name="formLayout_3">
|
||||
<property name="fieldGrowthPolicy">
|
||||
<enum>QFormLayout::ExpandingFieldsGrow</enum>
|
||||
</property>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="preludeLabel">
|
||||
<property name="enabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Functions Prelude (anal.prelude):</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QLineEdit" name="preludeLineEdit">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="placeholderText">
|
||||
<string notr="true">e.g.: 0x554889e5</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
</widget>
|
||||
</item>
|
||||
|
Loading…
Reference in New Issue
Block a user