Minor renames of analysis-related things (#2761)

This commit is contained in:
Anton Kochkov 2021-09-16 02:48:02 +08:00 committed by GitHub
parent 57f34bfb98
commit 5595193b70
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
21 changed files with 216 additions and 216 deletions

View File

@ -24,7 +24,7 @@ set(SOURCES
common/DirectionalComboBox.cpp common/DirectionalComboBox.cpp
dialogs/preferences/AsmOptionsWidget.cpp dialogs/preferences/AsmOptionsWidget.cpp
dialogs/NewFileDialog.cpp dialogs/NewFileDialog.cpp
common/AnalTask.cpp common/AnalysisTask.cpp
widgets/CommentsWidget.cpp widgets/CommentsWidget.cpp
widgets/ConsoleWidget.cpp widgets/ConsoleWidget.cpp
widgets/Dashboard.cpp widgets/Dashboard.cpp
@ -139,7 +139,7 @@ set(SOURCES
widgets/RizinGraphWidget.cpp widgets/RizinGraphWidget.cpp
widgets/CallGraph.cpp widgets/CallGraph.cpp
widgets/AddressableDockWidget.cpp widgets/AddressableDockWidget.cpp
dialogs/preferences/AnalOptionsWidget.cpp dialogs/preferences/AnalysisOptionsWidget.cpp
common/DecompilerHighlighter.cpp common/DecompilerHighlighter.cpp
dialogs/GlibcHeapInfoDialog.cpp dialogs/GlibcHeapInfoDialog.cpp
widgets/HeapDockWidget.cpp widgets/HeapDockWidget.cpp
@ -173,7 +173,7 @@ set(HEADER_FILES
common/DirectionalComboBox.h common/DirectionalComboBox.h
dialogs/InitialOptionsDialog.h dialogs/InitialOptionsDialog.h
dialogs/NewFileDialog.h dialogs/NewFileDialog.h
common/AnalTask.h common/AnalysisTask.h
widgets/CommentsWidget.h widgets/CommentsWidget.h
widgets/ConsoleWidget.h widgets/ConsoleWidget.h
widgets/Dashboard.h widgets/Dashboard.h
@ -298,7 +298,7 @@ set(HEADER_FILES
widgets/RizinGraphWidget.h widgets/RizinGraphWidget.h
widgets/CallGraph.h widgets/CallGraph.h
widgets/AddressableDockWidget.h widgets/AddressableDockWidget.h
dialogs/preferences/AnalOptionsWidget.h dialogs/preferences/AnalysisOptionsWidget.h
common/DecompilerHighlighter.h common/DecompilerHighlighter.h
dialogs/GlibcHeapInfoDialog.h dialogs/GlibcHeapInfoDialog.h
widgets/HeapDockWidget.h widgets/HeapDockWidget.h
@ -371,7 +371,7 @@ set(UI_FILES
widgets/ListDockWidget.ui widgets/ListDockWidget.ui
dialogs/LayoutManager.ui dialogs/LayoutManager.ui
widgets/RizinGraphWidget.ui widgets/RizinGraphWidget.ui
dialogs/preferences/AnalOptionsWidget.ui dialogs/preferences/AnalysisOptionsWidget.ui
dialogs/GlibcHeapInfoDialog.ui dialogs/GlibcHeapInfoDialog.ui
widgets/HeapDockWidget.ui widgets/HeapDockWidget.ui
widgets/GlibcHeapWidget.ui widgets/GlibcHeapWidget.ui

View File

@ -149,7 +149,7 @@ CutterApplication::CutterApplication(int &argc, char **argv) : QApplication(argc
} }
mainWindow->displayNewFileDialog(); mainWindow->displayNewFileDialog();
} else { // filename specified as positional argument } else { // filename specified as positional argument
bool askOptions = (clOptions.analLevel != AutomaticAnalysisLevel::Ask) bool askOptions = (clOptions.analysisLevel != AutomaticAnalysisLevel::Ask)
|| !clOptions.fileOpenOptions.projectFile.isEmpty(); || !clOptions.fileOpenOptions.projectFile.isEmpty();
mainWindow->openNewFile(clOptions.fileOpenOptions, askOptions); mainWindow->openNewFile(clOptions.fileOpenOptions, askOptions);
} }
@ -378,30 +378,30 @@ bool CutterApplication::parseCommandLineOptions()
opts.args = cmd_parser.positionalArguments(); opts.args = cmd_parser.positionalArguments();
if (cmd_parser.isSet(analOption)) { if (cmd_parser.isSet(analOption)) {
bool analLevelSpecified = false; bool analysisLevelSpecified = false;
int analLevel = cmd_parser.value(analOption).toInt(&analLevelSpecified); int analysisLevel = cmd_parser.value(analOption).toInt(&analysisLevelSpecified);
if (!analLevelSpecified || analLevel < 0 || analLevel > 2) { if (!analysisLevelSpecified || analysisLevel < 0 || analysisLevel > 2) {
fprintf(stderr, "%s\n", fprintf(stderr, "%s\n",
QObject::tr("Invalid Analysis Level. May be a value between 0 and 2.") QObject::tr("Invalid Analysis Level. May be a value between 0 and 2.")
.toLocal8Bit() .toLocal8Bit()
.constData()); .constData());
return false; return false;
} }
switch (analLevel) { switch (analysisLevel) {
case 0: case 0:
opts.analLevel = AutomaticAnalysisLevel::None; opts.analysisLevel = AutomaticAnalysisLevel::None;
break; break;
case 1: case 1:
opts.analLevel = AutomaticAnalysisLevel::AAA; opts.analysisLevel = AutomaticAnalysisLevel::AAA;
break; break;
case 2: case 2:
opts.analLevel = AutomaticAnalysisLevel::AAAA; opts.analysisLevel = AutomaticAnalysisLevel::AAAA;
break; break;
} }
} }
if (opts.args.empty() && opts.analLevel != AutomaticAnalysisLevel::Ask) { if (opts.args.empty() && opts.analysisLevel != AutomaticAnalysisLevel::Ask) {
fprintf(stderr, "%s\n", fprintf(stderr, "%s\n",
QObject::tr("Filename must be specified to start analysis automatically.") QObject::tr("Filename must be specified to start analysis automatically.")
.toLocal8Bit() .toLocal8Bit()
@ -420,17 +420,17 @@ bool CutterApplication::parseCommandLineOptions()
options.binLoadAddr = baddr; options.binLoadAddr = baddr;
} }
} }
switch (opts.analLevel) { switch (opts.analysisLevel) {
case AutomaticAnalysisLevel::Ask: case AutomaticAnalysisLevel::Ask:
break; break;
case AutomaticAnalysisLevel::None: case AutomaticAnalysisLevel::None:
opts.fileOpenOptions.analCmd = {}; opts.fileOpenOptions.analysisCmd = {};
break; break;
case AutomaticAnalysisLevel::AAA: case AutomaticAnalysisLevel::AAA:
opts.fileOpenOptions.analCmd = { { "aaa", "Auto analysis" } }; opts.fileOpenOptions.analysisCmd = { { "aaa", "Auto analysis" } };
break; break;
case AutomaticAnalysisLevel::AAAA: case AutomaticAnalysisLevel::AAAA:
opts.fileOpenOptions.analCmd = { { "aaaa", "Auto analysis (experimental)" } }; opts.fileOpenOptions.analysisCmd = { { "aaaa", "Auto analysis (experimental)" } };
break; break;
} }
opts.fileOpenOptions.script = cmd_parser.value(scriptOption); opts.fileOpenOptions.script = cmd_parser.value(scriptOption);

View File

@ -13,7 +13,7 @@ enum class AutomaticAnalysisLevel { Ask, None, AAA, AAAA };
struct CutterCommandLineOptions struct CutterCommandLineOptions
{ {
QStringList args; QStringList args;
AutomaticAnalysisLevel analLevel = AutomaticAnalysisLevel::Ask; AutomaticAnalysisLevel analysisLevel = AutomaticAnalysisLevel::Ask;
InitialOptions fileOpenOptions; InitialOptions fileOpenOptions;
QString pythonHome; QString pythonHome;
bool outputRedirectionEnabled = true; bool outputRedirectionEnabled = true;

View File

@ -1,22 +1,22 @@
#include "core/Cutter.h" #include "core/Cutter.h"
#include "common/AnalTask.h" #include "common/AnalysisTask.h"
#include "core/MainWindow.h" #include "core/MainWindow.h"
#include "dialogs/InitialOptionsDialog.h" #include "dialogs/InitialOptionsDialog.h"
#include <QJsonArray> #include <QJsonArray>
#include <QDebug> #include <QDebug>
#include <QCheckBox> #include <QCheckBox>
AnalTask::AnalTask() : AsyncTask() {} AnalysisTask::AnalysisTask() : AsyncTask() {}
AnalTask::~AnalTask() {} AnalysisTask::~AnalysisTask() {}
void AnalTask::interrupt() void AnalysisTask::interrupt()
{ {
AsyncTask::interrupt(); AsyncTask::interrupt();
rz_cons_singleton()->context->breaked = true; rz_cons_singleton()->context->breaked = true;
} }
QString AnalTask::getTitle() QString AnalysisTask::getTitle()
{ {
// If no file is loaded we consider it's Initial Analysis // If no file is loaded we consider it's Initial Analysis
RzCoreLocked core(Core()); RzCoreLocked core(Core());
@ -27,7 +27,7 @@ QString AnalTask::getTitle()
return tr("Analyzing Program"); return tr("Analyzing Program");
} }
void AnalTask::runTask() void AnalysisTask::runTask()
{ {
int perms = RZ_PERM_RX; int perms = RZ_PERM_RX;
if (options.writeEnabled) { if (options.writeEnabled) {
@ -96,9 +96,9 @@ void AnalTask::runTask()
return; return;
} }
if (!options.analCmd.empty()) { if (!options.analysisCmd.empty()) {
log(tr("Executing analysis...")); log(tr("Executing analysis..."));
for (const CommandDescription &cmd : options.analCmd) { for (const CommandDescription &cmd : options.analysisCmd) {
if (isInterrupted()) { if (isInterrupted()) {
return; return;
} }

View File

@ -9,13 +9,13 @@ class CutterCore;
class MainWindow; class MainWindow;
class InitialOptionsDialog; class InitialOptionsDialog;
class AnalTask : public AsyncTask class AnalysisTask : public AsyncTask
{ {
Q_OBJECT Q_OBJECT
public: public:
explicit AnalTask(); explicit AnalysisTask();
~AnalTask(); ~AnalysisTask();
QString getTitle() override; QString getTitle() override;

View File

@ -40,7 +40,7 @@ struct InitialOptions
QString pdbFile; QString pdbFile;
QString script; QString script;
QList<CommandDescription> analCmd = { { "aaa", "Auto analysis" } }; QList<CommandDescription> analysisCmd = { { "aaa", "Auto analysis" } };
QString shellcode; QString shellcode;
}; };

View File

@ -2706,7 +2706,7 @@ QStringList CutterCore::getAsmPluginNames()
return ret; return ret;
} }
QStringList CutterCore::getAnalPluginNames() QStringList CutterCore::getAnalysisPluginNames()
{ {
CORE_LOCK(); CORE_LOCK();
RzListIter *it; RzListIter *it;
@ -3305,7 +3305,7 @@ QList<BinClassDescription> CutterCore::getAllClassesFromFlags()
return ret; return ret;
} }
QList<QString> CutterCore::getAllAnalClasses(bool sorted) QList<QString> CutterCore::getAllAnalysisClasses(bool sorted)
{ {
CORE_LOCK(); CORE_LOCK();
QList<QString> ret; QList<QString> ret;
@ -3327,10 +3327,10 @@ QList<QString> CutterCore::getAllAnalClasses(bool sorted)
return ret; return ret;
} }
QList<AnalMethodDescription> CutterCore::getAnalClassMethods(const QString &cls) QList<AnalysisMethodDescription> CutterCore::getAnalysisClassMethods(const QString &cls)
{ {
CORE_LOCK(); CORE_LOCK();
QList<AnalMethodDescription> ret; QList<AnalysisMethodDescription> ret;
RzVector *meths = rz_analysis_class_method_get_all(core->analysis, cls.toUtf8().constData()); RzVector *meths = rz_analysis_class_method_get_all(core->analysis, cls.toUtf8().constData());
if (!meths) { if (!meths) {
@ -3341,7 +3341,7 @@ QList<AnalMethodDescription> CutterCore::getAnalClassMethods(const QString &cls)
RzAnalysisMethod *meth; RzAnalysisMethod *meth;
CutterRzVectorForeach(meths, meth, RzAnalysisMethod) CutterRzVectorForeach(meths, meth, RzAnalysisMethod)
{ {
AnalMethodDescription desc; AnalysisMethodDescription desc;
desc.name = QString::fromUtf8(meth->name); desc.name = QString::fromUtf8(meth->name);
desc.addr = meth->addr; desc.addr = meth->addr;
desc.vtableOffset = meth->vtable_offset; desc.vtableOffset = meth->vtable_offset;
@ -3352,10 +3352,10 @@ QList<AnalMethodDescription> CutterCore::getAnalClassMethods(const QString &cls)
return ret; return ret;
} }
QList<AnalBaseClassDescription> CutterCore::getAnalClassBaseClasses(const QString &cls) QList<AnalysisBaseClassDescription> CutterCore::getAnalysisClassBaseClasses(const QString &cls)
{ {
CORE_LOCK(); CORE_LOCK();
QList<AnalBaseClassDescription> ret; QList<AnalysisBaseClassDescription> ret;
RzVector *bases = rz_analysis_class_base_get_all(core->analysis, cls.toUtf8().constData()); RzVector *bases = rz_analysis_class_base_get_all(core->analysis, cls.toUtf8().constData());
if (!bases) { if (!bases) {
@ -3366,7 +3366,7 @@ QList<AnalBaseClassDescription> CutterCore::getAnalClassBaseClasses(const QStrin
RzAnalysisBaseClass *base; RzAnalysisBaseClass *base;
CutterRzVectorForeach(bases, base, RzAnalysisBaseClass) CutterRzVectorForeach(bases, base, RzAnalysisBaseClass)
{ {
AnalBaseClassDescription desc; AnalysisBaseClassDescription desc;
desc.id = QString::fromUtf8(base->id); desc.id = QString::fromUtf8(base->id);
desc.offset = base->offset; desc.offset = base->offset;
desc.className = QString::fromUtf8(base->class_name); desc.className = QString::fromUtf8(base->class_name);
@ -3377,10 +3377,10 @@ QList<AnalBaseClassDescription> CutterCore::getAnalClassBaseClasses(const QStrin
return ret; return ret;
} }
QList<AnalVTableDescription> CutterCore::getAnalClassVTables(const QString &cls) QList<AnalysisVTableDescription> CutterCore::getAnalysisClassVTables(const QString &cls)
{ {
CORE_LOCK(); CORE_LOCK();
QList<AnalVTableDescription> acVtables; QList<AnalysisVTableDescription> acVtables;
RzVector *vtables = rz_analysis_class_vtable_get_all(core->analysis, cls.toUtf8().constData()); RzVector *vtables = rz_analysis_class_vtable_get_all(core->analysis, cls.toUtf8().constData());
if (!vtables) { if (!vtables) {
@ -3391,7 +3391,7 @@ QList<AnalVTableDescription> CutterCore::getAnalClassVTables(const QString &cls)
RzAnalysisVTable *vtable; RzAnalysisVTable *vtable;
CutterRzVectorForeach(vtables, vtable, RzAnalysisVTable) CutterRzVectorForeach(vtables, vtable, RzAnalysisVTable)
{ {
AnalVTableDescription desc; AnalysisVTableDescription desc;
desc.id = QString::fromUtf8(vtable->id); desc.id = QString::fromUtf8(vtable->id);
desc.offset = vtable->offset; desc.offset = vtable->offset;
desc.addr = vtable->addr; desc.addr = vtable->addr;
@ -3421,34 +3421,34 @@ void CutterCore::deleteClass(const QString &cls)
rz_analysis_class_delete(core->analysis, cls.toUtf8().constData()); rz_analysis_class_delete(core->analysis, cls.toUtf8().constData());
} }
bool CutterCore::getAnalMethod(const QString &cls, const QString &meth, AnalMethodDescription *desc) bool CutterCore::getAnalysisMethod(const QString &cls, const QString &meth, AnalysisMethodDescription *desc)
{ {
CORE_LOCK(); CORE_LOCK();
RzAnalysisMethod analMeth; RzAnalysisMethod analysisMeth;
if (rz_analysis_class_method_get(core->analysis, cls.toUtf8().constData(), if (rz_analysis_class_method_get(core->analysis, cls.toUtf8().constData(),
meth.toUtf8().constData(), &analMeth) meth.toUtf8().constData(), &analysisMeth)
!= RZ_ANALYSIS_CLASS_ERR_SUCCESS) { != RZ_ANALYSIS_CLASS_ERR_SUCCESS) {
return false; return false;
} }
desc->name = QString::fromUtf8(analMeth.name); desc->name = QString::fromUtf8(analysisMeth.name);
desc->addr = analMeth.addr; desc->addr = analysisMeth.addr;
desc->vtableOffset = analMeth.vtable_offset; desc->vtableOffset = analysisMeth.vtable_offset;
rz_analysis_class_method_fini(&analMeth); rz_analysis_class_method_fini(&analysisMeth);
return true; return true;
} }
void CutterCore::setAnalMethod(const QString &className, const AnalMethodDescription &meth) void CutterCore::setAnalysisMethod(const QString &className, const AnalysisMethodDescription &meth)
{ {
CORE_LOCK(); CORE_LOCK();
RzAnalysisMethod analMeth; RzAnalysisMethod analysisMeth;
analMeth.name = strdup(meth.name.toUtf8().constData()); analysisMeth.name = strdup(meth.name.toUtf8().constData());
analMeth.addr = meth.addr; analysisMeth.addr = meth.addr;
analMeth.vtable_offset = meth.vtableOffset; analysisMeth.vtable_offset = meth.vtableOffset;
rz_analysis_class_method_set(core->analysis, className.toUtf8().constData(), &analMeth); rz_analysis_class_method_set(core->analysis, className.toUtf8().constData(), &analysisMeth);
rz_analysis_class_method_fini(&analMeth); rz_analysis_class_method_fini(&analysisMeth);
} }
void CutterCore::renameAnalMethod(const QString &className, const QString &oldMethodName, void CutterCore::renameAnalysisMethod(const QString &className, const QString &oldMethodName,
const QString &newMethodName) const QString &newMethodName)
{ {
CORE_LOCK(); CORE_LOCK();

View File

@ -260,17 +260,17 @@ public:
void applyStructureOffset(const QString &structureOffset, RVA offset = RVA_INVALID); void applyStructureOffset(const QString &structureOffset, RVA offset = RVA_INVALID);
/* Classes */ /* Classes */
QList<QString> getAllAnalClasses(bool sorted); QList<QString> getAllAnalysisClasses(bool sorted);
QList<AnalMethodDescription> getAnalClassMethods(const QString &cls); QList<AnalysisMethodDescription> getAnalysisClassMethods(const QString &cls);
QList<AnalBaseClassDescription> getAnalClassBaseClasses(const QString &cls); QList<AnalysisBaseClassDescription> getAnalysisClassBaseClasses(const QString &cls);
QList<AnalVTableDescription> getAnalClassVTables(const QString &cls); QList<AnalysisVTableDescription> getAnalysisClassVTables(const QString &cls);
void createNewClass(const QString &cls); void createNewClass(const QString &cls);
void renameClass(const QString &oldName, const QString &newName); void renameClass(const QString &oldName, const QString &newName);
void deleteClass(const QString &cls); void deleteClass(const QString &cls);
bool getAnalMethod(const QString &cls, const QString &meth, AnalMethodDescription *desc); bool getAnalysisMethod(const QString &cls, const QString &meth, AnalysisMethodDescription *desc);
void renameAnalMethod(const QString &className, const QString &oldMethodName, void renameAnalysisMethod(const QString &className, const QString &oldMethodName,
const QString &newMethodName); const QString &newMethodName);
void setAnalMethod(const QString &cls, const AnalMethodDescription &meth); void setAnalysisMethod(const QString &cls, const AnalysisMethodDescription &meth);
/* File related methods */ /* File related methods */
bool loadFile(QString path, ut64 baddr = 0LL, ut64 mapaddr = 0LL, int perms = RZ_PERM_R, bool loadFile(QString path, ut64 baddr = 0LL, ut64 mapaddr = 0LL, int perms = RZ_PERM_R,
@ -531,7 +531,7 @@ public:
/* Plugins */ /* Plugins */
QStringList getAsmPluginNames(); QStringList getAsmPluginNames();
QStringList getAnalPluginNames(); QStringList getAnalysisPluginNames();
/* Widgets */ /* Widgets */
QList<RzBinPluginDescription> getRBinPluginDescriptions(const QString &type = QString()); QList<RzBinPluginDescription> getRBinPluginDescriptions(const QString &type = QString());

View File

@ -244,21 +244,21 @@ struct BinClassDescription
QList<BinClassFieldDescription> fields; QList<BinClassFieldDescription> fields;
}; };
struct AnalMethodDescription struct AnalysisMethodDescription
{ {
QString name; QString name;
RVA addr; RVA addr;
st64 vtableOffset; st64 vtableOffset;
}; };
struct AnalBaseClassDescription struct AnalysisBaseClassDescription
{ {
QString id; QString id;
RVA offset; RVA offset;
QString className; QString className;
}; };
struct AnalVTableDescription struct AnalysisVTableDescription
{ {
QString id; QString id;
ut64 offset; ut64 offset;
@ -404,9 +404,9 @@ Q_DECLARE_METATYPE(BinClassDescription)
Q_DECLARE_METATYPE(const BinClassDescription *) Q_DECLARE_METATYPE(const BinClassDescription *)
Q_DECLARE_METATYPE(const BinClassMethodDescription *) Q_DECLARE_METATYPE(const BinClassMethodDescription *)
Q_DECLARE_METATYPE(const BinClassFieldDescription *) Q_DECLARE_METATYPE(const BinClassFieldDescription *)
Q_DECLARE_METATYPE(AnalBaseClassDescription) Q_DECLARE_METATYPE(AnalysisBaseClassDescription)
Q_DECLARE_METATYPE(AnalMethodDescription) Q_DECLARE_METATYPE(AnalysisMethodDescription)
Q_DECLARE_METATYPE(AnalVTableDescription) Q_DECLARE_METATYPE(AnalysisVTableDescription)
Q_DECLARE_METATYPE(ResourcesDescription) Q_DECLARE_METATYPE(ResourcesDescription)
Q_DECLARE_METATYPE(VTableDescription) Q_DECLARE_METATYPE(VTableDescription)
Q_DECLARE_METATYPE(TypeDescription) Q_DECLARE_METATYPE(TypeDescription)

View File

@ -2,7 +2,7 @@
#include "ui_MainWindow.h" #include "ui_MainWindow.h"
// Common Headers // Common Headers
#include "common/AnalTask.h" #include "common/AnalysisTask.h"
#include "common/BugReporting.h" #include "common/BugReporting.h"
#include "common/Highlighter.h" #include "common/Highlighter.h"
#include "common/Helpers.h" #include "common/Helpers.h"
@ -1652,19 +1652,19 @@ void MainWindow::on_actionRefresh_Panels_triggered()
*/ */
void MainWindow::on_actionAnalyze_triggered() void MainWindow::on_actionAnalyze_triggered()
{ {
auto *analTask = new AnalTask(); auto *analysisTask = new AnalysisTask();
InitialOptions options; InitialOptions options;
options.analCmd = { { "aaa", "Auto analysis" } }; options.analysisCmd = { { "aaa", "Auto analysis" } };
analTask->setOptions(options); analysisTask->setOptions(options);
AsyncTask::Ptr analTaskPtr(analTask); AsyncTask::Ptr analysisTaskPtr(analysisTask);
auto *taskDialog = new AsyncTaskDialog(analTaskPtr); auto *taskDialog = new AsyncTaskDialog(analysisTaskPtr);
taskDialog->setInterruptOnClose(true); taskDialog->setInterruptOnClose(true);
taskDialog->setAttribute(Qt::WA_DeleteOnClose); taskDialog->setAttribute(Qt::WA_DeleteOnClose);
taskDialog->show(); taskDialog->show();
connect(analTask, &AnalTask::finished, this, &MainWindow::refreshAll); connect(analysisTask, &AnalysisTask::finished, this, &MainWindow::refreshAll);
Core()->getAsyncTaskManager()->start(analTaskPtr); Core()->getAsyncTaskManager()->start(analysisTaskPtr);
} }
void MainWindow::on_actionImportPDB_triggered() void MainWindow::on_actionImportPDB_triggered()

View File

@ -15,7 +15,7 @@ EditMethodDialog::EditMethodDialog(bool classFixed, QWidget *parent)
} else { } else {
classComboBox = new QComboBox(this); classComboBox = new QComboBox(this);
ui->formLayout->setItem(0, QFormLayout::FieldRole, new QWidgetItem(classComboBox)); ui->formLayout->setItem(0, QFormLayout::FieldRole, new QWidgetItem(classComboBox));
for (auto &cls : Core()->getAllAnalClasses(true)) { for (auto &cls : Core()->getAllAnalysisClasses(true)) {
classComboBox->addItem(cls, cls); classComboBox->addItem(cls, cls);
} }
} }
@ -86,7 +86,7 @@ void EditMethodDialog::setClass(const QString &className)
validateInput(); validateInput();
} }
void EditMethodDialog::setMethod(const AnalMethodDescription &desc) void EditMethodDialog::setMethod(const AnalysisMethodDescription &desc)
{ {
ui->nameEdit->setText(desc.name); ui->nameEdit->setText(desc.name);
ui->addressEdit->setText(desc.addr != RVA_INVALID ? RzAddressString(desc.addr) : nullptr); ui->addressEdit->setText(desc.addr != RVA_INVALID ? RzAddressString(desc.addr) : nullptr);
@ -116,9 +116,9 @@ QString EditMethodDialog::getClass() const
} }
} }
AnalMethodDescription EditMethodDialog::getMethod() const AnalysisMethodDescription EditMethodDialog::getMethod() const
{ {
AnalMethodDescription ret; AnalysisMethodDescription ret;
ret.name = ui->nameEdit->text(); ret.name = ui->nameEdit->text();
ret.addr = Core()->num(ui->addressEdit->text()); ret.addr = Core()->num(ui->addressEdit->text());
if (!ui->virtualCheckBox->isChecked()) { if (!ui->virtualCheckBox->isChecked()) {
@ -130,7 +130,7 @@ AnalMethodDescription EditMethodDialog::getMethod() const
} }
bool EditMethodDialog::showDialog(const QString &title, bool classFixed, QString *className, bool EditMethodDialog::showDialog(const QString &title, bool classFixed, QString *className,
AnalMethodDescription *desc, QWidget *parent) AnalysisMethodDescription *desc, QWidget *parent)
{ {
EditMethodDialog dialog(classFixed, parent); EditMethodDialog dialog(classFixed, parent);
dialog.setWindowTitle(title); dialog.setWindowTitle(title);
@ -144,7 +144,7 @@ bool EditMethodDialog::showDialog(const QString &title, bool classFixed, QString
void EditMethodDialog::newMethod(QString className, const QString &meth, QWidget *parent) void EditMethodDialog::newMethod(QString className, const QString &meth, QWidget *parent)
{ {
AnalMethodDescription desc; AnalysisMethodDescription desc;
desc.name = meth; desc.name = meth;
desc.vtableOffset = -1; desc.vtableOffset = -1;
desc.addr = Core()->getOffset(); desc.addr = Core()->getOffset();
@ -153,13 +153,13 @@ void EditMethodDialog::newMethod(QString className, const QString &meth, QWidget
return; return;
} }
Core()->setAnalMethod(className, desc); Core()->setAnalysisMethod(className, desc);
} }
void EditMethodDialog::editMethod(const QString &className, const QString &meth, QWidget *parent) void EditMethodDialog::editMethod(const QString &className, const QString &meth, QWidget *parent)
{ {
AnalMethodDescription desc; AnalysisMethodDescription desc;
if (!Core()->getAnalMethod(className, meth, &desc)) { if (!Core()->getAnalysisMethod(className, meth, &desc)) {
return; return;
} }
@ -168,7 +168,7 @@ void EditMethodDialog::editMethod(const QString &className, const QString &meth,
return; return;
} }
if (desc.name != meth) { if (desc.name != meth) {
Core()->renameAnalMethod(className, meth, desc.name); Core()->renameAnalysisMethod(className, meth, desc.name);
} }
Core()->setAnalMethod(className, desc); Core()->setAnalysisMethod(className, desc);
} }

View File

@ -24,10 +24,10 @@ public:
~EditMethodDialog(); ~EditMethodDialog();
void setClass(const QString &className); void setClass(const QString &className);
void setMethod(const AnalMethodDescription &desc); void setMethod(const AnalysisMethodDescription &desc);
QString getClass() const; QString getClass() const;
AnalMethodDescription getMethod() const; AnalysisMethodDescription getMethod() const;
/** /**
* @brief Helper function to display the dialog * @brief Helper function to display the dialog
@ -39,7 +39,7 @@ public:
* @return whether the dialog was accepted by the user * @return whether the dialog was accepted by the user
*/ */
static bool showDialog(const QString &title, bool classFixed, QString *className, static bool showDialog(const QString &title, bool classFixed, QString *className,
AnalMethodDescription *desc, QWidget *parent = nullptr); AnalysisMethodDescription *desc, QWidget *parent = nullptr);
/** /**
* @brief Show the dialog to add a new method a given class * @brief Show the dialog to add a new method a given class

View File

@ -13,7 +13,7 @@
#include <QCloseEvent> #include <QCloseEvent>
#include "core/Cutter.h" #include "core/Cutter.h"
#include "common/AnalTask.h" #include "common/AnalysisTask.h"
InitialOptionsDialog::InitialOptionsDialog(MainWindow *main) InitialOptionsDialog::InitialOptionsDialog(MainWindow *main)
: QDialog(nullptr), // parent must not be main : QDialog(nullptr), // parent must not be main
@ -83,7 +83,7 @@ InitialOptionsDialog::InitialOptionsDialog(MainWindow *main)
} }
ui->hideFrame->setVisible(false); ui->hideFrame->setVisible(false);
ui->analoptionsFrame->setVisible(false); ui->analysisoptionsFrame->setVisible(false);
ui->advancedAnlysisLine->setVisible(false); ui->advancedAnlysisLine->setVisible(false);
updatePDBLayout(); updatePDBLayout();
@ -132,7 +132,7 @@ void InitialOptionsDialog::updateCPUComboBox()
QList<QString> InitialOptionsDialog::getAnalysisCommands(const InitialOptions &options) QList<QString> InitialOptionsDialog::getAnalysisCommands(const InitialOptions &options)
{ {
QList<QString> commands; QList<QString> commands;
for (auto &commandDesc : options.analCmd) { for (auto &commandDesc : options.analysisCmd) {
commands << commandDesc.command; commands << commandDesc.command;
} }
return commands; return commands;
@ -140,14 +140,14 @@ QList<QString> InitialOptionsDialog::getAnalysisCommands(const InitialOptions &o
void InitialOptionsDialog::loadOptions(const InitialOptions &options) void InitialOptionsDialog::loadOptions(const InitialOptions &options)
{ {
if (options.analCmd.isEmpty()) { if (options.analysisCmd.isEmpty()) {
analLevel = 0; analysisLevel = 0;
} else if (options.analCmd.first().command == "aaa") { } else if (options.analysisCmd.first().command == "aaa") {
analLevel = 1; analysisLevel = 1;
} else if (options.analCmd.first().command == "aaaa") { } else if (options.analysisCmd.first().command == "aaaa") {
analLevel = 2; analysisLevel = 2;
} else { } else {
analLevel = 3; analysisLevel = 3;
AnalysisCommands item; AnalysisCommands item;
QList<QString> commands = getAnalysisCommands(options); QList<QString> commands = getAnalysisCommands(options);
foreach (item, analysisCommands) { foreach (item, analysisCommands) {
@ -159,13 +159,13 @@ void InitialOptionsDialog::loadOptions(const InitialOptions &options)
if (!options.script.isEmpty()) { if (!options.script.isEmpty()) {
ui->scriptCheckBox->setChecked(true); ui->scriptCheckBox->setChecked(true);
ui->scriptLineEdit->setText(options.script); ui->scriptLineEdit->setText(options.script);
analLevel = 0; analysisLevel = 0;
} else { } else {
ui->scriptCheckBox->setChecked(false); ui->scriptCheckBox->setChecked(false);
ui->scriptLineEdit->setText(""); ui->scriptLineEdit->setText("");
} }
ui->analSlider->setValue(analLevel); ui->analysisSlider->setValue(analysisLevel);
shellcode = options.shellcode; shellcode = options.shellcode;
@ -235,7 +235,7 @@ QString InitialOptionsDialog::getSelectedOS() const
QList<CommandDescription> InitialOptionsDialog::getSelectedAdvancedAnalCmds() const QList<CommandDescription> InitialOptionsDialog::getSelectedAdvancedAnalCmds() const
{ {
QList<CommandDescription> advanced = QList<CommandDescription>(); QList<CommandDescription> advanced = QList<CommandDescription>();
if (ui->analSlider->value() == 3) { if (ui->analysisSlider->value() == 3) {
AnalysisCommands item; AnalysisCommands item;
foreach (item, analysisCommands) { foreach (item, analysisCommands) {
if (item.checkbox->isChecked()) { if (item.checkbox->isChecked()) {
@ -284,42 +284,42 @@ void InitialOptionsDialog::setupAndStartAnalysis(/*int level, QList<QString> adv
options.endian = getSelectedEndianness(); options.endian = getSelectedEndianness();
int level = ui->analSlider->value(); int level = ui->analysisSlider->value();
switch (level) { switch (level) {
case 1: case 1:
options.analCmd = { { "aaa", "Auto analysis" } }; options.analysisCmd = { { "aaa", "Auto analysis" } };
break; break;
case 2: case 2:
options.analCmd = { { "aaaa", "Auto analysis (experimental)" } }; options.analysisCmd = { { "aaaa", "Auto analysis (experimental)" } };
break; break;
case 3: case 3:
options.analCmd = getSelectedAdvancedAnalCmds(); options.analysisCmd = getSelectedAdvancedAnalCmds();
break; break;
default: default:
options.analCmd = {}; options.analysisCmd = {};
break; break;
} }
AnalTask *analTask = new AnalTask(); AnalysisTask *analysisTask = new AnalysisTask();
analTask->setOptions(options); analysisTask->setOptions(options);
MainWindow *main = this->main; MainWindow *main = this->main;
connect(analTask, &AnalTask::openFileFailed, main, &MainWindow::openNewFileFailed); connect(analysisTask, &AnalysisTask::openFileFailed, main, &MainWindow::openNewFileFailed);
connect(analTask, &AsyncTask::finished, main, [analTask, main]() { connect(analysisTask, &AsyncTask::finished, main, [analysisTask, main]() {
if (analTask->getOpenFileFailed()) { if (analysisTask->getOpenFileFailed()) {
return; return;
} }
main->finalizeOpen(); main->finalizeOpen();
}); });
AsyncTask::Ptr analTaskPtr(analTask); AsyncTask::Ptr analysisTaskPtr(analysisTask);
AsyncTaskDialog *taskDialog = new AsyncTaskDialog(analTaskPtr); AsyncTaskDialog *taskDialog = new AsyncTaskDialog(analysisTaskPtr);
taskDialog->setInterruptOnClose(true); taskDialog->setInterruptOnClose(true);
taskDialog->setAttribute(Qt::WA_DeleteOnClose); taskDialog->setAttribute(Qt::WA_DeleteOnClose);
taskDialog->show(); taskDialog->show();
Core()->getAsyncTaskManager()->start(analTaskPtr); Core()->getAsyncTaskManager()->start(analysisTaskPtr);
done(0); done(0);
} }
@ -352,20 +352,20 @@ QString InitialOptionsDialog::analysisDescription(int level)
} }
} }
void InitialOptionsDialog::on_analSlider_valueChanged(int value) void InitialOptionsDialog::on_analysisSlider_valueChanged(int value)
{ {
ui->analDescription->setText(tr("Level") + QString(": %1").arg(analysisDescription(value))); ui->analDescription->setText(tr("Level") + QString(": %1").arg(analysisDescription(value)));
if (value == 0) { if (value == 0) {
ui->analCheckBox->setChecked(false); ui->analysisCheckBox->setChecked(false);
ui->analCheckBox->setText(tr("Analysis: Disabled")); ui->analysisCheckBox->setText(tr("Analysis: Disabled"));
} else { } else {
ui->analCheckBox->setChecked(true); ui->analysisCheckBox->setChecked(true);
ui->analCheckBox->setText(tr("Analysis: Enabled")); ui->analysisCheckBox->setText(tr("Analysis: Enabled"));
if (value == 3) { if (value == 3) {
ui->analoptionsFrame->setVisible(true); ui->analysisoptionsFrame->setVisible(true);
ui->advancedAnlysisLine->setVisible(true); ui->advancedAnlysisLine->setVisible(true);
} else { } else {
ui->analoptionsFrame->setVisible(false); ui->analysisoptionsFrame->setVisible(false);
ui->advancedAnlysisLine->setVisible(false); ui->advancedAnlysisLine->setVisible(false);
} }
} }
@ -382,12 +382,12 @@ void InitialOptionsDialog::on_AdvOptButton_clicked()
} }
} }
void InitialOptionsDialog::on_analCheckBox_clicked(bool checked) void InitialOptionsDialog::on_analysisCheckBox_clicked(bool checked)
{ {
if (!checked) { if (!checked) {
analLevel = ui->analSlider->value(); analysisLevel = ui->analysisSlider->value();
} }
ui->analSlider->setValue(checked ? analLevel : 0); ui->analysisSlider->setValue(checked ? analysisLevel : 0);
} }
void InitialOptionsDialog::on_archComboBox_currentIndexChanged(int) void InitialOptionsDialog::on_archComboBox_currentIndexChanged(int)

View File

@ -24,9 +24,9 @@ public:
private slots: private slots:
void on_okButton_clicked(); void on_okButton_clicked();
void on_analSlider_valueChanged(int value); void on_analysisSlider_valueChanged(int value);
void on_AdvOptButton_clicked(); void on_AdvOptButton_clicked();
void on_analCheckBox_clicked(bool checked); void on_analysisCheckBox_clicked(bool checked);
void on_archComboBox_currentIndexChanged(int index); void on_archComboBox_currentIndexChanged(int index);
void on_pdbSelectButton_clicked(); void on_pdbSelectButton_clicked();
void on_scriptSelectButton_clicked(); void on_scriptSelectButton_clicked();
@ -45,7 +45,7 @@ private:
QString analysisDescription(int level); QString analysisDescription(int level);
QString shellcode; QString shellcode;
int analLevel; int analysisLevel;
QList<RzAsmPluginDescription> asmPlugins; QList<RzAsmPluginDescription> asmPlugins;
void updateCPUComboBox(); void updateCPUComboBox();

View File

@ -144,7 +144,7 @@
</widget> </widget>
</item> </item>
<item> <item>
<widget class="QCheckBox" name="analCheckBox"> <widget class="QCheckBox" name="analysisCheckBox">
<property name="sizePolicy"> <property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed"> <sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch> <horstretch>0</horstretch>
@ -181,7 +181,7 @@
</layout> </layout>
</item> </item>
<item> <item>
<widget class="QSlider" name="analSlider"> <widget class="QSlider" name="analysisSlider">
<property name="sizePolicy"> <property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed"> <sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
<horstretch>0</horstretch> <horstretch>0</horstretch>
@ -277,7 +277,7 @@
<enum>QLayout::SetMinimumSize</enum> <enum>QLayout::SetMinimumSize</enum>
</property> </property>
<item> <item>
<widget class="QFrame" name="analoptionsFrame"> <widget class="QFrame" name="analysisoptionsFrame">
<property name="enabled"> <property name="enabled">
<bool>true</bool> <bool>true</bool>
</property> </property>

View File

@ -1,5 +1,5 @@
#include "AnalOptionsWidget.h" #include "AnalysisOptionsWidget.h"
#include "ui_AnalOptionsWidget.h" #include "ui_AnalysisOptionsWidget.h"
#include "PreferencesDialog.h" #include "PreferencesDialog.h"
@ -8,7 +8,7 @@
#include "core/MainWindow.h" #include "core/MainWindow.h"
static const QHash<QString, QString> analBoundaries { static const QHash<QString, QString> analysisBoundaries {
{ "io.maps.x", "All executable maps" }, { "io.maps.x", "All executable maps" },
{ "io.maps", "All maps" }, { "io.maps", "All maps" },
{ "io.map", "Current map" }, { "io.map", "Current map" },
@ -17,8 +17,8 @@ static const QHash<QString, QString> analBoundaries {
{ "bin.sections", "All mapped sections" }, { "bin.sections", "All mapped sections" },
}; };
AnalOptionsWidget::AnalOptionsWidget(PreferencesDialog *dialog) AnalysisOptionsWidget::AnalysisOptionsWidget(PreferencesDialog *dialog)
: QDialog(dialog), ui(new Ui::AnalOptionsWidget) : QDialog(dialog), ui(new Ui::AnalysisOptionsWidget)
{ {
ui->setupUi(this); ui->setupUi(this);
@ -31,7 +31,7 @@ AnalOptionsWidget::AnalOptionsWidget(PreferencesDialog *dialog)
{ ui->verboseCheckBox, "analysis.verbose" } }; { ui->verboseCheckBox, "analysis.verbose" } };
// Create list of options for the analysis.in selector // Create list of options for the analysis.in selector
createAnalInOptionsList(); createAnalysisInOptionsList();
// Connect each checkbox from "checkboxes" to the generic signal "checkboxEnabler" // Connect each checkbox from "checkboxes" to the generic signal "checkboxEnabler"
for (ConfigCheckbox &confCheckbox : checkboxes) { for (ConfigCheckbox &confCheckbox : checkboxes) {
@ -45,23 +45,23 @@ AnalOptionsWidget::AnalOptionsWidget(PreferencesDialog *dialog)
auto *mainWindow = new MainWindow(this); auto *mainWindow = new MainWindow(this);
connect(ui->analyzePushButton, &QPushButton::clicked, mainWindow, connect(ui->analyzePushButton, &QPushButton::clicked, mainWindow,
&MainWindow::on_actionAnalyze_triggered); &MainWindow::on_actionAnalyze_triggered);
connect<void (QComboBox::*)(int)>(ui->analInComboBox, &QComboBox::currentIndexChanged, this, connect<void (QComboBox::*)(int)>(ui->analysisInComboBox, &QComboBox::currentIndexChanged, this,
&AnalOptionsWidget::updateAnalIn); &AnalysisOptionsWidget::updateAnalysisIn);
connect<void (QSpinBox::*)(int)>(ui->ptrDepthSpinBox, &QSpinBox::valueChanged, this, connect<void (QSpinBox::*)(int)>(ui->ptrDepthSpinBox, &QSpinBox::valueChanged, this,
&AnalOptionsWidget::updateAnalPtrDepth); &AnalysisOptionsWidget::updateAnalysisPtrDepth);
connect(ui->preludeLineEdit, &QLineEdit::textChanged, this, connect(ui->preludeLineEdit, &QLineEdit::textChanged, this,
&AnalOptionsWidget::updateAnalPrelude); &AnalysisOptionsWidget::updateAnalysisPrelude);
updateAnalOptionsFromVars(); updateAnalysisOptionsFromVars();
} }
AnalOptionsWidget::~AnalOptionsWidget() {} AnalysisOptionsWidget::~AnalysisOptionsWidget() {}
void AnalOptionsWidget::checkboxEnabler(QCheckBox *checkBox, const QString &config) void AnalysisOptionsWidget::checkboxEnabler(QCheckBox *checkBox, const QString &config)
{ {
Config()->setConfig(config, checkBox->isChecked()); Config()->setConfig(config, checkBox->isChecked());
} }
void AnalOptionsWidget::updateAnalOptionsFromVars() void AnalysisOptionsWidget::updateAnalysisOptionsFromVars()
{ {
for (ConfigCheckbox &confCheckbox : checkboxes) { for (ConfigCheckbox &confCheckbox : checkboxes) {
qhelpers::setCheckedWithoutSignals(confCheckbox.checkBox, qhelpers::setCheckedWithoutSignals(confCheckbox.checkBox,
@ -69,36 +69,36 @@ void AnalOptionsWidget::updateAnalOptionsFromVars()
} }
// Update the rest of analysis options that are not checkboxes // Update the rest of analysis options that are not checkboxes
ui->analInComboBox->setCurrentIndex( ui->analysisInComboBox->setCurrentIndex(
ui->analInComboBox->findData(Core()->getConfig("analysis.in"))); ui->analysisInComboBox->findData(Core()->getConfig("analysis.in")));
ui->ptrDepthSpinBox->setValue(Core()->getConfigi("analysis.ptrdepth")); ui->ptrDepthSpinBox->setValue(Core()->getConfigi("analysis.ptrdepth"));
ui->preludeLineEdit->setText(Core()->getConfig("analysis.prelude")); ui->preludeLineEdit->setText(Core()->getConfig("analysis.prelude"));
} }
void AnalOptionsWidget::updateAnalIn(int index) void AnalysisOptionsWidget::updateAnalysisIn(int index)
{ {
Config()->setConfig("analysis.in", ui->analInComboBox->itemData(index).toString()); Config()->setConfig("analysis.in", ui->analysisInComboBox->itemData(index).toString());
} }
void AnalOptionsWidget::updateAnalPtrDepth(int value) void AnalysisOptionsWidget::updateAnalysisPtrDepth(int value)
{ {
Config()->setConfig("analysis.ptrdepth", value); Config()->setConfig("analysis.ptrdepth", value);
} }
void AnalOptionsWidget::updateAnalPrelude(const QString &prelude) void AnalysisOptionsWidget::updateAnalysisPrelude(const QString &prelude)
{ {
Config()->setConfig("analysis.prelude", prelude); Config()->setConfig("analysis.prelude", prelude);
} }
void AnalOptionsWidget::createAnalInOptionsList() void AnalysisOptionsWidget::createAnalysisInOptionsList()
{ {
QHash<QString, QString>::const_iterator mapIter; QHash<QString, QString>::const_iterator mapIter;
mapIter = analBoundaries.cbegin(); mapIter = analysisBoundaries.cbegin();
ui->analInComboBox->blockSignals(true); ui->analysisInComboBox->blockSignals(true);
ui->analInComboBox->clear(); ui->analysisInComboBox->clear();
for (; mapIter != analBoundaries.cend(); ++mapIter) { for (; mapIter != analysisBoundaries.cend(); ++mapIter) {
ui->analInComboBox->addItem(mapIter.value(), mapIter.key()); ui->analysisInComboBox->addItem(mapIter.value(), mapIter.key());
} }
ui->analInComboBox->blockSignals(false); ui->analysisInComboBox->blockSignals(false);
} }

View File

@ -9,19 +9,19 @@
class PreferencesDialog; class PreferencesDialog;
namespace Ui { namespace Ui {
class AnalOptionsWidget; class AnalysisOptionsWidget;
} }
class AnalOptionsWidget : public QDialog class AnalysisOptionsWidget : public QDialog
{ {
Q_OBJECT Q_OBJECT
public: public:
explicit AnalOptionsWidget(PreferencesDialog *dialog); explicit AnalysisOptionsWidget(PreferencesDialog *dialog);
~AnalOptionsWidget(); ~AnalysisOptionsWidget();
private: private:
std::unique_ptr<Ui::AnalOptionsWidget> ui; std::unique_ptr<Ui::AnalysisOptionsWidget> ui;
struct ConfigCheckbox struct ConfigCheckbox
{ {
QCheckBox *checkBox; QCheckBox *checkBox;
@ -33,14 +33,14 @@ private:
* @brief This function creates the list with the different options shown in the selector for * @brief This function creates the list with the different options shown in the selector for
* analysis.in * analysis.in
*/ */
void createAnalInOptionsList(); void createAnalysisInOptionsList();
private slots: private slots:
/** /**
* @brief A slot to display the options in the dialog according to the current analysis.* * @brief A slot to display the options in the dialog according to the current analysis.*
* configuration * configuration
*/ */
void updateAnalOptionsFromVars(); void updateAnalysisOptionsFromVars();
/** /**
* @brief A generic slot to handle the simple cases where a checkbox is toggled * @brief A generic slot to handle the simple cases where a checkbox is toggled
@ -54,20 +54,20 @@ private slots:
* @brief A slot to update the value of analysis.in when a different option is selected * @brief A slot to update the value of analysis.in when a different option is selected
* @param index - The index of the selected option for analysis.in * @param index - The index of the selected option for analysis.in
*/ */
void updateAnalIn(int index); void updateAnalysisIn(int index);
/** /**
* @brief A slot to update the value of analysis.ptrdepth when a new value is selected * @brief A slot to update the value of analysis.ptrdepth when a new value is selected
* @param value - The new value for analysis.ptrdepth * @param value - The new value for analysis.ptrdepth
*/ */
static void updateAnalPtrDepth(int value); static void updateAnalysisPtrDepth(int value);
/** /**
* @brief slot to update the value of analysis.prelude when a new value is introduced in the * @brief slot to update the value of analysis.prelude when a new value is introduced in the
* corresponding textbox * corresponding textbox
* @param prelude - The new value for analysis.prelude * @param prelude - The new value for analysis.prelude
*/ */
static void updateAnalPrelude(const QString &prelude); static void updateAnalysisPrelude(const QString &prelude);
}; };
#endif // ANALOPTIONSWIDGET_H #endif // ANALOPTIONSWIDGET_H

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0"> <ui version="4.0">
<class>AnalOptionsWidget</class> <class>AnalysisOptionsWidget</class>
<widget class="QWidget" name="AnalOptionsWidget"> <widget class="QWidget" name="AnalysisOptionsWidget">
<property name="geometry"> <property name="geometry">
<rect> <rect>
<x>0</x> <x>0</x>
@ -163,7 +163,7 @@
</widget> </widget>
</item> </item>
<item row="0" column="1"> <item row="0" column="1">
<widget class="QComboBox" name="analInComboBox"/> <widget class="QComboBox" name="analysisInComboBox"/>
</item> </item>
</layout> </layout>
</widget> </widget>

View File

@ -7,7 +7,7 @@
#include "DebugOptionsWidget.h" #include "DebugOptionsWidget.h"
#include "PluginsOptionsWidget.h" #include "PluginsOptionsWidget.h"
#include "InitializationFileEditor.h" #include "InitializationFileEditor.h"
#include "AnalOptionsWidget.h" #include "AnalysisOptionsWidget.h"
#include "PreferenceCategory.h" #include "PreferenceCategory.h"
@ -36,7 +36,7 @@ PreferencesDialog::PreferencesDialog(QWidget *parent)
{ tr("Plugins"), new PluginsOptionsWidget(this), QIcon(":/img/icons/plugins.svg") }, { tr("Plugins"), new PluginsOptionsWidget(this), QIcon(":/img/icons/plugins.svg") },
{ tr("Initialization Script"), new InitializationFileEditor(this), { tr("Initialization Script"), new InitializationFileEditor(this),
QIcon(":/img/icons/initialization.svg") }, QIcon(":/img/icons/initialization.svg") },
{ tr("Analysis"), new AnalOptionsWidget(this), QIcon(":/img/icons/cog_light.svg") } { tr("Analysis"), new AnalysisOptionsWidget(this), QIcon(":/img/icons/cog_light.svg") }
}; };
for (auto &c : prefs) { for (auto &c : prefs) {

View File

@ -204,24 +204,24 @@ QVariant BinClassesModel::data(const QModelIndex &index, int role) const
} }
} }
AnalClassesModel::AnalClassesModel(CutterDockWidget *parent) AnalysisClassesModel::AnalysisClassesModel(CutterDockWidget *parent)
: ClassesModel(parent), attrs(new QMap<QString, QVector<Attribute>>) : ClassesModel(parent), attrs(new QMap<QString, QVector<Attribute>>)
{ {
// Just use a simple refresh deferrer. If an event was triggered in the background, simply // Just use a simple refresh deferrer. If an event was triggered in the background, simply
// refresh everything later. // refresh everything later.
refreshDeferrer = parent->createRefreshDeferrer([this]() { this->refreshAll(); }); refreshDeferrer = parent->createRefreshDeferrer([this]() { this->refreshAll(); });
connect(Core(), &CutterCore::refreshAll, this, &AnalClassesModel::refreshAll); connect(Core(), &CutterCore::refreshAll, this, &AnalysisClassesModel::refreshAll);
connect(Core(), &CutterCore::codeRebased, this, &AnalClassesModel::refreshAll); connect(Core(), &CutterCore::codeRebased, this, &AnalysisClassesModel::refreshAll);
connect(Core(), &CutterCore::classNew, this, &AnalClassesModel::classNew); connect(Core(), &CutterCore::classNew, this, &AnalysisClassesModel::classNew);
connect(Core(), &CutterCore::classDeleted, this, &AnalClassesModel::classDeleted); connect(Core(), &CutterCore::classDeleted, this, &AnalysisClassesModel::classDeleted);
connect(Core(), &CutterCore::classRenamed, this, &AnalClassesModel::classRenamed); connect(Core(), &CutterCore::classRenamed, this, &AnalysisClassesModel::classRenamed);
connect(Core(), &CutterCore::classAttrsChanged, this, &AnalClassesModel::classAttrsChanged); connect(Core(), &CutterCore::classAttrsChanged, this, &AnalysisClassesModel::classAttrsChanged);
refreshAll(); refreshAll();
} }
void AnalClassesModel::refreshAll() void AnalysisClassesModel::refreshAll()
{ {
if (!refreshDeferrer->attemptRefresh(nullptr)) { if (!refreshDeferrer->attemptRefresh(nullptr)) {
return; return;
@ -229,11 +229,11 @@ void AnalClassesModel::refreshAll()
beginResetModel(); beginResetModel();
attrs->clear(); attrs->clear();
classes = Core()->getAllAnalClasses(true); // must be sorted classes = Core()->getAllAnalysisClasses(true); // must be sorted
endResetModel(); endResetModel();
} }
void AnalClassesModel::classNew(const QString &cls) void AnalysisClassesModel::classNew(const QString &cls)
{ {
if (!refreshDeferrer->attemptRefresh(nullptr)) { if (!refreshDeferrer->attemptRefresh(nullptr)) {
return; return;
@ -247,7 +247,7 @@ void AnalClassesModel::classNew(const QString &cls)
endInsertRows(); endInsertRows();
} }
void AnalClassesModel::classDeleted(const QString &cls) void AnalysisClassesModel::classDeleted(const QString &cls)
{ {
if (!refreshDeferrer->attemptRefresh(nullptr)) { if (!refreshDeferrer->attemptRefresh(nullptr)) {
return; return;
@ -264,7 +264,7 @@ void AnalClassesModel::classDeleted(const QString &cls)
endRemoveRows(); endRemoveRows();
} }
void AnalClassesModel::classRenamed(const QString &oldName, const QString &newName) void AnalysisClassesModel::classRenamed(const QString &oldName, const QString &newName)
{ {
if (!refreshDeferrer->attemptRefresh(nullptr)) { if (!refreshDeferrer->attemptRefresh(nullptr)) {
return; return;
@ -296,7 +296,7 @@ void AnalClassesModel::classRenamed(const QString &oldName, const QString &newNa
emit dataChanged(index(newRow, 0), index(newRow, 0)); emit dataChanged(index(newRow, 0), index(newRow, 0));
} }
void AnalClassesModel::classAttrsChanged(const QString &cls) void AnalysisClassesModel::classAttrsChanged(const QString &cls)
{ {
if (!refreshDeferrer->attemptRefresh(nullptr)) { if (!refreshDeferrer->attemptRefresh(nullptr)) {
return; return;
@ -312,35 +312,35 @@ void AnalClassesModel::classAttrsChanged(const QString &cls)
layoutChanged({ persistentIndex }); layoutChanged({ persistentIndex });
} }
const QVector<AnalClassesModel::Attribute> &AnalClassesModel::getAttrs(const QString &cls) const const QVector<AnalysisClassesModel::Attribute> &AnalysisClassesModel::getAttrs(const QString &cls) const
{ {
auto it = attrs->find(cls); auto it = attrs->find(cls);
if (it != attrs->end()) { if (it != attrs->end()) {
return it.value(); return it.value();
} }
QVector<AnalClassesModel::Attribute> clsAttrs; QVector<AnalysisClassesModel::Attribute> clsAttrs;
QList<AnalBaseClassDescription> bases = Core()->getAnalClassBaseClasses(cls); QList<AnalysisBaseClassDescription> bases = Core()->getAnalysisClassBaseClasses(cls);
QList<AnalMethodDescription> meths = Core()->getAnalClassMethods(cls); QList<AnalysisMethodDescription> meths = Core()->getAnalysisClassMethods(cls);
QList<AnalVTableDescription> vtables = Core()->getAnalClassVTables(cls); QList<AnalysisVTableDescription> vtables = Core()->getAnalysisClassVTables(cls);
clsAttrs.reserve(bases.size() + meths.size() + vtables.size()); clsAttrs.reserve(bases.size() + meths.size() + vtables.size());
for (const AnalBaseClassDescription &base : bases) { for (const AnalysisBaseClassDescription &base : bases) {
clsAttrs.push_back(Attribute(Attribute::Type::Base, QVariant::fromValue(base))); clsAttrs.push_back(Attribute(Attribute::Type::Base, QVariant::fromValue(base)));
} }
for (const AnalVTableDescription &vtable : vtables) { for (const AnalysisVTableDescription &vtable : vtables) {
clsAttrs.push_back(Attribute(Attribute::Type::VTable, QVariant::fromValue(vtable))); clsAttrs.push_back(Attribute(Attribute::Type::VTable, QVariant::fromValue(vtable)));
} }
for (const AnalMethodDescription &meth : meths) { for (const AnalysisMethodDescription &meth : meths) {
clsAttrs.push_back(Attribute(Attribute::Type::Method, QVariant::fromValue(meth))); clsAttrs.push_back(Attribute(Attribute::Type::Method, QVariant::fromValue(meth)));
} }
return attrs->insert(cls, clsAttrs).value(); return attrs->insert(cls, clsAttrs).value();
} }
QModelIndex AnalClassesModel::index(int row, int column, const QModelIndex &parent) const QModelIndex AnalysisClassesModel::index(int row, int column, const QModelIndex &parent) const
{ {
if (!parent.isValid()) { if (!parent.isValid()) {
return createIndex(row, column, (quintptr)0); // root function nodes have id = 0 return createIndex(row, column, (quintptr)0); // root function nodes have id = 0
@ -350,7 +350,7 @@ QModelIndex AnalClassesModel::index(int row, int column, const QModelIndex &pare
(quintptr)parent.row() + 1); // sub-nodes have id = class index + 1 (quintptr)parent.row() + 1); // sub-nodes have id = class index + 1
} }
QModelIndex AnalClassesModel::parent(const QModelIndex &index) const QModelIndex AnalysisClassesModel::parent(const QModelIndex &index) const
{ {
if (!index.isValid()) { if (!index.isValid()) {
return {}; return {};
@ -363,7 +363,7 @@ QModelIndex AnalClassesModel::parent(const QModelIndex &index) const
} }
} }
int AnalClassesModel::rowCount(const QModelIndex &parent) const int AnalysisClassesModel::rowCount(const QModelIndex &parent) const
{ {
if (!parent.isValid()) { // root if (!parent.isValid()) { // root
return classes.count(); return classes.count();
@ -376,17 +376,17 @@ int AnalClassesModel::rowCount(const QModelIndex &parent) const
return 0; // below methods/fields return 0; // below methods/fields
} }
bool AnalClassesModel::hasChildren(const QModelIndex &parent) const bool AnalysisClassesModel::hasChildren(const QModelIndex &parent) const
{ {
return !parent.isValid() || !parent.parent().isValid(); return !parent.isValid() || !parent.parent().isValid();
} }
int AnalClassesModel::columnCount(const QModelIndex &) const int AnalysisClassesModel::columnCount(const QModelIndex &) const
{ {
return Columns::COUNT; return Columns::COUNT;
} }
QVariant AnalClassesModel::data(const QModelIndex &index, int role) const QVariant AnalysisClassesModel::data(const QModelIndex &index, int role) const
{ {
if (index.internalId() == 0) { // class row if (index.internalId() == 0) { // class row
if (index.row() >= classes.count()) { if (index.row() >= classes.count()) {
@ -417,7 +417,7 @@ QVariant AnalClassesModel::data(const QModelIndex &index, int role) const
switch (attr.type) { switch (attr.type) {
case Attribute::Type::Base: { case Attribute::Type::Base: {
AnalBaseClassDescription base = attr.data.value<AnalBaseClassDescription>(); AnalysisBaseClassDescription base = attr.data.value<AnalysisBaseClassDescription>();
switch (role) { switch (role) {
case Qt::DisplayRole: case Qt::DisplayRole:
switch (index.column()) { switch (index.column()) {
@ -448,7 +448,7 @@ QVariant AnalClassesModel::data(const QModelIndex &index, int role) const
break; break;
} }
case Attribute::Type::Method: { case Attribute::Type::Method: {
AnalMethodDescription meth = attr.data.value<AnalMethodDescription>(); AnalysisMethodDescription meth = attr.data.value<AnalysisMethodDescription>();
switch (role) { switch (role) {
case Qt::DisplayRole: case Qt::DisplayRole:
switch (index.column()) { switch (index.column()) {
@ -484,7 +484,7 @@ QVariant AnalClassesModel::data(const QModelIndex &index, int role) const
break; break;
} }
case Attribute::Type::VTable: { case Attribute::Type::VTable: {
AnalVTableDescription vtable = attr.data.value<AnalVTableDescription>(); AnalysisVTableDescription vtable = attr.data.value<AnalysisVTableDescription>();
switch (role) { switch (role) {
case Qt::DisplayRole: case Qt::DisplayRole:
switch (index.column()) { switch (index.column()) {
@ -619,7 +619,7 @@ void ClassesWidget::refreshClasses()
proxy_model->setSourceModel(nullptr); proxy_model->setSourceModel(nullptr);
delete bin_model; delete bin_model;
bin_model = nullptr; bin_model = nullptr;
analysis_model = new AnalClassesModel(this); analysis_model = new AnalysisClassesModel(this);
proxy_model->setSourceModel(analysis_model); proxy_model->setSourceModel(analysis_model);
} }
break; break;
@ -674,8 +674,8 @@ void ClassesWidget::showContextMenu(const QPoint &pt)
QString className = index.parent().data(ClassesModel::NameRole).toString(); QString className = index.parent().data(ClassesModel::NameRole).toString();
QString methodName = index.data(ClassesModel::NameRole).toString(); QString methodName = index.data(ClassesModel::NameRole).toString();
AnalMethodDescription desc; AnalysisMethodDescription desc;
if (Core()->getAnalMethod(className, methodName, &desc)) { if (Core()->getAnalysisMethod(className, methodName, &desc)) {
if (desc.vtableOffset >= 0) { if (desc.vtableOffset >= 0) {
menu.addAction(ui->seekToVTableAction); menu.addAction(ui->seekToVTableAction);
} }
@ -690,7 +690,7 @@ void ClassesWidget::on_seekToVTableAction_triggered()
QModelIndex index = ui->classesTreeView->selectionModel()->currentIndex(); QModelIndex index = ui->classesTreeView->selectionModel()->currentIndex();
QString className = index.parent().data(ClassesModel::NameRole).toString(); QString className = index.parent().data(ClassesModel::NameRole).toString();
QList<AnalVTableDescription> vtables = Core()->getAnalClassVTables(className); QList<AnalysisVTableDescription> vtables = Core()->getAnalysisClassVTables(className);
if (vtables.isEmpty()) { if (vtables.isEmpty()) {
QMessageBox::warning(this, tr("Missing VTable in class"), QMessageBox::warning(this, tr("Missing VTable in class"),
tr("The class %1 does not have any VTable!").arg(className)); tr("The class %1 does not have any VTable!").arg(className));
@ -698,8 +698,8 @@ void ClassesWidget::on_seekToVTableAction_triggered()
} }
QString methodName = index.data(ClassesModel::NameRole).toString(); QString methodName = index.data(ClassesModel::NameRole).toString();
AnalMethodDescription desc; AnalysisMethodDescription desc;
if (!Core()->getAnalMethod(className, methodName, &desc) || desc.vtableOffset < 0) { if (!Core()->getAnalysisMethod(className, methodName, &desc) || desc.vtableOffset < 0) {
return; return;
} }

View File

@ -90,7 +90,7 @@ public:
void setClasses(const QList<BinClassDescription> &classes); void setClasses(const QList<BinClassDescription> &classes);
}; };
class AnalClassesModel : public ClassesModel class AnalysisClassesModel : public ClassesModel
{ {
Q_OBJECT Q_OBJECT
@ -145,7 +145,7 @@ private:
QVariant data(const QModelIndex &index, int role) const override; QVariant data(const QModelIndex &index, int role) const override;
public: public:
explicit AnalClassesModel(CutterDockWidget *parent); explicit AnalysisClassesModel(CutterDockWidget *parent);
public slots: public slots:
void refreshAll(); void refreshAll();
@ -198,7 +198,7 @@ private:
std::unique_ptr<Ui::ClassesWidget> ui; std::unique_ptr<Ui::ClassesWidget> ui;
BinClassesModel *bin_model = nullptr; BinClassesModel *bin_model = nullptr;
AnalClassesModel *analysis_model = nullptr; AnalysisClassesModel *analysis_model = nullptr;
ClassesSortFilterProxyModel *proxy_model; ClassesSortFilterProxyModel *proxy_model;
}; };