mirror of
https://github.com/rizinorg/cutter.git
synced 2025-02-21 14:16:08 +00:00
Clean up some unused things
This commit is contained in:
parent
0567114b09
commit
a13a620017
@ -323,26 +323,6 @@ void CutterCore::openFile(QString path, RVA mapaddr)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CutterCore::analyze(int level, QList<QString> advanced)
|
|
||||||
{
|
|
||||||
CORE_LOCK();
|
|
||||||
/*
|
|
||||||
* Levels
|
|
||||||
* Level 1: aaa
|
|
||||||
* Level 2: aaaa
|
|
||||||
*/
|
|
||||||
|
|
||||||
if (level == 1) {
|
|
||||||
r_core_cmd0(core_, "aaa");
|
|
||||||
} else if (level == 2) {
|
|
||||||
r_core_cmd0(core_, "aaaa");
|
|
||||||
} else if (level == 3) {
|
|
||||||
for (QString option : advanced) {
|
|
||||||
r_core_cmd0(core_, option.toStdString().c_str());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void CutterCore::renameFunction(const QString &oldName, const QString &newName)
|
void CutterCore::renameFunction(const QString &oldName, const QString &newName)
|
||||||
{
|
{
|
||||||
cmdRaw("afn " + newName + " " + oldName);
|
cmdRaw("afn " + newName + " " + oldName);
|
||||||
@ -549,11 +529,6 @@ ut64 CutterCore::math(const QString &expr)
|
|||||||
return r_num_math(this->core_ ? this->core_->num : NULL, expr.toUtf8().constData());
|
return r_num_math(this->core_ ? this->core_->num : NULL, expr.toUtf8().constData());
|
||||||
}
|
}
|
||||||
|
|
||||||
QString CutterCore::itoa(ut64 num, int rdx)
|
|
||||||
{
|
|
||||||
return QString::number(num, rdx);
|
|
||||||
}
|
|
||||||
|
|
||||||
void CutterCore::setConfig(const QString &k, const QString &v)
|
void CutterCore::setConfig(const QString &k, const QString &v)
|
||||||
{
|
{
|
||||||
CORE_LOCK();
|
CORE_LOCK();
|
||||||
@ -716,51 +691,6 @@ QString CutterCore::createFunctionAt(RVA addr, QString name)
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CutterCore::markString(RVA addr)
|
|
||||||
{
|
|
||||||
cmd("Cs @" + RAddressString(addr));
|
|
||||||
}
|
|
||||||
|
|
||||||
int CutterCore::get_size()
|
|
||||||
{
|
|
||||||
CORE_LOCK();
|
|
||||||
RBinObject *obj = r_bin_get_object(core_->bin);
|
|
||||||
//return obj->size;
|
|
||||||
return obj != nullptr ? obj->obj_size : 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
ulong CutterCore::get_baddr()
|
|
||||||
{
|
|
||||||
CORE_LOCK();
|
|
||||||
ulong baddr = r_bin_get_baddr(core_->bin);
|
|
||||||
return baddr;
|
|
||||||
}
|
|
||||||
|
|
||||||
QList<QList<QString>> CutterCore::get_exec_sections()
|
|
||||||
{
|
|
||||||
QList<QList<QString>> ret;
|
|
||||||
|
|
||||||
QString text = cmd("S*~^S");
|
|
||||||
for (QString line : text.split("\n")) {
|
|
||||||
QStringList fields = line.split(" ");
|
|
||||||
if (fields.length() == 7) {
|
|
||||||
if (fields[6].contains("x")) {
|
|
||||||
QList<QString> tmp = QList<QString>();
|
|
||||||
tmp << fields[2];
|
|
||||||
tmp << fields[3];
|
|
||||||
tmp << fields[5];
|
|
||||||
ret << tmp;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
QString CutterCore::getOffsetInfo(QString addr)
|
|
||||||
{
|
|
||||||
return cmd("ao @ " + addr);
|
|
||||||
}
|
|
||||||
|
|
||||||
QJsonDocument CutterCore::getRegistersInfo()
|
QJsonDocument CutterCore::getRegistersInfo()
|
||||||
{
|
{
|
||||||
return cmdj("aeafj");
|
return cmdj("aeafj");
|
||||||
@ -1221,29 +1151,6 @@ QStringList CutterCore::getStats()
|
|||||||
return stats;
|
return stats;
|
||||||
}
|
}
|
||||||
|
|
||||||
QString CutterCore::getSimpleGraph(QString function)
|
|
||||||
{
|
|
||||||
// New styles
|
|
||||||
QString graph = "graph [bgcolor=invis, splines=polyline];";
|
|
||||||
QString node =
|
|
||||||
"node [style=\"filled\" fillcolor=\"#4183D7\" shape=box fontname=\"Courier\" fontsize=\"8\" color=\"#4183D7\" fontcolor=\"white\"];";
|
|
||||||
QString arrow = "edge [arrowhead=\"normal\";]";
|
|
||||||
|
|
||||||
// Old styles
|
|
||||||
QString old_graph = "graph [bgcolor=white fontsize=8 fontname=\"Courier\"];";
|
|
||||||
//QString old_node = "node [color=lightgray, style=filled shape=box];";
|
|
||||||
QString old_node = "node [fillcolor=gray style=filled shape=box];";
|
|
||||||
QString old_arrow = "edge [arrowhead=\"vee\"];";
|
|
||||||
|
|
||||||
QString dot = cmd("aga @ " + function).trimmed();
|
|
||||||
dot.replace(old_graph, graph);
|
|
||||||
dot.replace(old_node, node);
|
|
||||||
dot.replace(old_arrow, arrow);
|
|
||||||
dot.replace("fillcolor=blue", "fillcolor=\"#EC644B\", color=\"#EC644B\"");
|
|
||||||
|
|
||||||
return dot;
|
|
||||||
}
|
|
||||||
|
|
||||||
void CutterCore::setGraphEmpty(bool empty)
|
void CutterCore::setGraphEmpty(bool empty)
|
||||||
{
|
{
|
||||||
emptyGraph = empty;
|
emptyGraph = empty;
|
||||||
|
23
src/Cutter.h
23
src/Cutter.h
@ -17,14 +17,9 @@
|
|||||||
#include <QJsonDocument>
|
#include <QJsonDocument>
|
||||||
#include <QErrorMessage>
|
#include <QErrorMessage>
|
||||||
|
|
||||||
#define HAVE_LATEST_LIBR2 false
|
|
||||||
|
|
||||||
#define CutterRListForeach(list, it, type, x) \
|
#define CutterRListForeach(list, it, type, x) \
|
||||||
if (list) for (it = list->head; it && ((x=(type*)it->data)); it = it->n)
|
if (list) for (it = list->head; it && ((x=(type*)it->data)); it = it->n)
|
||||||
|
|
||||||
#define __alert(x) QMessageBox::question (this, "Alert", QString(x), QMessageBox::Ok)
|
|
||||||
#define __question(x) (QMessageBox::Yes==QMessageBox::question (this, "Alert", QString(x), QMessageBox::Yes| QMessageBox::No))
|
|
||||||
|
|
||||||
#define APPNAME "Cutter"
|
#define APPNAME "Cutter"
|
||||||
|
|
||||||
#define Core() (CutterCore::getInstance())
|
#define Core() (CutterCore::getInstance())
|
||||||
@ -60,8 +55,6 @@ public:
|
|||||||
~RCoreLocked();
|
~RCoreLocked();
|
||||||
operator RCore *() const;
|
operator RCore *() const;
|
||||||
RCore *operator->() const;
|
RCore *operator->() const;
|
||||||
RVA seek(RVA offset);
|
|
||||||
RVA getSeek();
|
|
||||||
};
|
};
|
||||||
|
|
||||||
inline QString RAddressString(RVA addr)
|
inline QString RAddressString(RVA addr)
|
||||||
@ -402,7 +395,6 @@ public:
|
|||||||
QString cmdFunctionAt(QString addr);
|
QString cmdFunctionAt(QString addr);
|
||||||
QString cmdFunctionAt(RVA addr);
|
QString cmdFunctionAt(RVA addr);
|
||||||
QString createFunctionAt(RVA addr, QString name);
|
QString createFunctionAt(RVA addr, QString name);
|
||||||
void markString(RVA addr);
|
|
||||||
|
|
||||||
/* Flags */
|
/* Flags */
|
||||||
void delFlag(RVA addr);
|
void delFlag(RVA addr);
|
||||||
@ -438,9 +430,6 @@ public:
|
|||||||
void loadScript(const QString &scriptname);
|
void loadScript(const QString &scriptname);
|
||||||
QJsonArray getOpenedFiles();
|
QJsonArray getOpenedFiles();
|
||||||
|
|
||||||
/* Analysis functions */
|
|
||||||
void analyze(int level, QList<QString> advanced);
|
|
||||||
|
|
||||||
/* Seek functions */
|
/* Seek functions */
|
||||||
void seek(QString thing);
|
void seek(QString thing);
|
||||||
void seek(ut64 offset);
|
void seek(ut64 offset);
|
||||||
@ -468,7 +457,6 @@ public:
|
|||||||
|
|
||||||
/* Math functions */
|
/* Math functions */
|
||||||
ut64 math(const QString &expr);
|
ut64 math(const QString &expr);
|
||||||
QString itoa(ut64 num, int rdx = 16);
|
|
||||||
|
|
||||||
/* Config functions */
|
/* Config functions */
|
||||||
void setConfig(const QString &k, const QString &v);
|
void setConfig(const QString &k, const QString &v);
|
||||||
@ -495,12 +483,8 @@ public:
|
|||||||
QList<QString> sdbListKeys(QString path);
|
QList<QString> sdbListKeys(QString path);
|
||||||
QString sdbGet(QString path, QString key);
|
QString sdbGet(QString path, QString key);
|
||||||
bool sdbSet(QString path, QString key, QString val);
|
bool sdbSet(QString path, QString key, QString val);
|
||||||
int get_size();
|
|
||||||
ulong get_baddr();
|
|
||||||
QList<QList<QString>> get_exec_sections();
|
|
||||||
QString getOffsetInfo(QString addr);
|
|
||||||
|
|
||||||
// Debug
|
/* Debug */
|
||||||
QJsonDocument getRegistersInfo();
|
QJsonDocument getRegistersInfo();
|
||||||
QJsonDocument getRegisterValues();
|
QJsonDocument getRegisterValues();
|
||||||
QString getRegisterName(QString registerRole);
|
QString getRegisterName(QString registerRole);
|
||||||
@ -535,6 +519,7 @@ public:
|
|||||||
int currentlyAttachedToPID = -1;
|
int currentlyAttachedToPID = -1;
|
||||||
QString currentlyOpenFile;
|
QString currentlyOpenFile;
|
||||||
|
|
||||||
|
/* Pseudocode */
|
||||||
QString getDecompiledCodePDC(RVA addr);
|
QString getDecompiledCodePDC(RVA addr);
|
||||||
bool getR2DecAvailable();
|
bool getR2DecAvailable();
|
||||||
QString getDecompiledCodeR2Dec(RVA addr);
|
QString getDecompiledCodeR2Dec(RVA addr);
|
||||||
@ -544,7 +529,6 @@ public:
|
|||||||
QJsonDocument getSignatureInfo();
|
QJsonDocument getSignatureInfo();
|
||||||
QJsonDocument getFileVersionInfo();
|
QJsonDocument getFileVersionInfo();
|
||||||
QStringList getStats();
|
QStringList getStats();
|
||||||
QString getSimpleGraph(QString function);
|
|
||||||
void setGraphEmpty(bool empty);
|
void setGraphEmpty(bool empty);
|
||||||
bool isGraphEmpty();
|
bool isGraphEmpty();
|
||||||
|
|
||||||
@ -633,7 +617,6 @@ signals:
|
|||||||
void refreshCodeViews();
|
void refreshCodeViews();
|
||||||
void stackChanged();
|
void stackChanged();
|
||||||
|
|
||||||
void notesChanged(const QString ¬es);
|
|
||||||
void projectSaved(const QString &name);
|
void projectSaved(const QString &name);
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
@ -659,8 +642,6 @@ signals:
|
|||||||
void newMessage(const QString &msg);
|
void newMessage(const QString &msg);
|
||||||
void newDebugMessage(const QString &msg);
|
void newDebugMessage(const QString &msg);
|
||||||
|
|
||||||
public slots:
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
MemoryWidgetType memoryWidgetPriority;
|
MemoryWidgetType memoryWidgetPriority;
|
||||||
|
|
||||||
|
@ -62,7 +62,7 @@ void Dashboard::updateContents()
|
|||||||
this->ui->relroEdit->setText(relro);
|
this->ui->relroEdit->setText(relro);
|
||||||
}
|
}
|
||||||
|
|
||||||
this->ui->baddrEdit->setText("0x" + QString::number(Core()->get_baddr(), 16));
|
this->ui->baddrEdit->setText(RAddressString(item2["baddr"].toVariant().toULongLong()));
|
||||||
|
|
||||||
if (item2["va"].toBool() == true) {
|
if (item2["va"].toBool() == true) {
|
||||||
this->ui->vaEdit->setText("True");
|
this->ui->vaEdit->setText("True");
|
||||||
|
@ -188,10 +188,13 @@ void SidebarWidget::fillOffsetInfo(QString off)
|
|||||||
.set("scr.color", COLOR_MODE_DISABLED);
|
.set("scr.color", COLOR_MODE_DISABLED);
|
||||||
|
|
||||||
ui->offsetTreeWidget->clear();
|
ui->offsetTreeWidget->clear();
|
||||||
QString raw = Core()->getOffsetInfo(off);
|
QString raw = Core()->cmd(QString("ao@") + off).trimmed();
|
||||||
QList<QString> lines = raw.split("\n", QString::SkipEmptyParts);
|
QList<QString> lines = raw.split("\n", QString::SkipEmptyParts);
|
||||||
for (QString line : lines) {
|
for (QString line : lines) {
|
||||||
QList<QString> eles = line.split(":", QString::SkipEmptyParts);
|
QList<QString> eles = line.split(":", QString::SkipEmptyParts);
|
||||||
|
if (eles.length() < 2) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
QTreeWidgetItem *tempItem = new QTreeWidgetItem();
|
QTreeWidgetItem *tempItem = new QTreeWidgetItem();
|
||||||
tempItem->setText(0, eles.at(0).toUpper());
|
tempItem->setText(0, eles.at(0).toUpper());
|
||||||
tempItem->setText(1, eles.at(1));
|
tempItem->setText(1, eles.at(1));
|
||||||
|
Loading…
Reference in New Issue
Block a user