mirror of
https://github.com/rizinorg/cutter.git
synced 2024-12-23 05:16:11 +00:00
Add asm.cpu and pdb loading to OptionsDialog (#6)
* asm.cpu in OptionsDialog, Fix asm.os * PDB in OptionsDialog
This commit is contained in:
parent
715e81e3cd
commit
98206fbddd
@ -64,7 +64,7 @@ void createNewDialog::on_exampleButton_clicked()
|
|||||||
{
|
{
|
||||||
str = "48656c6c6f20576f726c6400";
|
str = "48656c6c6f20576f726c6400";
|
||||||
}
|
}
|
||||||
else fprintf(stderr, tr("Unknown combo value selected").toLocal8Bit().constData());
|
else fprintf(stderr, "%s", tr("Unknown combo value selected").toLocal8Bit().constData());
|
||||||
if (str.length() > 0)
|
if (str.length() > 0)
|
||||||
ui->plainTextEdit->setPlainText(str);
|
ui->plainTextEdit->setPlainText(str);
|
||||||
// }
|
// }
|
||||||
|
@ -311,7 +311,8 @@ void CutterCore::analyze(int level, QList<QString> advanced)
|
|||||||
}
|
}
|
||||||
else if (level == 3)
|
else if (level == 3)
|
||||||
{
|
{
|
||||||
foreach(QString option, advanced){
|
foreach (QString option, advanced)
|
||||||
|
{
|
||||||
r_core_cmd0(core_, option.toStdString().c_str());
|
r_core_cmd0(core_, option.toStdString().c_str());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -323,6 +324,7 @@ void CutterCore::renameFunction(QString prev_name, QString new_name)
|
|||||||
emit functionRenamed(prev_name, new_name);
|
emit functionRenamed(prev_name, new_name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void CutterCore::setComment(RVA addr, QString cmt)
|
void CutterCore::setComment(RVA addr, QString cmt)
|
||||||
{
|
{
|
||||||
//r_meta_add (core->anal, 'C', addr, 1, cmt.toUtf8());
|
//r_meta_add (core->anal, 'C', addr, 1, cmt.toUtf8());
|
||||||
@ -330,7 +332,6 @@ void CutterCore::setComment(RVA addr, QString cmt)
|
|||||||
emit commentsChanged();
|
emit commentsChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void CutterCore::delComment(ut64 addr)
|
void CutterCore::delComment(ut64 addr)
|
||||||
{
|
{
|
||||||
CORE_LOCK();
|
CORE_LOCK();
|
||||||
@ -358,20 +359,22 @@ QMap<QString, QList<QList<QString>>> CutterCore::getNestedComments()
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void CutterCore::seek(QString addr)
|
void CutterCore::seek(QString addr)
|
||||||
{
|
{
|
||||||
if (addr.length() > 0)
|
if (addr.length() > 0)
|
||||||
seek(this->math(addr.toUtf8().constData()));
|
seek(this->math(addr.toUtf8().constData()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void CutterCore::seek(ut64 offset)
|
void CutterCore::seek(ut64 offset)
|
||||||
{
|
{
|
||||||
CORE_LOCK();
|
CORE_LOCK();
|
||||||
r_core_seek(this->core_, offset, true);
|
r_core_seek(this->core_, offset, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
bool CutterCore::tryFile(QString path, bool rw)
|
bool CutterCore::tryFile(QString path, bool rw)
|
||||||
{
|
{
|
||||||
CORE_LOCK();
|
CORE_LOCK();
|
||||||
@ -386,8 +389,9 @@ bool CutterCore::tryFile(QString path, bool rw)
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool is_writable = false;
|
bool is_writable = false;
|
||||||
if (cf->core && cf->core->io && cf->core->io->desc) {
|
if (cf->core && cf->core->io && cf->core->io->desc)
|
||||||
is_writable = cf->core->io->desc->flags & R_IO_WRITE;
|
{
|
||||||
|
is_writable = cf->core->io->desc->flags & R_IO_WRITE;
|
||||||
}
|
}
|
||||||
// if rbin works, tell entry0, and symbols (main, constructor, ..)
|
// if rbin works, tell entry0, and symbols (main, constructor, ..)
|
||||||
|
|
||||||
@ -399,44 +403,6 @@ bool CutterCore::tryFile(QString path, bool rw)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
QList<QString> CutterCore::getList(const QString &type, const QString &subtype)
|
|
||||||
{
|
|
||||||
CORE_LOCK();
|
|
||||||
QList<QString> ret = QList<QString>();
|
|
||||||
|
|
||||||
if (type == "bin")
|
|
||||||
{
|
|
||||||
if (subtype == "types")
|
|
||||||
{
|
|
||||||
ret << "raw";
|
|
||||||
auto ft = sdb_const_get(DB, "try.filetype", 0);
|
|
||||||
if (ft && *ft)
|
|
||||||
ret << ft;
|
|
||||||
}
|
|
||||||
else if (subtype == "entrypoints")
|
|
||||||
{
|
|
||||||
if (math("entry0") != 0)
|
|
||||||
ret << "entry0";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (type == "asm")
|
|
||||||
{
|
|
||||||
if (subtype == "cpus")
|
|
||||||
{
|
|
||||||
QString funcs = cmd("e asm.cpu=?");
|
|
||||||
QStringList lines = funcs.split("\n");
|
|
||||||
for (auto cpu : lines)
|
|
||||||
{
|
|
||||||
ret << cpu;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
ut64 CutterCore::math(const QString &expr)
|
ut64 CutterCore::math(const QString &expr)
|
||||||
{
|
{
|
||||||
CORE_LOCK();
|
CORE_LOCK();
|
||||||
@ -720,6 +686,10 @@ void CutterCore::getOpcodes()
|
|||||||
this->regs.removeLast();
|
this->regs.removeLast();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void CutterCore::setSettings()
|
void CutterCore::setSettings()
|
||||||
{
|
{
|
||||||
config("scr.color", "false");
|
config("scr.color", "false");
|
||||||
@ -785,8 +755,6 @@ void CutterCore::setSettings()
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
QList<RVA> CutterCore::getSeekHistory()
|
QList<RVA> CutterCore::getSeekHistory()
|
||||||
{
|
{
|
||||||
CORE_LOCK();
|
CORE_LOCK();
|
||||||
@ -799,8 +767,6 @@ QList<RVA> CutterCore::getSeekHistory()
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
QStringList CutterCore::getAsmPluginNames()
|
QStringList CutterCore::getAsmPluginNames()
|
||||||
{
|
{
|
||||||
CORE_LOCK();
|
CORE_LOCK();
|
||||||
@ -816,6 +782,7 @@ QStringList CutterCore::getAsmPluginNames()
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
QStringList CutterCore::getAnalPluginNames()
|
QStringList CutterCore::getAnalPluginNames()
|
||||||
{
|
{
|
||||||
CORE_LOCK();
|
CORE_LOCK();
|
||||||
@ -832,6 +799,7 @@ QStringList CutterCore::getAnalPluginNames()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
QStringList CutterCore::getProjectNames()
|
QStringList CutterCore::getProjectNames()
|
||||||
{
|
{
|
||||||
CORE_LOCK();
|
CORE_LOCK();
|
||||||
@ -845,7 +813,6 @@ QStringList CutterCore::getProjectNames()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
QList<FunctionDescription> CutterCore::getAllFunctions()
|
QList<FunctionDescription> CutterCore::getAllFunctions()
|
||||||
{
|
{
|
||||||
CORE_LOCK();
|
CORE_LOCK();
|
||||||
@ -870,6 +837,7 @@ QList<FunctionDescription> CutterCore::getAllFunctions()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
QList<ImportDescription> CutterCore::getAllImports()
|
QList<ImportDescription> CutterCore::getAllImports()
|
||||||
{
|
{
|
||||||
CORE_LOCK();
|
CORE_LOCK();
|
||||||
@ -896,7 +864,6 @@ QList<ImportDescription> CutterCore::getAllImports()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
QList<ExportDescription> CutterCore::getAllExports()
|
QList<ExportDescription> CutterCore::getAllExports()
|
||||||
{
|
{
|
||||||
CORE_LOCK();
|
CORE_LOCK();
|
||||||
@ -962,7 +929,6 @@ QList<SymbolDescription> CutterCore::getAllSymbols()
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
QList<CommentDescription> CutterCore::getAllComments(const QString &filterType)
|
QList<CommentDescription> CutterCore::getAllComments(const QString &filterType)
|
||||||
{
|
{
|
||||||
CORE_LOCK();
|
CORE_LOCK();
|
||||||
@ -1015,6 +981,7 @@ QList<RelocDescription> CutterCore::getAllRelocs()
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
QList<StringDescription> CutterCore::getAllStrings()
|
QList<StringDescription> CutterCore::getAllStrings()
|
||||||
{
|
{
|
||||||
CORE_LOCK();
|
CORE_LOCK();
|
||||||
@ -1109,7 +1076,6 @@ QList<SectionDescription> CutterCore::getAllSections()
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
QList<EntrypointDescription> CutterCore::getAllEntrypoint()
|
QList<EntrypointDescription> CutterCore::getAllEntrypoint()
|
||||||
{
|
{
|
||||||
CORE_LOCK();
|
CORE_LOCK();
|
||||||
@ -1176,3 +1142,8 @@ void CutterCore::addFlag(RVA offset, QString name, RVA size)
|
|||||||
cmd(QString("f %1 %2 @ %3").arg(name).arg(size).arg(offset));
|
cmd(QString("f %1 %2 @ %3").arg(name).arg(size).arg(offset));
|
||||||
emit flagsChanged();
|
emit flagsChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CutterCore::loadPDB(const QString &file)
|
||||||
|
{
|
||||||
|
cmd("idp " + sanitizeStringForCommand(file));
|
||||||
|
}
|
||||||
|
@ -186,6 +186,7 @@ public:
|
|||||||
int fcnEndBbs(RVA addr);
|
int fcnEndBbs(RVA addr);
|
||||||
QString cmd(const QString &str);
|
QString cmd(const QString &str);
|
||||||
QJsonDocument cmdj(const QString &str);
|
QJsonDocument cmdj(const QString &str);
|
||||||
|
QStringList cmdList(const QString &str) { auto l = cmd(str).split("\n"); l.removeAll(""); return l; }
|
||||||
void renameFunction(QString prev_name, QString new_name);
|
void renameFunction(QString prev_name, QString new_name);
|
||||||
void setComment(RVA addr, QString cmt);
|
void setComment(RVA addr, QString cmt);
|
||||||
void delComment(ut64 addr);
|
void delComment(ut64 addr);
|
||||||
@ -231,7 +232,7 @@ public:
|
|||||||
QList<QString> regs;
|
QList<QString> regs;
|
||||||
void setSettings();
|
void setSettings();
|
||||||
|
|
||||||
QList<QString> getList(const QString &type, const QString &subtype = "");
|
void loadPDB(const QString &file);
|
||||||
|
|
||||||
QList<RVA> getSeekHistory();
|
QList<RVA> getSeekHistory();
|
||||||
|
|
||||||
|
@ -9,12 +9,12 @@ AboutDialog::AboutDialog(QWidget *parent) :
|
|||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
setWindowFlags(windowFlags() & (~Qt::WindowContextHelpButtonHint));
|
setWindowFlags(windowFlags() & (~Qt::WindowContextHelpButtonHint));
|
||||||
ui->label->setText(tr("<h1>Cutter</h1>"
|
ui->label->setText(tr("<h1>Cutter</h1>"
|
||||||
"Version 1.0 alpha<br />"
|
"Version 1.0 alpha<br />"
|
||||||
"Using r2-" R2_GITTAP
|
"Using r2-" R2_GITTAP
|
||||||
"<h2>License</h2>"
|
"<h2>License</h2>"
|
||||||
"This Software is released under the GNU General Public License v3.0"
|
"This Software is released under the GNU General Public License v3.0"
|
||||||
"<h2>Authors</h2>"
|
"<h2>Authors</h2>"
|
||||||
"Hugo Teso <hugo.teso@gmail.org>\nSoon to be thousands more!"));
|
"Hugo Teso <hugo.teso@gmail.org>\nSoon to be thousands more!"));
|
||||||
}
|
}
|
||||||
|
|
||||||
AboutDialog::~AboutDialog()
|
AboutDialog::~AboutDialog()
|
||||||
|
@ -93,6 +93,7 @@ MainWindow::MainWindow(QWidget *parent) :
|
|||||||
highlighter(nullptr),
|
highlighter(nullptr),
|
||||||
hex_highlighter(nullptr),
|
hex_highlighter(nullptr),
|
||||||
graphicsBar(nullptr),
|
graphicsBar(nullptr),
|
||||||
|
entrypointDock(nullptr),
|
||||||
functionsDock(nullptr),
|
functionsDock(nullptr),
|
||||||
importsDock(nullptr),
|
importsDock(nullptr),
|
||||||
exportsDock(nullptr),
|
exportsDock(nullptr),
|
||||||
@ -107,7 +108,6 @@ MainWindow::MainWindow(QWidget *parent) :
|
|||||||
sidebar_action(nullptr),
|
sidebar_action(nullptr),
|
||||||
sectionsDock(nullptr),
|
sectionsDock(nullptr),
|
||||||
consoleWidget(nullptr),
|
consoleWidget(nullptr),
|
||||||
entrypointDock(nullptr),
|
|
||||||
webserver(core)
|
webserver(core)
|
||||||
{
|
{
|
||||||
doLock = false;
|
doLock = false;
|
||||||
@ -183,14 +183,17 @@ void MainWindow::initUI()
|
|||||||
// Asm syntaxes
|
// Asm syntaxes
|
||||||
QList<QString> list = core->cmd("e asm.syntax =?").split("\n");
|
QList<QString> list = core->cmd("e asm.syntax =?").split("\n");
|
||||||
QString checked = core->getConfig("asm.syntax");
|
QString checked = core->getConfig("asm.syntax");
|
||||||
for (QString syntax : list) {
|
for (QString syntax : list)
|
||||||
if (syntax == "") {
|
{
|
||||||
|
if (syntax == "")
|
||||||
|
{
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
QAction* action = new QAction(ui->menuAsm_syntax);
|
QAction *action = new QAction(ui->menuAsm_syntax);
|
||||||
action->setText(syntax);
|
action->setText(syntax);
|
||||||
action->setCheckable(true);
|
action->setCheckable(true);
|
||||||
if (syntax == checked) {
|
if (syntax == checked)
|
||||||
|
{
|
||||||
action->setChecked(true);
|
action->setChecked(true);
|
||||||
}
|
}
|
||||||
connect(action, SIGNAL(triggered()), this, SLOT(actionAsm_syntax_triggered()));
|
connect(action, SIGNAL(triggered()), this, SLOT(actionAsm_syntax_triggered()));
|
||||||
@ -1113,13 +1116,14 @@ void MainWindow::on_actionDisplay_Offsets_triggered()
|
|||||||
|
|
||||||
void MainWindow::actionAsm_syntax_triggered()
|
void MainWindow::actionAsm_syntax_triggered()
|
||||||
{
|
{
|
||||||
QObject* sender = QObject::sender();
|
QObject *sender = QObject::sender();
|
||||||
// Uncheck every other choices
|
// Uncheck every other choices
|
||||||
for (QAction* action : asmSyntaxes) {
|
for (QAction *action : asmSyntaxes)
|
||||||
|
{
|
||||||
action->setChecked(false);
|
action->setChecked(false);
|
||||||
}
|
}
|
||||||
// Check selected choice
|
// Check selected choice
|
||||||
QAction* action = (QAction*) sender;
|
QAction *action = (QAction *) sender;
|
||||||
action->setChecked(true);
|
action->setChecked(true);
|
||||||
// Set r2 config
|
// Set r2 config
|
||||||
core->config("asm.syntax", action->text());
|
core->config("asm.syntax", action->text());
|
||||||
|
@ -11,6 +11,7 @@
|
|||||||
|
|
||||||
#include <QSettings>
|
#include <QSettings>
|
||||||
#include <QFileInfo>
|
#include <QFileInfo>
|
||||||
|
#include <QFileDialog>
|
||||||
|
|
||||||
OptionsDialog::OptionsDialog(MainWindow *main):
|
OptionsDialog::OptionsDialog(MainWindow *main):
|
||||||
QDialog(0), // parent may not be main
|
QDialog(0), // parent may not be main
|
||||||
@ -29,7 +30,20 @@ OptionsDialog::OptionsDialog(MainWindow *main):
|
|||||||
// Fill the plugins combo
|
// Fill the plugins combo
|
||||||
asm_plugins = main->core->getAsmPluginNames();
|
asm_plugins = main->core->getAsmPluginNames();
|
||||||
for (auto plugin : asm_plugins)
|
for (auto plugin : asm_plugins)
|
||||||
ui->processorComboBox->addItem(plugin, plugin);
|
ui->archComboBox->addItem(plugin, plugin);
|
||||||
|
ui->archComboBox->setToolTip(main->core->cmd("e? asm.arch").trimmed());
|
||||||
|
|
||||||
|
// cpu combo box
|
||||||
|
ui->cpuComboBox->lineEdit()->setPlaceholderText(tr("Auto"));
|
||||||
|
ui->cpuComboBox->setToolTip(main->core->cmd("e? asm.cpu").trimmed());
|
||||||
|
updateCPUComboBox();
|
||||||
|
|
||||||
|
// os combo box
|
||||||
|
for (const auto &plugin : main->core->cmdList("e asm.os=?"))
|
||||||
|
ui->kernelComboBox->addItem(plugin, plugin);
|
||||||
|
ui->kernelComboBox->setToolTip(main->core->cmd("e? asm.os").trimmed());
|
||||||
|
|
||||||
|
ui->bitsComboBox->setToolTip(main->core->cmd("e? asm.bits").trimmed());
|
||||||
|
|
||||||
// Restore settings
|
// Restore settings
|
||||||
QSettings settings;
|
QSettings settings;
|
||||||
@ -42,6 +56,10 @@ OptionsDialog::OptionsDialog(MainWindow *main):
|
|||||||
ui->hideFrame->setVisible(false);
|
ui->hideFrame->setVisible(false);
|
||||||
ui->analoptionsFrame->setVisible(false);
|
ui->analoptionsFrame->setVisible(false);
|
||||||
|
|
||||||
|
updatePDBLayout();
|
||||||
|
|
||||||
|
connect(ui->pdbCheckBox, SIGNAL(stateChanged(int)), this, SLOT(updatePDBLayout()));
|
||||||
|
|
||||||
// Add this so the dialog resizes when widgets are shown/hidden
|
// Add this so the dialog resizes when widgets are shown/hidden
|
||||||
//this->layout()->setSizeConstraint(QLayout::SetFixedSize);
|
//this->layout()->setSizeConstraint(QLayout::SetFixedSize);
|
||||||
|
|
||||||
@ -57,6 +75,54 @@ OptionsDialog::~OptionsDialog()
|
|||||||
delete ui;
|
delete ui;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void OptionsDialog::updateCPUComboBox()
|
||||||
|
{
|
||||||
|
QString currentText = ui->cpuComboBox->lineEdit()->text();
|
||||||
|
ui->cpuComboBox->clear();
|
||||||
|
|
||||||
|
QString cmd = "e asm.cpu=?";
|
||||||
|
|
||||||
|
QString arch = getSelectedArch();
|
||||||
|
if (!arch.isNull())
|
||||||
|
cmd += " @a:" + arch;
|
||||||
|
|
||||||
|
ui->cpuComboBox->addItem("");
|
||||||
|
ui->cpuComboBox->addItems(main->core->cmdList(cmd));
|
||||||
|
|
||||||
|
ui->cpuComboBox->lineEdit()->setText(currentText);
|
||||||
|
}
|
||||||
|
|
||||||
|
QString OptionsDialog::getSelectedArch()
|
||||||
|
{
|
||||||
|
QVariant archValue = ui->archComboBox->currentData();
|
||||||
|
return archValue.isValid() ? archValue.toString() : nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
QString OptionsDialog::getSelectedCPU()
|
||||||
|
{
|
||||||
|
QString cpu = ui->cpuComboBox->currentText();
|
||||||
|
if (cpu.isNull() || cpu.isEmpty())
|
||||||
|
return nullptr;
|
||||||
|
return cpu;
|
||||||
|
}
|
||||||
|
|
||||||
|
int OptionsDialog::getSelectedBits()
|
||||||
|
{
|
||||||
|
QString sel_bits = ui->bitsComboBox->currentText();
|
||||||
|
if (sel_bits != "Auto")
|
||||||
|
{
|
||||||
|
return sel_bits.toInt();
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
QString OptionsDialog::getSelectedOS()
|
||||||
|
{
|
||||||
|
QVariant os = ui->kernelComboBox->currentData();
|
||||||
|
return os.isValid() ? os.toString() : nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
void OptionsDialog::setupAndStartAnalysis(int level, QList<QString> advanced)
|
void OptionsDialog::setupAndStartAnalysis(int level, QList<QString> advanced)
|
||||||
{
|
{
|
||||||
ui->analSlider->setValue(level);
|
ui->analSlider->setValue(level);
|
||||||
@ -93,18 +159,8 @@ void OptionsDialog::setupAndStartAnalysis(int level, QList<QString> advanced)
|
|||||||
//
|
//
|
||||||
// Advanced Options
|
// Advanced Options
|
||||||
//
|
//
|
||||||
QVariant archValue = ui->processorComboBox->currentData();
|
|
||||||
|
|
||||||
int bits = 0;
|
main->core->setCPU(getSelectedArch(), getSelectedCPU(), getSelectedBits());
|
||||||
QString sel_bits = ui->bitsComboBox->currentText();
|
|
||||||
if (sel_bits != "Auto")
|
|
||||||
{
|
|
||||||
bits = sel_bits.toInt();
|
|
||||||
}
|
|
||||||
|
|
||||||
main->core->setCPU(archValue.isValid() ? archValue.toString() : NULL,
|
|
||||||
QString(),
|
|
||||||
bits);
|
|
||||||
|
|
||||||
bool rw = false;
|
bool rw = false;
|
||||||
bool load_bininfo = ui->binCheckBox->isChecked();
|
bool load_bininfo = ui->binCheckBox->isChecked();
|
||||||
@ -135,6 +191,20 @@ void OptionsDialog::setupAndStartAnalysis(int level, QList<QString> advanced)
|
|||||||
//ui->progressBar->setValue(40);
|
//ui->progressBar->setValue(40);
|
||||||
ui->statusLabel->setText(tr("Analysis in progress"));
|
ui->statusLabel->setText(tr("Analysis in progress"));
|
||||||
|
|
||||||
|
|
||||||
|
QString os = getSelectedOS();
|
||||||
|
if (!os.isNull())
|
||||||
|
{
|
||||||
|
main->core->cmd("e asm.os=" + os);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if (ui->pdbCheckBox->isChecked())
|
||||||
|
{
|
||||||
|
main->core->loadPDB(ui->pdbLineEdit->text());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// Threads stuff
|
// Threads stuff
|
||||||
// connect signal/slot
|
// connect signal/slot
|
||||||
analThread.start(main->core, level, advanced);
|
analThread.start(main->core, level, advanced);
|
||||||
@ -148,38 +218,50 @@ void OptionsDialog::on_closeButton_clicked()
|
|||||||
void OptionsDialog::on_okButton_clicked()
|
void OptionsDialog::on_okButton_clicked()
|
||||||
{
|
{
|
||||||
QList<QString> advanced = QList<QString>();
|
QList<QString> advanced = QList<QString>();
|
||||||
if (ui->analSlider->value() == 3){
|
if (ui->analSlider->value() == 3)
|
||||||
if (ui->aa_symbols->isChecked()){
|
{
|
||||||
|
if (ui->aa_symbols->isChecked())
|
||||||
|
{
|
||||||
advanced << "aa";
|
advanced << "aa";
|
||||||
}
|
}
|
||||||
if (ui->aar_references->isChecked()){
|
if (ui->aar_references->isChecked())
|
||||||
|
{
|
||||||
advanced << "aar";
|
advanced << "aar";
|
||||||
}
|
}
|
||||||
if (ui->aac_calls->isChecked()){
|
if (ui->aac_calls->isChecked())
|
||||||
|
{
|
||||||
advanced << "aac";
|
advanced << "aac";
|
||||||
}
|
}
|
||||||
if (ui->aan_rename->isChecked()){
|
if (ui->aan_rename->isChecked())
|
||||||
|
{
|
||||||
advanced << "aan";
|
advanced << "aan";
|
||||||
}
|
}
|
||||||
if (ui->aae_emulate->isChecked()){
|
if (ui->aae_emulate->isChecked())
|
||||||
|
{
|
||||||
advanced << "aae";
|
advanced << "aae";
|
||||||
}
|
}
|
||||||
if (ui->aat_consecutive->isChecked()){
|
if (ui->aat_consecutive->isChecked())
|
||||||
|
{
|
||||||
advanced << "aat";
|
advanced << "aat";
|
||||||
}
|
}
|
||||||
if (ui->afta_typeargument->isChecked()){
|
if (ui->afta_typeargument->isChecked())
|
||||||
|
{
|
||||||
advanced << "afta";
|
advanced << "afta";
|
||||||
}
|
}
|
||||||
if (ui->aaT_aftertrap->isChecked()){
|
if (ui->aaT_aftertrap->isChecked())
|
||||||
|
{
|
||||||
advanced << "aaT";
|
advanced << "aaT";
|
||||||
}
|
}
|
||||||
if (ui->aap_preludes->isChecked()){
|
if (ui->aap_preludes->isChecked())
|
||||||
|
{
|
||||||
advanced << "aap";
|
advanced << "aap";
|
||||||
}
|
}
|
||||||
if (ui->jmptbl->isChecked()){
|
if (ui->jmptbl->isChecked())
|
||||||
|
{
|
||||||
advanced << "e! anal.jmptbl";
|
advanced << "e! anal.jmptbl";
|
||||||
}
|
}
|
||||||
if (ui->pushret->isChecked()){
|
if (ui->pushret->isChecked())
|
||||||
|
{
|
||||||
advanced << "e! anal.pushret";
|
advanced << "e! anal.pushret";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -247,7 +329,7 @@ void OptionsDialog::on_analSlider_valueChanged(int value)
|
|||||||
{
|
{
|
||||||
ui->analCheckBox->setChecked(true);
|
ui->analCheckBox->setChecked(true);
|
||||||
ui->analCheckBox->setText(tr("Analysis: Enabled"));
|
ui->analCheckBox->setText(tr("Analysis: Enabled"));
|
||||||
if (value==3)
|
if (value == 3)
|
||||||
{
|
{
|
||||||
ui->analoptionsFrame->setVisible(true);
|
ui->analoptionsFrame->setVisible(true);
|
||||||
}
|
}
|
||||||
@ -278,3 +360,32 @@ void OptionsDialog::on_analCheckBox_clicked(bool checked)
|
|||||||
defaultAnalLevel = ui->analSlider->value();
|
defaultAnalLevel = ui->analSlider->value();
|
||||||
ui->analSlider->setValue(checked ? defaultAnalLevel : 0);
|
ui->analSlider->setValue(checked ? defaultAnalLevel : 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void OptionsDialog::on_archComboBox_currentIndexChanged(int)
|
||||||
|
{
|
||||||
|
updateCPUComboBox();
|
||||||
|
}
|
||||||
|
|
||||||
|
void OptionsDialog::updatePDBLayout()
|
||||||
|
{
|
||||||
|
ui->pdbWidget->setEnabled(ui->pdbCheckBox->isChecked());
|
||||||
|
}
|
||||||
|
|
||||||
|
void OptionsDialog::on_pdbSelectButton_clicked()
|
||||||
|
{
|
||||||
|
QFileDialog dialog(this);
|
||||||
|
dialog.setWindowTitle(tr("Select PDB file"));
|
||||||
|
dialog.setNameFilters({ tr("PDB file (*.pdb)"), tr("All files (*)") });
|
||||||
|
|
||||||
|
if (!dialog.exec())
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
QString fileName = dialog.selectedFiles().first();
|
||||||
|
|
||||||
|
if (!fileName.isEmpty())
|
||||||
|
{
|
||||||
|
ui->pdbLineEdit->setText(fileName);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@ -27,19 +27,18 @@ public:
|
|||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void on_closeButton_clicked();
|
void on_closeButton_clicked();
|
||||||
|
|
||||||
void on_okButton_clicked();
|
void on_okButton_clicked();
|
||||||
|
|
||||||
void on_cancelButton_clicked();
|
void on_cancelButton_clicked();
|
||||||
|
void on_analSlider_valueChanged(int value);
|
||||||
|
void on_AdvOptButton_clicked();
|
||||||
|
void on_analCheckBox_clicked(bool checked);
|
||||||
|
void on_archComboBox_currentIndexChanged(int index);
|
||||||
|
void on_pdbSelectButton_clicked();
|
||||||
|
|
||||||
|
void updatePDBLayout();
|
||||||
|
|
||||||
void anal_finished();
|
void anal_finished();
|
||||||
|
|
||||||
void on_analSlider_valueChanged(int value);
|
|
||||||
|
|
||||||
void on_AdvOptButton_clicked();
|
|
||||||
|
|
||||||
void on_analCheckBox_clicked(bool checked);
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Ui::OptionsDialog *ui;
|
Ui::OptionsDialog *ui;
|
||||||
AnalThread analThread;
|
AnalThread analThread;
|
||||||
@ -47,6 +46,12 @@ private:
|
|||||||
int defaultAnalLevel;
|
int defaultAnalLevel;
|
||||||
|
|
||||||
QString analysisDescription(int level);
|
QString analysisDescription(int level);
|
||||||
|
|
||||||
|
void updateCPUComboBox();
|
||||||
|
QString getSelectedArch();
|
||||||
|
QString getSelectedCPU();
|
||||||
|
int getSelectedBits();
|
||||||
|
QString getSelectedOS();
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // OPTIONSDIALOG_H
|
#endif // OPTIONSDIALOG_H
|
||||||
|
@ -26,7 +26,7 @@
|
|||||||
<string>Load Options</string>
|
<string>Load Options</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="windowIcon">
|
<property name="windowIcon">
|
||||||
<iconset resource="resources.qrc">
|
<iconset>
|
||||||
<normaloff>:/img/logo-small.png</normaloff>:/img/logo-small.png</iconset>
|
<normaloff>:/img/logo-small.png</normaloff>:/img/logo-small.png</iconset>
|
||||||
</property>
|
</property>
|
||||||
<property name="autoFillBackground">
|
<property name="autoFillBackground">
|
||||||
@ -94,7 +94,7 @@
|
|||||||
<string/>
|
<string/>
|
||||||
</property>
|
</property>
|
||||||
<property name="pixmap">
|
<property name="pixmap">
|
||||||
<pixmap resource="resources.qrc">:/img/logo-small.png</pixmap>
|
<pixmap>:/img/logo-small.png</pixmap>
|
||||||
</property>
|
</property>
|
||||||
<property name="alignment">
|
<property name="alignment">
|
||||||
<set>Qt::AlignCenter</set>
|
<set>Qt::AlignCenter</set>
|
||||||
@ -602,22 +602,7 @@ color: rgb(0, 0, 0);</string>
|
|||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QFrame" name="hideFrame">
|
<widget class="QFrame" name="hideFrame">
|
||||||
<layout class="QVBoxLayout" name="hideLayout">
|
<layout class="QVBoxLayout" name="verticalLayout_8">
|
||||||
<property name="spacing">
|
|
||||||
<number>10</number>
|
|
||||||
</property>
|
|
||||||
<property name="leftMargin">
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<property name="topMargin">
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<property name="rightMargin">
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<property name="bottomMargin">
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<item>
|
<item>
|
||||||
<widget class="QLabel" name="label_2">
|
<widget class="QLabel" name="label_2">
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
@ -646,7 +631,7 @@ color: rgb(0, 0, 0);</string>
|
|||||||
<item>
|
<item>
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||||
<item>
|
<item>
|
||||||
<widget class="QLabel" name="processorLabel">
|
<widget class="QLabel" name="archLabel">
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||||
<horstretch>0</horstretch>
|
<horstretch>0</horstretch>
|
||||||
@ -659,7 +644,7 @@ color: rgb(0, 0, 0);</string>
|
|||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QComboBox" name="processorComboBox">
|
<widget class="QComboBox" name="archComboBox">
|
||||||
<property name="currentText">
|
<property name="currentText">
|
||||||
<string notr="true">Auto</string>
|
<string notr="true">Auto</string>
|
||||||
</property>
|
</property>
|
||||||
@ -671,7 +656,38 @@ color: rgb(0, 0, 0);</string>
|
|||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QLabel" name="bitLabel">
|
<widget class="QLabel" name="cpuLabel">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>CPU:</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QComboBox" name="cpuComboBox">
|
||||||
|
<property name="minimumSize">
|
||||||
|
<size>
|
||||||
|
<width>70</width>
|
||||||
|
<height>0</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="editable">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
<item>
|
||||||
|
<property name="text">
|
||||||
|
<string/>
|
||||||
|
</property>
|
||||||
|
</item>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="bitsLabel">
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||||
<horstretch>0</horstretch>
|
<horstretch>0</horstretch>
|
||||||
@ -745,26 +761,6 @@ color: rgb(0, 0, 0);</string>
|
|||||||
<string>Auto</string>
|
<string>Auto</string>
|
||||||
</property>
|
</property>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
|
||||||
<property name="text">
|
|
||||||
<string>Linux</string>
|
|
||||||
</property>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<property name="text">
|
|
||||||
<string>BSD</string>
|
|
||||||
</property>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<property name="text">
|
|
||||||
<string>OS X</string>
|
|
||||||
</property>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<property name="text">
|
|
||||||
<string>Windows</string>
|
|
||||||
</property>
|
|
||||||
</item>
|
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
@ -926,6 +922,48 @@ color: rgb(0, 0, 0);</string>
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item row="3" column="0">
|
||||||
|
<widget class="QCheckBox" name="pdbCheckBox">
|
||||||
|
<property name="text">
|
||||||
|
<string>Load PDB</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="3" column="1">
|
||||||
|
<widget class="QWidget" name="pdbWidget" native="true">
|
||||||
|
<property name="enabled">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
<layout class="QHBoxLayout" name="pdbLayout">
|
||||||
|
<property name="leftMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="topMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="rightMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="bottomMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<item>
|
||||||
|
<widget class="QLineEdit" name="pdbLineEdit">
|
||||||
|
<property name="placeholderText">
|
||||||
|
<string>pdb file</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="pdbSelectButton">
|
||||||
|
<property name="text">
|
||||||
|
<string>Select</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
|
@ -183,7 +183,7 @@ void ConsoleWidget::on_inputLineEdit_returnPressed()
|
|||||||
QString input = ui->inputLineEdit->text();
|
QString input = ui->inputLineEdit->text();
|
||||||
if (!input.isEmpty() && core != nullptr)
|
if (!input.isEmpty() && core != nullptr)
|
||||||
{
|
{
|
||||||
if (!isForbidden(input))
|
if (true || !isForbidden(input))
|
||||||
{
|
{
|
||||||
ui->outputTextEdit->appendPlainText(this->core->cmd(input));
|
ui->outputTextEdit->appendPlainText(this->core->cmd(input));
|
||||||
scrollOutputToEnd();
|
scrollOutputToEnd();
|
||||||
|
@ -469,7 +469,7 @@ void MemoryWidget::replaceTextDisasm(QString txt)
|
|||||||
bool MemoryWidget::loadMoreDisassembly()
|
bool MemoryWidget::loadMoreDisassembly()
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
z * Add more disasm as the user scrolls
|
z * Add more disasm as the user scrolls
|
||||||
* Not working properly when scrolling upwards
|
* Not working properly when scrolling upwards
|
||||||
* r2 doesn't handle properly 'pd-' for archs with variable instruction size
|
* r2 doesn't handle properly 'pd-' for archs with variable instruction size
|
||||||
*/
|
*/
|
||||||
@ -2005,11 +2005,15 @@ void MemoryWidget::updateViews(RVA offset)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void MemoryWidget::showOffsets(bool show) {
|
void MemoryWidget::showOffsets(bool show)
|
||||||
if (show) {
|
{
|
||||||
|
if (show)
|
||||||
|
{
|
||||||
this->hexOffsetText->show();
|
this->hexOffsetText->show();
|
||||||
main->core->config("asm.offset", 1);
|
main->core->config("asm.offset", 1);
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
this->hexOffsetText->hide();
|
this->hexOffsetText->hide();
|
||||||
main->core->config("asm.offset", 0);
|
main->core->config("asm.offset", 0);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user