From a71f2a8b27af5df5343d2ac43a1c3a7e81d63f02 Mon Sep 17 00:00:00 2001 From: xarkes Date: Thu, 31 Aug 2017 19:43:46 +0200 Subject: [PATCH] Fix #114 (#205) --- src/iaitorcore.h | 1 + src/mainwindow.cpp | 14 ++++++++++++++ src/mainwindow.h | 4 ++++ src/mainwindow.ui | 21 ++++++++++++++++++++- src/qrcore.cpp | 11 +++++++++++ 5 files changed, 50 insertions(+), 1 deletion(-) diff --git a/src/iaitorcore.h b/src/iaitorcore.h index 959a72a5..8c690e51 100644 --- a/src/iaitorcore.h +++ b/src/iaitorcore.h @@ -198,6 +198,7 @@ public: QString itoa(ut64 num, int rdx = 16); QString config(const QString &k, const QString &v = NULL); int config(const QString &k, int v); + int getConfig(const QString &k); QString assemble(const QString &code); QString disassemble(const QString &hex); QString disassembleSingleInstruction(RVA addr); diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index 82cfde55..e0fc73f3 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -1078,3 +1078,17 @@ void MainWindow::on_actionRefresh_contents_triggered() { this->refreshVisibleDockWidgets(); } + +void MainWindow::on_actionDisplay_Esil_triggered() +{ + int esil = this->core->getConfig("asm.esil"); + this->core->config("asm.esil", !esil); + this->refreshVisibleDockWidgets(); +} + +void MainWindow::on_actionDisplay_Pseudocode_triggered() +{ + int pseudo = this->core->getConfig("asm.pseudo"); + this->core->config("asm.pseudo", !pseudo); + this->refreshVisibleDockWidgets(); +} diff --git a/src/mainwindow.h b/src/mainwindow.h index 21bac239..100be9e8 100644 --- a/src/mainwindow.h +++ b/src/mainwindow.h @@ -174,6 +174,10 @@ private slots: void on_actionRefresh_contents_triggered(); + void on_actionDisplay_Esil_triggered(); + + void on_actionDisplay_Pseudocode_triggered(); + private: QDockWidget *asmDock; QDockWidget *calcDock; diff --git a/src/mainwindow.ui b/src/mainwindow.ui index 660e52b7..01890e85 100644 --- a/src/mainwindow.ui +++ b/src/mainwindow.ui @@ -214,6 +214,9 @@ border-top: 0px; + + + @@ -882,7 +885,7 @@ QToolButton .svg-icon path { Dashboard - Show/HIde Dashboard panel + Show/Hide Dashboard panel @@ -917,6 +920,22 @@ QToolButton .svg-icon path { Refresh contents + + + Show ESIL rather than assembly + + + true + + + + + Show pseudocode rather than assembly + + + true + + Entry points diff --git a/src/qrcore.cpp b/src/qrcore.cpp index 3e80403a..2828344d 100644 --- a/src/qrcore.cpp +++ b/src/qrcore.cpp @@ -507,6 +507,13 @@ int IaitoRCore::config(const QString &k, int v) return r_config_get_i(core_->config, key.constData()); } +int IaitoRCore::getConfig(const QString &k) +{ + CORE_LOCK(); + QByteArray key = k.toUtf8(); + return r_config_get_i(core_->config, key.constData()); +} + void IaitoRCore::setOptions(QString key) { IAITONOTUSED(key); @@ -734,6 +741,10 @@ void IaitoRCore::setSettings() config("asm.flgoff", "true"); config("anal.autoname", "true"); + // Required for consistency with GUI checkboxes + config("asm.esil", "false"); + config("asm.pseudo", "false"); + // Highlight current node in graphviz config("graph.gv.current", "true");