mirror of
https://github.com/rizinorg/cutter.git
synced 2024-11-23 12:59:59 +00:00
Minor renames of analysis-related things (#2761)
This commit is contained in:
parent
57f34bfb98
commit
5595193b70
@ -24,7 +24,7 @@ set(SOURCES
|
||||
common/DirectionalComboBox.cpp
|
||||
dialogs/preferences/AsmOptionsWidget.cpp
|
||||
dialogs/NewFileDialog.cpp
|
||||
common/AnalTask.cpp
|
||||
common/AnalysisTask.cpp
|
||||
widgets/CommentsWidget.cpp
|
||||
widgets/ConsoleWidget.cpp
|
||||
widgets/Dashboard.cpp
|
||||
@ -139,7 +139,7 @@ set(SOURCES
|
||||
widgets/RizinGraphWidget.cpp
|
||||
widgets/CallGraph.cpp
|
||||
widgets/AddressableDockWidget.cpp
|
||||
dialogs/preferences/AnalOptionsWidget.cpp
|
||||
dialogs/preferences/AnalysisOptionsWidget.cpp
|
||||
common/DecompilerHighlighter.cpp
|
||||
dialogs/GlibcHeapInfoDialog.cpp
|
||||
widgets/HeapDockWidget.cpp
|
||||
@ -173,7 +173,7 @@ set(HEADER_FILES
|
||||
common/DirectionalComboBox.h
|
||||
dialogs/InitialOptionsDialog.h
|
||||
dialogs/NewFileDialog.h
|
||||
common/AnalTask.h
|
||||
common/AnalysisTask.h
|
||||
widgets/CommentsWidget.h
|
||||
widgets/ConsoleWidget.h
|
||||
widgets/Dashboard.h
|
||||
@ -298,7 +298,7 @@ set(HEADER_FILES
|
||||
widgets/RizinGraphWidget.h
|
||||
widgets/CallGraph.h
|
||||
widgets/AddressableDockWidget.h
|
||||
dialogs/preferences/AnalOptionsWidget.h
|
||||
dialogs/preferences/AnalysisOptionsWidget.h
|
||||
common/DecompilerHighlighter.h
|
||||
dialogs/GlibcHeapInfoDialog.h
|
||||
widgets/HeapDockWidget.h
|
||||
@ -371,7 +371,7 @@ set(UI_FILES
|
||||
widgets/ListDockWidget.ui
|
||||
dialogs/LayoutManager.ui
|
||||
widgets/RizinGraphWidget.ui
|
||||
dialogs/preferences/AnalOptionsWidget.ui
|
||||
dialogs/preferences/AnalysisOptionsWidget.ui
|
||||
dialogs/GlibcHeapInfoDialog.ui
|
||||
widgets/HeapDockWidget.ui
|
||||
widgets/GlibcHeapWidget.ui
|
||||
|
@ -149,7 +149,7 @@ CutterApplication::CutterApplication(int &argc, char **argv) : QApplication(argc
|
||||
}
|
||||
mainWindow->displayNewFileDialog();
|
||||
} else { // filename specified as positional argument
|
||||
bool askOptions = (clOptions.analLevel != AutomaticAnalysisLevel::Ask)
|
||||
bool askOptions = (clOptions.analysisLevel != AutomaticAnalysisLevel::Ask)
|
||||
|| !clOptions.fileOpenOptions.projectFile.isEmpty();
|
||||
mainWindow->openNewFile(clOptions.fileOpenOptions, askOptions);
|
||||
}
|
||||
@ -378,30 +378,30 @@ bool CutterApplication::parseCommandLineOptions()
|
||||
opts.args = cmd_parser.positionalArguments();
|
||||
|
||||
if (cmd_parser.isSet(analOption)) {
|
||||
bool analLevelSpecified = false;
|
||||
int analLevel = cmd_parser.value(analOption).toInt(&analLevelSpecified);
|
||||
bool analysisLevelSpecified = false;
|
||||
int analysisLevel = cmd_parser.value(analOption).toInt(&analysisLevelSpecified);
|
||||
|
||||
if (!analLevelSpecified || analLevel < 0 || analLevel > 2) {
|
||||
if (!analysisLevelSpecified || analysisLevel < 0 || analysisLevel > 2) {
|
||||
fprintf(stderr, "%s\n",
|
||||
QObject::tr("Invalid Analysis Level. May be a value between 0 and 2.")
|
||||
.toLocal8Bit()
|
||||
.constData());
|
||||
return false;
|
||||
}
|
||||
switch (analLevel) {
|
||||
switch (analysisLevel) {
|
||||
case 0:
|
||||
opts.analLevel = AutomaticAnalysisLevel::None;
|
||||
opts.analysisLevel = AutomaticAnalysisLevel::None;
|
||||
break;
|
||||
case 1:
|
||||
opts.analLevel = AutomaticAnalysisLevel::AAA;
|
||||
opts.analysisLevel = AutomaticAnalysisLevel::AAA;
|
||||
break;
|
||||
case 2:
|
||||
opts.analLevel = AutomaticAnalysisLevel::AAAA;
|
||||
opts.analysisLevel = AutomaticAnalysisLevel::AAAA;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (opts.args.empty() && opts.analLevel != AutomaticAnalysisLevel::Ask) {
|
||||
if (opts.args.empty() && opts.analysisLevel != AutomaticAnalysisLevel::Ask) {
|
||||
fprintf(stderr, "%s\n",
|
||||
QObject::tr("Filename must be specified to start analysis automatically.")
|
||||
.toLocal8Bit()
|
||||
@ -420,17 +420,17 @@ bool CutterApplication::parseCommandLineOptions()
|
||||
options.binLoadAddr = baddr;
|
||||
}
|
||||
}
|
||||
switch (opts.analLevel) {
|
||||
switch (opts.analysisLevel) {
|
||||
case AutomaticAnalysisLevel::Ask:
|
||||
break;
|
||||
case AutomaticAnalysisLevel::None:
|
||||
opts.fileOpenOptions.analCmd = {};
|
||||
opts.fileOpenOptions.analysisCmd = {};
|
||||
break;
|
||||
case AutomaticAnalysisLevel::AAA:
|
||||
opts.fileOpenOptions.analCmd = { { "aaa", "Auto analysis" } };
|
||||
opts.fileOpenOptions.analysisCmd = { { "aaa", "Auto analysis" } };
|
||||
break;
|
||||
case AutomaticAnalysisLevel::AAAA:
|
||||
opts.fileOpenOptions.analCmd = { { "aaaa", "Auto analysis (experimental)" } };
|
||||
opts.fileOpenOptions.analysisCmd = { { "aaaa", "Auto analysis (experimental)" } };
|
||||
break;
|
||||
}
|
||||
opts.fileOpenOptions.script = cmd_parser.value(scriptOption);
|
||||
|
@ -13,7 +13,7 @@ enum class AutomaticAnalysisLevel { Ask, None, AAA, AAAA };
|
||||
struct CutterCommandLineOptions
|
||||
{
|
||||
QStringList args;
|
||||
AutomaticAnalysisLevel analLevel = AutomaticAnalysisLevel::Ask;
|
||||
AutomaticAnalysisLevel analysisLevel = AutomaticAnalysisLevel::Ask;
|
||||
InitialOptions fileOpenOptions;
|
||||
QString pythonHome;
|
||||
bool outputRedirectionEnabled = true;
|
||||
|
@ -1,22 +1,22 @@
|
||||
#include "core/Cutter.h"
|
||||
#include "common/AnalTask.h"
|
||||
#include "common/AnalysisTask.h"
|
||||
#include "core/MainWindow.h"
|
||||
#include "dialogs/InitialOptionsDialog.h"
|
||||
#include <QJsonArray>
|
||||
#include <QDebug>
|
||||
#include <QCheckBox>
|
||||
|
||||
AnalTask::AnalTask() : AsyncTask() {}
|
||||
AnalysisTask::AnalysisTask() : AsyncTask() {}
|
||||
|
||||
AnalTask::~AnalTask() {}
|
||||
AnalysisTask::~AnalysisTask() {}
|
||||
|
||||
void AnalTask::interrupt()
|
||||
void AnalysisTask::interrupt()
|
||||
{
|
||||
AsyncTask::interrupt();
|
||||
rz_cons_singleton()->context->breaked = true;
|
||||
}
|
||||
|
||||
QString AnalTask::getTitle()
|
||||
QString AnalysisTask::getTitle()
|
||||
{
|
||||
// If no file is loaded we consider it's Initial Analysis
|
||||
RzCoreLocked core(Core());
|
||||
@ -27,7 +27,7 @@ QString AnalTask::getTitle()
|
||||
return tr("Analyzing Program");
|
||||
}
|
||||
|
||||
void AnalTask::runTask()
|
||||
void AnalysisTask::runTask()
|
||||
{
|
||||
int perms = RZ_PERM_RX;
|
||||
if (options.writeEnabled) {
|
||||
@ -96,9 +96,9 @@ void AnalTask::runTask()
|
||||
return;
|
||||
}
|
||||
|
||||
if (!options.analCmd.empty()) {
|
||||
if (!options.analysisCmd.empty()) {
|
||||
log(tr("Executing analysis..."));
|
||||
for (const CommandDescription &cmd : options.analCmd) {
|
||||
for (const CommandDescription &cmd : options.analysisCmd) {
|
||||
if (isInterrupted()) {
|
||||
return;
|
||||
}
|
@ -9,13 +9,13 @@ class CutterCore;
|
||||
class MainWindow;
|
||||
class InitialOptionsDialog;
|
||||
|
||||
class AnalTask : public AsyncTask
|
||||
class AnalysisTask : public AsyncTask
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit AnalTask();
|
||||
~AnalTask();
|
||||
explicit AnalysisTask();
|
||||
~AnalysisTask();
|
||||
|
||||
QString getTitle() override;
|
||||
|
@ -40,7 +40,7 @@ struct InitialOptions
|
||||
QString pdbFile;
|
||||
QString script;
|
||||
|
||||
QList<CommandDescription> analCmd = { { "aaa", "Auto analysis" } };
|
||||
QList<CommandDescription> analysisCmd = { { "aaa", "Auto analysis" } };
|
||||
|
||||
QString shellcode;
|
||||
};
|
||||
|
@ -2706,7 +2706,7 @@ QStringList CutterCore::getAsmPluginNames()
|
||||
return ret;
|
||||
}
|
||||
|
||||
QStringList CutterCore::getAnalPluginNames()
|
||||
QStringList CutterCore::getAnalysisPluginNames()
|
||||
{
|
||||
CORE_LOCK();
|
||||
RzListIter *it;
|
||||
@ -3305,7 +3305,7 @@ QList<BinClassDescription> CutterCore::getAllClassesFromFlags()
|
||||
return ret;
|
||||
}
|
||||
|
||||
QList<QString> CutterCore::getAllAnalClasses(bool sorted)
|
||||
QList<QString> CutterCore::getAllAnalysisClasses(bool sorted)
|
||||
{
|
||||
CORE_LOCK();
|
||||
QList<QString> ret;
|
||||
@ -3327,10 +3327,10 @@ QList<QString> CutterCore::getAllAnalClasses(bool sorted)
|
||||
return ret;
|
||||
}
|
||||
|
||||
QList<AnalMethodDescription> CutterCore::getAnalClassMethods(const QString &cls)
|
||||
QList<AnalysisMethodDescription> CutterCore::getAnalysisClassMethods(const QString &cls)
|
||||
{
|
||||
CORE_LOCK();
|
||||
QList<AnalMethodDescription> ret;
|
||||
QList<AnalysisMethodDescription> ret;
|
||||
|
||||
RzVector *meths = rz_analysis_class_method_get_all(core->analysis, cls.toUtf8().constData());
|
||||
if (!meths) {
|
||||
@ -3341,7 +3341,7 @@ QList<AnalMethodDescription> CutterCore::getAnalClassMethods(const QString &cls)
|
||||
RzAnalysisMethod *meth;
|
||||
CutterRzVectorForeach(meths, meth, RzAnalysisMethod)
|
||||
{
|
||||
AnalMethodDescription desc;
|
||||
AnalysisMethodDescription desc;
|
||||
desc.name = QString::fromUtf8(meth->name);
|
||||
desc.addr = meth->addr;
|
||||
desc.vtableOffset = meth->vtable_offset;
|
||||
@ -3352,10 +3352,10 @@ QList<AnalMethodDescription> CutterCore::getAnalClassMethods(const QString &cls)
|
||||
return ret;
|
||||
}
|
||||
|
||||
QList<AnalBaseClassDescription> CutterCore::getAnalClassBaseClasses(const QString &cls)
|
||||
QList<AnalysisBaseClassDescription> CutterCore::getAnalysisClassBaseClasses(const QString &cls)
|
||||
{
|
||||
CORE_LOCK();
|
||||
QList<AnalBaseClassDescription> ret;
|
||||
QList<AnalysisBaseClassDescription> ret;
|
||||
|
||||
RzVector *bases = rz_analysis_class_base_get_all(core->analysis, cls.toUtf8().constData());
|
||||
if (!bases) {
|
||||
@ -3366,7 +3366,7 @@ QList<AnalBaseClassDescription> CutterCore::getAnalClassBaseClasses(const QStrin
|
||||
RzAnalysisBaseClass *base;
|
||||
CutterRzVectorForeach(bases, base, RzAnalysisBaseClass)
|
||||
{
|
||||
AnalBaseClassDescription desc;
|
||||
AnalysisBaseClassDescription desc;
|
||||
desc.id = QString::fromUtf8(base->id);
|
||||
desc.offset = base->offset;
|
||||
desc.className = QString::fromUtf8(base->class_name);
|
||||
@ -3377,10 +3377,10 @@ QList<AnalBaseClassDescription> CutterCore::getAnalClassBaseClasses(const QStrin
|
||||
return ret;
|
||||
}
|
||||
|
||||
QList<AnalVTableDescription> CutterCore::getAnalClassVTables(const QString &cls)
|
||||
QList<AnalysisVTableDescription> CutterCore::getAnalysisClassVTables(const QString &cls)
|
||||
{
|
||||
CORE_LOCK();
|
||||
QList<AnalVTableDescription> acVtables;
|
||||
QList<AnalysisVTableDescription> acVtables;
|
||||
|
||||
RzVector *vtables = rz_analysis_class_vtable_get_all(core->analysis, cls.toUtf8().constData());
|
||||
if (!vtables) {
|
||||
@ -3391,7 +3391,7 @@ QList<AnalVTableDescription> CutterCore::getAnalClassVTables(const QString &cls)
|
||||
RzAnalysisVTable *vtable;
|
||||
CutterRzVectorForeach(vtables, vtable, RzAnalysisVTable)
|
||||
{
|
||||
AnalVTableDescription desc;
|
||||
AnalysisVTableDescription desc;
|
||||
desc.id = QString::fromUtf8(vtable->id);
|
||||
desc.offset = vtable->offset;
|
||||
desc.addr = vtable->addr;
|
||||
@ -3421,34 +3421,34 @@ void CutterCore::deleteClass(const QString &cls)
|
||||
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();
|
||||
RzAnalysisMethod analMeth;
|
||||
RzAnalysisMethod analysisMeth;
|
||||
if (rz_analysis_class_method_get(core->analysis, cls.toUtf8().constData(),
|
||||
meth.toUtf8().constData(), &analMeth)
|
||||
meth.toUtf8().constData(), &analysisMeth)
|
||||
!= RZ_ANALYSIS_CLASS_ERR_SUCCESS) {
|
||||
return false;
|
||||
}
|
||||
desc->name = QString::fromUtf8(analMeth.name);
|
||||
desc->addr = analMeth.addr;
|
||||
desc->vtableOffset = analMeth.vtable_offset;
|
||||
rz_analysis_class_method_fini(&analMeth);
|
||||
desc->name = QString::fromUtf8(analysisMeth.name);
|
||||
desc->addr = analysisMeth.addr;
|
||||
desc->vtableOffset = analysisMeth.vtable_offset;
|
||||
rz_analysis_class_method_fini(&analysisMeth);
|
||||
return true;
|
||||
}
|
||||
|
||||
void CutterCore::setAnalMethod(const QString &className, const AnalMethodDescription &meth)
|
||||
void CutterCore::setAnalysisMethod(const QString &className, const AnalysisMethodDescription &meth)
|
||||
{
|
||||
CORE_LOCK();
|
||||
RzAnalysisMethod analMeth;
|
||||
analMeth.name = strdup(meth.name.toUtf8().constData());
|
||||
analMeth.addr = meth.addr;
|
||||
analMeth.vtable_offset = meth.vtableOffset;
|
||||
rz_analysis_class_method_set(core->analysis, className.toUtf8().constData(), &analMeth);
|
||||
rz_analysis_class_method_fini(&analMeth);
|
||||
RzAnalysisMethod analysisMeth;
|
||||
analysisMeth.name = strdup(meth.name.toUtf8().constData());
|
||||
analysisMeth.addr = meth.addr;
|
||||
analysisMeth.vtable_offset = meth.vtableOffset;
|
||||
rz_analysis_class_method_set(core->analysis, className.toUtf8().constData(), &analysisMeth);
|
||||
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)
|
||||
{
|
||||
CORE_LOCK();
|
||||
|
@ -260,17 +260,17 @@ public:
|
||||
void applyStructureOffset(const QString &structureOffset, RVA offset = RVA_INVALID);
|
||||
|
||||
/* Classes */
|
||||
QList<QString> getAllAnalClasses(bool sorted);
|
||||
QList<AnalMethodDescription> getAnalClassMethods(const QString &cls);
|
||||
QList<AnalBaseClassDescription> getAnalClassBaseClasses(const QString &cls);
|
||||
QList<AnalVTableDescription> getAnalClassVTables(const QString &cls);
|
||||
QList<QString> getAllAnalysisClasses(bool sorted);
|
||||
QList<AnalysisMethodDescription> getAnalysisClassMethods(const QString &cls);
|
||||
QList<AnalysisBaseClassDescription> getAnalysisClassBaseClasses(const QString &cls);
|
||||
QList<AnalysisVTableDescription> getAnalysisClassVTables(const QString &cls);
|
||||
void createNewClass(const QString &cls);
|
||||
void renameClass(const QString &oldName, const QString &newName);
|
||||
void deleteClass(const QString &cls);
|
||||
bool getAnalMethod(const QString &cls, const QString &meth, AnalMethodDescription *desc);
|
||||
void renameAnalMethod(const QString &className, const QString &oldMethodName,
|
||||
bool getAnalysisMethod(const QString &cls, const QString &meth, AnalysisMethodDescription *desc);
|
||||
void renameAnalysisMethod(const QString &className, const QString &oldMethodName,
|
||||
const QString &newMethodName);
|
||||
void setAnalMethod(const QString &cls, const AnalMethodDescription &meth);
|
||||
void setAnalysisMethod(const QString &cls, const AnalysisMethodDescription &meth);
|
||||
|
||||
/* File related methods */
|
||||
bool loadFile(QString path, ut64 baddr = 0LL, ut64 mapaddr = 0LL, int perms = RZ_PERM_R,
|
||||
@ -531,7 +531,7 @@ public:
|
||||
|
||||
/* Plugins */
|
||||
QStringList getAsmPluginNames();
|
||||
QStringList getAnalPluginNames();
|
||||
QStringList getAnalysisPluginNames();
|
||||
|
||||
/* Widgets */
|
||||
QList<RzBinPluginDescription> getRBinPluginDescriptions(const QString &type = QString());
|
||||
|
@ -244,21 +244,21 @@ struct BinClassDescription
|
||||
QList<BinClassFieldDescription> fields;
|
||||
};
|
||||
|
||||
struct AnalMethodDescription
|
||||
struct AnalysisMethodDescription
|
||||
{
|
||||
QString name;
|
||||
RVA addr;
|
||||
st64 vtableOffset;
|
||||
};
|
||||
|
||||
struct AnalBaseClassDescription
|
||||
struct AnalysisBaseClassDescription
|
||||
{
|
||||
QString id;
|
||||
RVA offset;
|
||||
QString className;
|
||||
};
|
||||
|
||||
struct AnalVTableDescription
|
||||
struct AnalysisVTableDescription
|
||||
{
|
||||
QString id;
|
||||
ut64 offset;
|
||||
@ -404,9 +404,9 @@ Q_DECLARE_METATYPE(BinClassDescription)
|
||||
Q_DECLARE_METATYPE(const BinClassDescription *)
|
||||
Q_DECLARE_METATYPE(const BinClassMethodDescription *)
|
||||
Q_DECLARE_METATYPE(const BinClassFieldDescription *)
|
||||
Q_DECLARE_METATYPE(AnalBaseClassDescription)
|
||||
Q_DECLARE_METATYPE(AnalMethodDescription)
|
||||
Q_DECLARE_METATYPE(AnalVTableDescription)
|
||||
Q_DECLARE_METATYPE(AnalysisBaseClassDescription)
|
||||
Q_DECLARE_METATYPE(AnalysisMethodDescription)
|
||||
Q_DECLARE_METATYPE(AnalysisVTableDescription)
|
||||
Q_DECLARE_METATYPE(ResourcesDescription)
|
||||
Q_DECLARE_METATYPE(VTableDescription)
|
||||
Q_DECLARE_METATYPE(TypeDescription)
|
||||
|
@ -2,7 +2,7 @@
|
||||
#include "ui_MainWindow.h"
|
||||
|
||||
// Common Headers
|
||||
#include "common/AnalTask.h"
|
||||
#include "common/AnalysisTask.h"
|
||||
#include "common/BugReporting.h"
|
||||
#include "common/Highlighter.h"
|
||||
#include "common/Helpers.h"
|
||||
@ -1652,19 +1652,19 @@ void MainWindow::on_actionRefresh_Panels_triggered()
|
||||
*/
|
||||
void MainWindow::on_actionAnalyze_triggered()
|
||||
{
|
||||
auto *analTask = new AnalTask();
|
||||
auto *analysisTask = new AnalysisTask();
|
||||
InitialOptions options;
|
||||
options.analCmd = { { "aaa", "Auto analysis" } };
|
||||
analTask->setOptions(options);
|
||||
AsyncTask::Ptr analTaskPtr(analTask);
|
||||
options.analysisCmd = { { "aaa", "Auto analysis" } };
|
||||
analysisTask->setOptions(options);
|
||||
AsyncTask::Ptr analysisTaskPtr(analysisTask);
|
||||
|
||||
auto *taskDialog = new AsyncTaskDialog(analTaskPtr);
|
||||
auto *taskDialog = new AsyncTaskDialog(analysisTaskPtr);
|
||||
taskDialog->setInterruptOnClose(true);
|
||||
taskDialog->setAttribute(Qt::WA_DeleteOnClose);
|
||||
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()
|
||||
|
@ -15,7 +15,7 @@ EditMethodDialog::EditMethodDialog(bool classFixed, QWidget *parent)
|
||||
} else {
|
||||
classComboBox = new QComboBox(this);
|
||||
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);
|
||||
}
|
||||
}
|
||||
@ -86,7 +86,7 @@ void EditMethodDialog::setClass(const QString &className)
|
||||
validateInput();
|
||||
}
|
||||
|
||||
void EditMethodDialog::setMethod(const AnalMethodDescription &desc)
|
||||
void EditMethodDialog::setMethod(const AnalysisMethodDescription &desc)
|
||||
{
|
||||
ui->nameEdit->setText(desc.name);
|
||||
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.addr = Core()->num(ui->addressEdit->text());
|
||||
if (!ui->virtualCheckBox->isChecked()) {
|
||||
@ -130,7 +130,7 @@ AnalMethodDescription EditMethodDialog::getMethod() const
|
||||
}
|
||||
|
||||
bool EditMethodDialog::showDialog(const QString &title, bool classFixed, QString *className,
|
||||
AnalMethodDescription *desc, QWidget *parent)
|
||||
AnalysisMethodDescription *desc, QWidget *parent)
|
||||
{
|
||||
EditMethodDialog dialog(classFixed, parent);
|
||||
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)
|
||||
{
|
||||
AnalMethodDescription desc;
|
||||
AnalysisMethodDescription desc;
|
||||
desc.name = meth;
|
||||
desc.vtableOffset = -1;
|
||||
desc.addr = Core()->getOffset();
|
||||
@ -153,13 +153,13 @@ void EditMethodDialog::newMethod(QString className, const QString &meth, QWidget
|
||||
return;
|
||||
}
|
||||
|
||||
Core()->setAnalMethod(className, desc);
|
||||
Core()->setAnalysisMethod(className, desc);
|
||||
}
|
||||
|
||||
void EditMethodDialog::editMethod(const QString &className, const QString &meth, QWidget *parent)
|
||||
{
|
||||
AnalMethodDescription desc;
|
||||
if (!Core()->getAnalMethod(className, meth, &desc)) {
|
||||
AnalysisMethodDescription desc;
|
||||
if (!Core()->getAnalysisMethod(className, meth, &desc)) {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -168,7 +168,7 @@ void EditMethodDialog::editMethod(const QString &className, const QString &meth,
|
||||
return;
|
||||
}
|
||||
if (desc.name != meth) {
|
||||
Core()->renameAnalMethod(className, meth, desc.name);
|
||||
Core()->renameAnalysisMethod(className, meth, desc.name);
|
||||
}
|
||||
Core()->setAnalMethod(className, desc);
|
||||
Core()->setAnalysisMethod(className, desc);
|
||||
}
|
||||
|
@ -24,10 +24,10 @@ public:
|
||||
~EditMethodDialog();
|
||||
|
||||
void setClass(const QString &className);
|
||||
void setMethod(const AnalMethodDescription &desc);
|
||||
void setMethod(const AnalysisMethodDescription &desc);
|
||||
|
||||
QString getClass() const;
|
||||
AnalMethodDescription getMethod() const;
|
||||
AnalysisMethodDescription getMethod() const;
|
||||
|
||||
/**
|
||||
* @brief Helper function to display the dialog
|
||||
@ -39,7 +39,7 @@ public:
|
||||
* @return whether the dialog was accepted by the user
|
||||
*/
|
||||
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
|
||||
|
@ -13,7 +13,7 @@
|
||||
#include <QCloseEvent>
|
||||
|
||||
#include "core/Cutter.h"
|
||||
#include "common/AnalTask.h"
|
||||
#include "common/AnalysisTask.h"
|
||||
|
||||
InitialOptionsDialog::InitialOptionsDialog(MainWindow *main)
|
||||
: QDialog(nullptr), // parent must not be main
|
||||
@ -83,7 +83,7 @@ InitialOptionsDialog::InitialOptionsDialog(MainWindow *main)
|
||||
}
|
||||
|
||||
ui->hideFrame->setVisible(false);
|
||||
ui->analoptionsFrame->setVisible(false);
|
||||
ui->analysisoptionsFrame->setVisible(false);
|
||||
ui->advancedAnlysisLine->setVisible(false);
|
||||
|
||||
updatePDBLayout();
|
||||
@ -132,7 +132,7 @@ void InitialOptionsDialog::updateCPUComboBox()
|
||||
QList<QString> InitialOptionsDialog::getAnalysisCommands(const InitialOptions &options)
|
||||
{
|
||||
QList<QString> commands;
|
||||
for (auto &commandDesc : options.analCmd) {
|
||||
for (auto &commandDesc : options.analysisCmd) {
|
||||
commands << commandDesc.command;
|
||||
}
|
||||
return commands;
|
||||
@ -140,14 +140,14 @@ QList<QString> InitialOptionsDialog::getAnalysisCommands(const InitialOptions &o
|
||||
|
||||
void InitialOptionsDialog::loadOptions(const InitialOptions &options)
|
||||
{
|
||||
if (options.analCmd.isEmpty()) {
|
||||
analLevel = 0;
|
||||
} else if (options.analCmd.first().command == "aaa") {
|
||||
analLevel = 1;
|
||||
} else if (options.analCmd.first().command == "aaaa") {
|
||||
analLevel = 2;
|
||||
if (options.analysisCmd.isEmpty()) {
|
||||
analysisLevel = 0;
|
||||
} else if (options.analysisCmd.first().command == "aaa") {
|
||||
analysisLevel = 1;
|
||||
} else if (options.analysisCmd.first().command == "aaaa") {
|
||||
analysisLevel = 2;
|
||||
} else {
|
||||
analLevel = 3;
|
||||
analysisLevel = 3;
|
||||
AnalysisCommands item;
|
||||
QList<QString> commands = getAnalysisCommands(options);
|
||||
foreach (item, analysisCommands) {
|
||||
@ -159,13 +159,13 @@ void InitialOptionsDialog::loadOptions(const InitialOptions &options)
|
||||
if (!options.script.isEmpty()) {
|
||||
ui->scriptCheckBox->setChecked(true);
|
||||
ui->scriptLineEdit->setText(options.script);
|
||||
analLevel = 0;
|
||||
analysisLevel = 0;
|
||||
} else {
|
||||
ui->scriptCheckBox->setChecked(false);
|
||||
ui->scriptLineEdit->setText("");
|
||||
}
|
||||
|
||||
ui->analSlider->setValue(analLevel);
|
||||
ui->analysisSlider->setValue(analysisLevel);
|
||||
|
||||
shellcode = options.shellcode;
|
||||
|
||||
@ -235,7 +235,7 @@ QString InitialOptionsDialog::getSelectedOS() const
|
||||
QList<CommandDescription> InitialOptionsDialog::getSelectedAdvancedAnalCmds() const
|
||||
{
|
||||
QList<CommandDescription> advanced = QList<CommandDescription>();
|
||||
if (ui->analSlider->value() == 3) {
|
||||
if (ui->analysisSlider->value() == 3) {
|
||||
AnalysisCommands item;
|
||||
foreach (item, analysisCommands) {
|
||||
if (item.checkbox->isChecked()) {
|
||||
@ -284,42 +284,42 @@ void InitialOptionsDialog::setupAndStartAnalysis(/*int level, QList<QString> adv
|
||||
|
||||
options.endian = getSelectedEndianness();
|
||||
|
||||
int level = ui->analSlider->value();
|
||||
int level = ui->analysisSlider->value();
|
||||
switch (level) {
|
||||
case 1:
|
||||
options.analCmd = { { "aaa", "Auto analysis" } };
|
||||
options.analysisCmd = { { "aaa", "Auto analysis" } };
|
||||
break;
|
||||
case 2:
|
||||
options.analCmd = { { "aaaa", "Auto analysis (experimental)" } };
|
||||
options.analysisCmd = { { "aaaa", "Auto analysis (experimental)" } };
|
||||
break;
|
||||
case 3:
|
||||
options.analCmd = getSelectedAdvancedAnalCmds();
|
||||
options.analysisCmd = getSelectedAdvancedAnalCmds();
|
||||
break;
|
||||
default:
|
||||
options.analCmd = {};
|
||||
options.analysisCmd = {};
|
||||
break;
|
||||
}
|
||||
|
||||
AnalTask *analTask = new AnalTask();
|
||||
analTask->setOptions(options);
|
||||
AnalysisTask *analysisTask = new AnalysisTask();
|
||||
analysisTask->setOptions(options);
|
||||
|
||||
MainWindow *main = this->main;
|
||||
connect(analTask, &AnalTask::openFileFailed, main, &MainWindow::openNewFileFailed);
|
||||
connect(analTask, &AsyncTask::finished, main, [analTask, main]() {
|
||||
if (analTask->getOpenFileFailed()) {
|
||||
connect(analysisTask, &AnalysisTask::openFileFailed, main, &MainWindow::openNewFileFailed);
|
||||
connect(analysisTask, &AsyncTask::finished, main, [analysisTask, main]() {
|
||||
if (analysisTask->getOpenFileFailed()) {
|
||||
return;
|
||||
}
|
||||
main->finalizeOpen();
|
||||
});
|
||||
|
||||
AsyncTask::Ptr analTaskPtr(analTask);
|
||||
AsyncTask::Ptr analysisTaskPtr(analysisTask);
|
||||
|
||||
AsyncTaskDialog *taskDialog = new AsyncTaskDialog(analTaskPtr);
|
||||
AsyncTaskDialog *taskDialog = new AsyncTaskDialog(analysisTaskPtr);
|
||||
taskDialog->setInterruptOnClose(true);
|
||||
taskDialog->setAttribute(Qt::WA_DeleteOnClose);
|
||||
taskDialog->show();
|
||||
|
||||
Core()->getAsyncTaskManager()->start(analTaskPtr);
|
||||
Core()->getAsyncTaskManager()->start(analysisTaskPtr);
|
||||
|
||||
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)));
|
||||
if (value == 0) {
|
||||
ui->analCheckBox->setChecked(false);
|
||||
ui->analCheckBox->setText(tr("Analysis: Disabled"));
|
||||
ui->analysisCheckBox->setChecked(false);
|
||||
ui->analysisCheckBox->setText(tr("Analysis: Disabled"));
|
||||
} else {
|
||||
ui->analCheckBox->setChecked(true);
|
||||
ui->analCheckBox->setText(tr("Analysis: Enabled"));
|
||||
ui->analysisCheckBox->setChecked(true);
|
||||
ui->analysisCheckBox->setText(tr("Analysis: Enabled"));
|
||||
if (value == 3) {
|
||||
ui->analoptionsFrame->setVisible(true);
|
||||
ui->analysisoptionsFrame->setVisible(true);
|
||||
ui->advancedAnlysisLine->setVisible(true);
|
||||
} else {
|
||||
ui->analoptionsFrame->setVisible(false);
|
||||
ui->analysisoptionsFrame->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) {
|
||||
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)
|
||||
|
@ -24,9 +24,9 @@ public:
|
||||
|
||||
private slots:
|
||||
void on_okButton_clicked();
|
||||
void on_analSlider_valueChanged(int value);
|
||||
void on_analysisSlider_valueChanged(int value);
|
||||
void on_AdvOptButton_clicked();
|
||||
void on_analCheckBox_clicked(bool checked);
|
||||
void on_analysisCheckBox_clicked(bool checked);
|
||||
void on_archComboBox_currentIndexChanged(int index);
|
||||
void on_pdbSelectButton_clicked();
|
||||
void on_scriptSelectButton_clicked();
|
||||
@ -45,7 +45,7 @@ private:
|
||||
|
||||
QString analysisDescription(int level);
|
||||
QString shellcode;
|
||||
int analLevel;
|
||||
int analysisLevel;
|
||||
QList<RzAsmPluginDescription> asmPlugins;
|
||||
|
||||
void updateCPUComboBox();
|
||||
|
@ -144,7 +144,7 @@
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="analCheckBox">
|
||||
<widget class="QCheckBox" name="analysisCheckBox">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
@ -181,7 +181,7 @@
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QSlider" name="analSlider">
|
||||
<widget class="QSlider" name="analysisSlider">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
@ -277,7 +277,7 @@
|
||||
<enum>QLayout::SetMinimumSize</enum>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QFrame" name="analoptionsFrame">
|
||||
<widget class="QFrame" name="analysisoptionsFrame">
|
||||
<property name="enabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
|
@ -1,5 +1,5 @@
|
||||
#include "AnalOptionsWidget.h"
|
||||
#include "ui_AnalOptionsWidget.h"
|
||||
#include "AnalysisOptionsWidget.h"
|
||||
#include "ui_AnalysisOptionsWidget.h"
|
||||
|
||||
#include "PreferencesDialog.h"
|
||||
|
||||
@ -8,7 +8,7 @@
|
||||
|
||||
#include "core/MainWindow.h"
|
||||
|
||||
static const QHash<QString, QString> analBoundaries {
|
||||
static const QHash<QString, QString> analysisBoundaries {
|
||||
{ "io.maps.x", "All executable maps" },
|
||||
{ "io.maps", "All maps" },
|
||||
{ "io.map", "Current map" },
|
||||
@ -17,8 +17,8 @@ static const QHash<QString, QString> analBoundaries {
|
||||
{ "bin.sections", "All mapped sections" },
|
||||
};
|
||||
|
||||
AnalOptionsWidget::AnalOptionsWidget(PreferencesDialog *dialog)
|
||||
: QDialog(dialog), ui(new Ui::AnalOptionsWidget)
|
||||
AnalysisOptionsWidget::AnalysisOptionsWidget(PreferencesDialog *dialog)
|
||||
: QDialog(dialog), ui(new Ui::AnalysisOptionsWidget)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
|
||||
@ -31,7 +31,7 @@ AnalOptionsWidget::AnalOptionsWidget(PreferencesDialog *dialog)
|
||||
{ ui->verboseCheckBox, "analysis.verbose" } };
|
||||
|
||||
// Create list of options for the analysis.in selector
|
||||
createAnalInOptionsList();
|
||||
createAnalysisInOptionsList();
|
||||
|
||||
// Connect each checkbox from "checkboxes" to the generic signal "checkboxEnabler"
|
||||
for (ConfigCheckbox &confCheckbox : checkboxes) {
|
||||
@ -45,23 +45,23 @@ AnalOptionsWidget::AnalOptionsWidget(PreferencesDialog *dialog)
|
||||
auto *mainWindow = new MainWindow(this);
|
||||
connect(ui->analyzePushButton, &QPushButton::clicked, mainWindow,
|
||||
&MainWindow::on_actionAnalyze_triggered);
|
||||
connect<void (QComboBox::*)(int)>(ui->analInComboBox, &QComboBox::currentIndexChanged, this,
|
||||
&AnalOptionsWidget::updateAnalIn);
|
||||
connect<void (QComboBox::*)(int)>(ui->analysisInComboBox, &QComboBox::currentIndexChanged, this,
|
||||
&AnalysisOptionsWidget::updateAnalysisIn);
|
||||
connect<void (QSpinBox::*)(int)>(ui->ptrDepthSpinBox, &QSpinBox::valueChanged, this,
|
||||
&AnalOptionsWidget::updateAnalPtrDepth);
|
||||
&AnalysisOptionsWidget::updateAnalysisPtrDepth);
|
||||
connect(ui->preludeLineEdit, &QLineEdit::textChanged, this,
|
||||
&AnalOptionsWidget::updateAnalPrelude);
|
||||
updateAnalOptionsFromVars();
|
||||
&AnalysisOptionsWidget::updateAnalysisPrelude);
|
||||
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());
|
||||
}
|
||||
|
||||
void AnalOptionsWidget::updateAnalOptionsFromVars()
|
||||
void AnalysisOptionsWidget::updateAnalysisOptionsFromVars()
|
||||
{
|
||||
for (ConfigCheckbox &confCheckbox : checkboxes) {
|
||||
qhelpers::setCheckedWithoutSignals(confCheckbox.checkBox,
|
||||
@ -69,36 +69,36 @@ void AnalOptionsWidget::updateAnalOptionsFromVars()
|
||||
}
|
||||
|
||||
// Update the rest of analysis options that are not checkboxes
|
||||
ui->analInComboBox->setCurrentIndex(
|
||||
ui->analInComboBox->findData(Core()->getConfig("analysis.in")));
|
||||
ui->analysisInComboBox->setCurrentIndex(
|
||||
ui->analysisInComboBox->findData(Core()->getConfig("analysis.in")));
|
||||
ui->ptrDepthSpinBox->setValue(Core()->getConfigi("analysis.ptrdepth"));
|
||||
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);
|
||||
}
|
||||
|
||||
void AnalOptionsWidget::updateAnalPrelude(const QString &prelude)
|
||||
void AnalysisOptionsWidget::updateAnalysisPrelude(const QString &prelude)
|
||||
{
|
||||
Config()->setConfig("analysis.prelude", prelude);
|
||||
}
|
||||
|
||||
void AnalOptionsWidget::createAnalInOptionsList()
|
||||
void AnalysisOptionsWidget::createAnalysisInOptionsList()
|
||||
{
|
||||
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());
|
||||
mapIter = analysisBoundaries.cbegin();
|
||||
ui->analysisInComboBox->blockSignals(true);
|
||||
ui->analysisInComboBox->clear();
|
||||
for (; mapIter != analysisBoundaries.cend(); ++mapIter) {
|
||||
ui->analysisInComboBox->addItem(mapIter.value(), mapIter.key());
|
||||
}
|
||||
ui->analInComboBox->blockSignals(false);
|
||||
ui->analysisInComboBox->blockSignals(false);
|
||||
}
|
@ -9,19 +9,19 @@
|
||||
class PreferencesDialog;
|
||||
|
||||
namespace Ui {
|
||||
class AnalOptionsWidget;
|
||||
class AnalysisOptionsWidget;
|
||||
}
|
||||
|
||||
class AnalOptionsWidget : public QDialog
|
||||
class AnalysisOptionsWidget : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit AnalOptionsWidget(PreferencesDialog *dialog);
|
||||
~AnalOptionsWidget();
|
||||
explicit AnalysisOptionsWidget(PreferencesDialog *dialog);
|
||||
~AnalysisOptionsWidget();
|
||||
|
||||
private:
|
||||
std::unique_ptr<Ui::AnalOptionsWidget> ui;
|
||||
std::unique_ptr<Ui::AnalysisOptionsWidget> ui;
|
||||
struct ConfigCheckbox
|
||||
{
|
||||
QCheckBox *checkBox;
|
||||
@ -33,14 +33,14 @@ private:
|
||||
* @brief This function creates the list with the different options shown in the selector for
|
||||
* analysis.in
|
||||
*/
|
||||
void createAnalInOptionsList();
|
||||
void createAnalysisInOptionsList();
|
||||
|
||||
private slots:
|
||||
/**
|
||||
* @brief A slot to display the options in the dialog according to the current analysis.*
|
||||
* configuration
|
||||
*/
|
||||
void updateAnalOptionsFromVars();
|
||||
void updateAnalysisOptionsFromVars();
|
||||
|
||||
/**
|
||||
* @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
|
||||
* @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
|
||||
* @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
|
||||
* corresponding textbox
|
||||
* @param prelude - The new value for analysis.prelude
|
||||
*/
|
||||
static void updateAnalPrelude(const QString &prelude);
|
||||
static void updateAnalysisPrelude(const QString &prelude);
|
||||
};
|
||||
|
||||
#endif // ANALOPTIONSWIDGET_H
|
@ -1,7 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>AnalOptionsWidget</class>
|
||||
<widget class="QWidget" name="AnalOptionsWidget">
|
||||
<class>AnalysisOptionsWidget</class>
|
||||
<widget class="QWidget" name="AnalysisOptionsWidget">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
@ -163,7 +163,7 @@
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QComboBox" name="analInComboBox"/>
|
||||
<widget class="QComboBox" name="analysisInComboBox"/>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
@ -7,7 +7,7 @@
|
||||
#include "DebugOptionsWidget.h"
|
||||
#include "PluginsOptionsWidget.h"
|
||||
#include "InitializationFileEditor.h"
|
||||
#include "AnalOptionsWidget.h"
|
||||
#include "AnalysisOptionsWidget.h"
|
||||
|
||||
#include "PreferenceCategory.h"
|
||||
|
||||
@ -36,7 +36,7 @@ PreferencesDialog::PreferencesDialog(QWidget *parent)
|
||||
{ tr("Plugins"), new PluginsOptionsWidget(this), QIcon(":/img/icons/plugins.svg") },
|
||||
{ tr("Initialization Script"), new InitializationFileEditor(this),
|
||||
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) {
|
||||
|
@ -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>>)
|
||||
{
|
||||
// Just use a simple refresh deferrer. If an event was triggered in the background, simply
|
||||
// refresh everything later.
|
||||
refreshDeferrer = parent->createRefreshDeferrer([this]() { this->refreshAll(); });
|
||||
|
||||
connect(Core(), &CutterCore::refreshAll, this, &AnalClassesModel::refreshAll);
|
||||
connect(Core(), &CutterCore::codeRebased, this, &AnalClassesModel::refreshAll);
|
||||
connect(Core(), &CutterCore::classNew, this, &AnalClassesModel::classNew);
|
||||
connect(Core(), &CutterCore::classDeleted, this, &AnalClassesModel::classDeleted);
|
||||
connect(Core(), &CutterCore::classRenamed, this, &AnalClassesModel::classRenamed);
|
||||
connect(Core(), &CutterCore::classAttrsChanged, this, &AnalClassesModel::classAttrsChanged);
|
||||
connect(Core(), &CutterCore::refreshAll, this, &AnalysisClassesModel::refreshAll);
|
||||
connect(Core(), &CutterCore::codeRebased, this, &AnalysisClassesModel::refreshAll);
|
||||
connect(Core(), &CutterCore::classNew, this, &AnalysisClassesModel::classNew);
|
||||
connect(Core(), &CutterCore::classDeleted, this, &AnalysisClassesModel::classDeleted);
|
||||
connect(Core(), &CutterCore::classRenamed, this, &AnalysisClassesModel::classRenamed);
|
||||
connect(Core(), &CutterCore::classAttrsChanged, this, &AnalysisClassesModel::classAttrsChanged);
|
||||
|
||||
refreshAll();
|
||||
}
|
||||
|
||||
void AnalClassesModel::refreshAll()
|
||||
void AnalysisClassesModel::refreshAll()
|
||||
{
|
||||
if (!refreshDeferrer->attemptRefresh(nullptr)) {
|
||||
return;
|
||||
@ -229,11 +229,11 @@ void AnalClassesModel::refreshAll()
|
||||
|
||||
beginResetModel();
|
||||
attrs->clear();
|
||||
classes = Core()->getAllAnalClasses(true); // must be sorted
|
||||
classes = Core()->getAllAnalysisClasses(true); // must be sorted
|
||||
endResetModel();
|
||||
}
|
||||
|
||||
void AnalClassesModel::classNew(const QString &cls)
|
||||
void AnalysisClassesModel::classNew(const QString &cls)
|
||||
{
|
||||
if (!refreshDeferrer->attemptRefresh(nullptr)) {
|
||||
return;
|
||||
@ -247,7 +247,7 @@ void AnalClassesModel::classNew(const QString &cls)
|
||||
endInsertRows();
|
||||
}
|
||||
|
||||
void AnalClassesModel::classDeleted(const QString &cls)
|
||||
void AnalysisClassesModel::classDeleted(const QString &cls)
|
||||
{
|
||||
if (!refreshDeferrer->attemptRefresh(nullptr)) {
|
||||
return;
|
||||
@ -264,7 +264,7 @@ void AnalClassesModel::classDeleted(const QString &cls)
|
||||
endRemoveRows();
|
||||
}
|
||||
|
||||
void AnalClassesModel::classRenamed(const QString &oldName, const QString &newName)
|
||||
void AnalysisClassesModel::classRenamed(const QString &oldName, const QString &newName)
|
||||
{
|
||||
if (!refreshDeferrer->attemptRefresh(nullptr)) {
|
||||
return;
|
||||
@ -296,7 +296,7 @@ void AnalClassesModel::classRenamed(const QString &oldName, const QString &newNa
|
||||
emit dataChanged(index(newRow, 0), index(newRow, 0));
|
||||
}
|
||||
|
||||
void AnalClassesModel::classAttrsChanged(const QString &cls)
|
||||
void AnalysisClassesModel::classAttrsChanged(const QString &cls)
|
||||
{
|
||||
if (!refreshDeferrer->attemptRefresh(nullptr)) {
|
||||
return;
|
||||
@ -312,35 +312,35 @@ void AnalClassesModel::classAttrsChanged(const QString &cls)
|
||||
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);
|
||||
if (it != attrs->end()) {
|
||||
return it.value();
|
||||
}
|
||||
|
||||
QVector<AnalClassesModel::Attribute> clsAttrs;
|
||||
QList<AnalBaseClassDescription> bases = Core()->getAnalClassBaseClasses(cls);
|
||||
QList<AnalMethodDescription> meths = Core()->getAnalClassMethods(cls);
|
||||
QList<AnalVTableDescription> vtables = Core()->getAnalClassVTables(cls);
|
||||
QVector<AnalysisClassesModel::Attribute> clsAttrs;
|
||||
QList<AnalysisBaseClassDescription> bases = Core()->getAnalysisClassBaseClasses(cls);
|
||||
QList<AnalysisMethodDescription> meths = Core()->getAnalysisClassMethods(cls);
|
||||
QList<AnalysisVTableDescription> vtables = Core()->getAnalysisClassVTables(cls);
|
||||
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)));
|
||||
}
|
||||
|
||||
for (const AnalVTableDescription &vtable : vtables) {
|
||||
for (const AnalysisVTableDescription &vtable : vtables) {
|
||||
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)));
|
||||
}
|
||||
|
||||
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()) {
|
||||
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
|
||||
}
|
||||
|
||||
QModelIndex AnalClassesModel::parent(const QModelIndex &index) const
|
||||
QModelIndex AnalysisClassesModel::parent(const QModelIndex &index) const
|
||||
{
|
||||
if (!index.isValid()) {
|
||||
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
|
||||
return classes.count();
|
||||
@ -376,17 +376,17 @@ int AnalClassesModel::rowCount(const QModelIndex &parent) const
|
||||
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();
|
||||
}
|
||||
|
||||
int AnalClassesModel::columnCount(const QModelIndex &) const
|
||||
int AnalysisClassesModel::columnCount(const QModelIndex &) const
|
||||
{
|
||||
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.row() >= classes.count()) {
|
||||
@ -417,7 +417,7 @@ QVariant AnalClassesModel::data(const QModelIndex &index, int role) const
|
||||
|
||||
switch (attr.type) {
|
||||
case Attribute::Type::Base: {
|
||||
AnalBaseClassDescription base = attr.data.value<AnalBaseClassDescription>();
|
||||
AnalysisBaseClassDescription base = attr.data.value<AnalysisBaseClassDescription>();
|
||||
switch (role) {
|
||||
case Qt::DisplayRole:
|
||||
switch (index.column()) {
|
||||
@ -448,7 +448,7 @@ QVariant AnalClassesModel::data(const QModelIndex &index, int role) const
|
||||
break;
|
||||
}
|
||||
case Attribute::Type::Method: {
|
||||
AnalMethodDescription meth = attr.data.value<AnalMethodDescription>();
|
||||
AnalysisMethodDescription meth = attr.data.value<AnalysisMethodDescription>();
|
||||
switch (role) {
|
||||
case Qt::DisplayRole:
|
||||
switch (index.column()) {
|
||||
@ -484,7 +484,7 @@ QVariant AnalClassesModel::data(const QModelIndex &index, int role) const
|
||||
break;
|
||||
}
|
||||
case Attribute::Type::VTable: {
|
||||
AnalVTableDescription vtable = attr.data.value<AnalVTableDescription>();
|
||||
AnalysisVTableDescription vtable = attr.data.value<AnalysisVTableDescription>();
|
||||
switch (role) {
|
||||
case Qt::DisplayRole:
|
||||
switch (index.column()) {
|
||||
@ -619,7 +619,7 @@ void ClassesWidget::refreshClasses()
|
||||
proxy_model->setSourceModel(nullptr);
|
||||
delete bin_model;
|
||||
bin_model = nullptr;
|
||||
analysis_model = new AnalClassesModel(this);
|
||||
analysis_model = new AnalysisClassesModel(this);
|
||||
proxy_model->setSourceModel(analysis_model);
|
||||
}
|
||||
break;
|
||||
@ -674,8 +674,8 @@ void ClassesWidget::showContextMenu(const QPoint &pt)
|
||||
|
||||
QString className = index.parent().data(ClassesModel::NameRole).toString();
|
||||
QString methodName = index.data(ClassesModel::NameRole).toString();
|
||||
AnalMethodDescription desc;
|
||||
if (Core()->getAnalMethod(className, methodName, &desc)) {
|
||||
AnalysisMethodDescription desc;
|
||||
if (Core()->getAnalysisMethod(className, methodName, &desc)) {
|
||||
if (desc.vtableOffset >= 0) {
|
||||
menu.addAction(ui->seekToVTableAction);
|
||||
}
|
||||
@ -690,7 +690,7 @@ void ClassesWidget::on_seekToVTableAction_triggered()
|
||||
QModelIndex index = ui->classesTreeView->selectionModel()->currentIndex();
|
||||
QString className = index.parent().data(ClassesModel::NameRole).toString();
|
||||
|
||||
QList<AnalVTableDescription> vtables = Core()->getAnalClassVTables(className);
|
||||
QList<AnalysisVTableDescription> vtables = Core()->getAnalysisClassVTables(className);
|
||||
if (vtables.isEmpty()) {
|
||||
QMessageBox::warning(this, tr("Missing VTable in class"),
|
||||
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();
|
||||
AnalMethodDescription desc;
|
||||
if (!Core()->getAnalMethod(className, methodName, &desc) || desc.vtableOffset < 0) {
|
||||
AnalysisMethodDescription desc;
|
||||
if (!Core()->getAnalysisMethod(className, methodName, &desc) || desc.vtableOffset < 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -90,7 +90,7 @@ public:
|
||||
void setClasses(const QList<BinClassDescription> &classes);
|
||||
};
|
||||
|
||||
class AnalClassesModel : public ClassesModel
|
||||
class AnalysisClassesModel : public ClassesModel
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
@ -145,7 +145,7 @@ private:
|
||||
QVariant data(const QModelIndex &index, int role) const override;
|
||||
|
||||
public:
|
||||
explicit AnalClassesModel(CutterDockWidget *parent);
|
||||
explicit AnalysisClassesModel(CutterDockWidget *parent);
|
||||
|
||||
public slots:
|
||||
void refreshAll();
|
||||
@ -198,7 +198,7 @@ private:
|
||||
std::unique_ptr<Ui::ClassesWidget> ui;
|
||||
|
||||
BinClassesModel *bin_model = nullptr;
|
||||
AnalClassesModel *analysis_model = nullptr;
|
||||
AnalysisClassesModel *analysis_model = nullptr;
|
||||
ClassesSortFilterProxyModel *proxy_model;
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user