From fa6902d41c14bc08d544779a188f1e0bff84e3c7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20M=C3=A4rkl?= Date: Thu, 21 Dec 2017 00:22:59 +0100 Subject: [PATCH] Remove some unused members from CutterCore --- src/MainWindow.cpp | 4 --- src/cutter.cpp | 73 ---------------------------------------------- src/cutter.h | 9 ++---- 3 files changed, 2 insertions(+), 84 deletions(-) diff --git a/src/MainWindow.cpp b/src/MainWindow.cpp index 955c703a..6554a3cf 100644 --- a/src/MainWindow.cpp +++ b/src/MainWindow.cpp @@ -372,10 +372,6 @@ void MainWindow::finalizeOpen() "\n" + core->cmd("ie") + "\n" + core->cmd("iM") + "\n"); } - //Get binary beginning/end addresses - this->core->binStart = this->core->cmd("?v $M"); - this->core->binEnd = this->core->cmd("?v $M+$s"); - addOutput(tr(" > Finished, happy reversing :)")); // Add fortune message addOutput("\n" + core->cmd("fo")); diff --git a/src/cutter.cpp b/src/cutter.cpp index ec2b1161..2a99fc3b 100644 --- a/src/cutter.cpp +++ b/src/cutter.cpp @@ -74,41 +74,6 @@ CutterCore *CutterCore::getInstance() return uniqueInstance; } - -int CutterCore::getCycloComplex(ut64 addr) -{ - CORE_LOCK(); - QString ret = ""; - RAnalFunction *fcn = r_anal_get_fcn_in(core_->anal, addr, 0); - if (fcn) - { - ret = cmd("afcc @ " + QString(fcn->name)); - return ret.toInt(); - } - else - { - return 0; - } -} - -int CutterCore::getFcnSize(ut64 addr) -{ - CORE_LOCK(); - QString ret = ""; - QString tmp_ret = ""; - RAnalFunction *fcn = r_anal_get_fcn_in(core_->anal, addr, 0); - if (fcn) - { - tmp_ret = cmd("afi~size[1] " + QString(fcn->name)); - ret = tmp_ret.split("\n")[0]; - return ret.toInt() / 10; - } - else - { - return 0; - } -} - QList CutterCore::sdbList(QString path) { CORE_LOCK(); @@ -474,44 +439,6 @@ ut64 CutterCore::math(const QString &expr) return r_num_math(this->core_ ? this->core_->num : NULL, expr.toUtf8().constData()); } -int CutterCore::fcnCyclomaticComplexity(ut64 addr) -{ - CORE_LOCK(); - RAnalFunction *fcn = r_anal_get_fcn_at(core_->anal, addr, addr); - if (fcn) - return r_anal_fcn_cc(fcn); - return 0; -} - -int CutterCore::fcnBasicBlockCount(ut64 addr) -{ - CORE_LOCK(); - //RAnalFunction *fcn = r_anal_get_fcn_at (core_->anal, addr, addr); - RAnalFunction *fcn = r_anal_get_fcn_in(core_->anal, addr, 0); - if (fcn) - { - return r_list_length(fcn->bbs); - } - return 0; -} - -int CutterCore::fcnEndBbs(RVA addr) -{ - CORE_LOCK(); - RAnalFunction *fcn = r_anal_get_fcn_in(core_->anal, addr, 0); - if (fcn) - { - QString tmp = this->cmd("afi @ " + QString::number(addr) + " ~end-bbs").split("\n")[0]; - if (tmp.contains(":")) - { - QString endbbs = tmp.split(": ")[1]; - return endbbs.toInt(); - } - } - - return 0; -} - QString CutterCore::itoa(ut64 num, int rdx) { return QString::number(num, rdx); diff --git a/src/cutter.h b/src/cutter.h index 14bd74a5..56b5812a 100644 --- a/src/cutter.h +++ b/src/cutter.h @@ -199,11 +199,7 @@ public: /* Getters */ RVA getOffset() const { return core_->offset; } - int getCycloComplex(ut64 addr); - int getFcnSize(ut64 addr); - int fcnCyclomaticComplexity(ut64 addr); - int fcnBasicBlockCount(ut64 addr); - int fcnEndBbs(RVA addr); + static QString sanitizeStringForCommand(QString s); QString cmd(const QString &str); QString cmdRaw(const QString &str); @@ -282,8 +278,7 @@ public: QString getFileInfo(); QStringList getStats(); QString getSimpleGraph(QString function); - QString binStart; - QString binEnd; + void getOpcodes(); QList opcodes; QList regs;