mirror of
https://github.com/rizinorg/cutter.git
synced 2025-01-18 18:38:51 +00:00
Update Rizin
This commit is contained in:
parent
dedbabde56
commit
5218fa0fd6
@ -43,7 +43,7 @@ else()
|
|||||||
endif()
|
endif()
|
||||||
|
|
||||||
set (RZ_LIBS rz_core rz_config rz_cons rz_io rz_util rz_flag rz_asm rz_debug
|
set (RZ_LIBS rz_core rz_config rz_cons rz_io rz_util rz_flag rz_asm rz_debug
|
||||||
rz_hash rz_bin rz_lang rz_io rz_anal rz_parse rz_bp rz_egg rz_reg
|
rz_hash rz_bin rz_lang rz_io rz_analysis rz_parse rz_bp rz_egg rz_reg
|
||||||
rz_search rz_syscall rz_socket rz_magic rz_crypto)
|
rz_search rz_syscall rz_socket rz_magic rz_crypto)
|
||||||
set (RZ_EXTRA_LIBS rz_main)
|
set (RZ_EXTRA_LIBS rz_main)
|
||||||
set (RZ_BIN rz-agent rz-bin rizin rz-diff rz-find rz-gg rz-hash rz-run rz-asm rz-ax)
|
set (RZ_BIN rz-agent rz-bin rizin rz-diff rz-find rz-gg rz-hash rz-run rz-asm rz-ax)
|
||||||
|
@ -44,7 +44,7 @@ if(WIN32)
|
|||||||
bin
|
bin
|
||||||
lang
|
lang
|
||||||
io
|
io
|
||||||
anal
|
analysis
|
||||||
parse
|
parse
|
||||||
bp
|
bp
|
||||||
egg
|
egg
|
||||||
|
2
rizin
2
rizin
@ -1 +1 @@
|
|||||||
Subproject commit 35a9ef94c9378f56628286bf620c1ba45a1eaccd
|
Subproject commit 041d73dce38c277a17df1d513f7f3128c4323ba1
|
@ -22,7 +22,7 @@ void Colors::colorizeAssembly(RichTextPainter::List &list, QString opcode, ut64
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Temporary solution
|
// Temporary solution
|
||||||
// Copied from RZ_API const char* r_print_color_op_type(RPrint *p, ut64 anal_type) {
|
// Copied from RZ_API const char* r_print_color_op_type(RPrint *p, ut64 analysis_type) {
|
||||||
QString Colors::getColor(ut64 type)
|
QString Colors::getColor(ut64 type)
|
||||||
{
|
{
|
||||||
switch (type & RZ_ANAL_OP_TYPE_MASK) {
|
switch (type & RZ_ANAL_OP_TYPE_MASK) {
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
|
|
||||||
#include "core/Cutter.h"
|
#include "core/Cutter.h"
|
||||||
#include "common/RichTextPainter.h"
|
#include "common/RichTextPainter.h"
|
||||||
#include <rz_anal.h>
|
#include <rz_analysis.h>
|
||||||
|
|
||||||
class Colors
|
class Colors
|
||||||
{
|
{
|
||||||
|
@ -187,7 +187,7 @@ void CutterCore::initialize(bool loadPlugins)
|
|||||||
coreBed = rz_cons_sleep_begin();
|
coreBed = rz_cons_sleep_begin();
|
||||||
CORE_LOCK();
|
CORE_LOCK();
|
||||||
|
|
||||||
rz_event_hook(core_->anal->ev, RZ_EVENT_ALL, cutterREventCallback, this);
|
rz_event_hook(core_->analysis->ev, RZ_EVENT_ALL, cutterREventCallback, this);
|
||||||
|
|
||||||
#if defined(APPIMAGE) || defined(MACOS_RZ_BUNDLED)
|
#if defined(APPIMAGE) || defined(MACOS_RZ_BUNDLED)
|
||||||
auto prefix = QDir(QCoreApplication::applicationDirPath());
|
auto prefix = QDir(QCoreApplication::applicationDirPath());
|
||||||
@ -682,10 +682,10 @@ void CutterCore::renameFlag(QString old_name, QString new_name)
|
|||||||
void CutterCore::renameFunctionVariable(QString newName, QString oldName, RVA functionAddress)
|
void CutterCore::renameFunctionVariable(QString newName, QString oldName, RVA functionAddress)
|
||||||
{
|
{
|
||||||
CORE_LOCK();
|
CORE_LOCK();
|
||||||
RzAnalFunction *function = rz_anal_get_function_at(core->anal, functionAddress);
|
RzAnalysisFunction *function = rz_analysis_get_function_at(core->analysis, functionAddress);
|
||||||
RzAnalVar *variable = rz_anal_function_get_var_byname(function, oldName.toUtf8().constData());
|
RzAnalysisVar *variable = rz_analysis_function_get_var_byname(function, oldName.toUtf8().constData());
|
||||||
if (variable) {
|
if (variable) {
|
||||||
rz_anal_var_rename(variable, newName.toUtf8().constData(), true);
|
rz_analysis_var_rename(variable, newName.toUtf8().constData(), true);
|
||||||
}
|
}
|
||||||
emit refreshCodeViews();
|
emit refreshCodeViews();
|
||||||
}
|
}
|
||||||
@ -832,7 +832,7 @@ void CutterCore::delComment(RVA addr)
|
|||||||
QString CutterCore::getCommentAt(RVA addr)
|
QString CutterCore::getCommentAt(RVA addr)
|
||||||
{
|
{
|
||||||
CORE_LOCK();
|
CORE_LOCK();
|
||||||
return rz_meta_get_string(core->anal, RZ_META_TYPE_COMMENT, addr);
|
return rz_meta_get_string(core->analysis, RZ_META_TYPE_COMMENT, addr);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CutterCore::setImmediateBase(const QString &r2BaseName, RVA offset)
|
void CutterCore::setImmediateBase(const QString &r2BaseName, RVA offset)
|
||||||
@ -1131,19 +1131,19 @@ QString CutterCore::disassembleSingleInstruction(RVA addr)
|
|||||||
return cmdRawAt("pi 1", addr).simplified();
|
return cmdRawAt("pi 1", addr).simplified();
|
||||||
}
|
}
|
||||||
|
|
||||||
RzAnalFunction *CutterCore::functionIn(ut64 addr)
|
RzAnalysisFunction *CutterCore::functionIn(ut64 addr)
|
||||||
{
|
{
|
||||||
CORE_LOCK();
|
CORE_LOCK();
|
||||||
RzList *fcns = rz_anal_get_functions_in (core->anal, addr);
|
RzList *fcns = rz_analysis_get_functions_in (core->analysis, addr);
|
||||||
RzAnalFunction *fcn = !rz_list_empty(fcns) ? reinterpret_cast<RzAnalFunction *>(rz_list_first(fcns)) : nullptr;
|
RzAnalysisFunction *fcn = !rz_list_empty(fcns) ? reinterpret_cast<RzAnalysisFunction *>(rz_list_first(fcns)) : nullptr;
|
||||||
rz_list_free(fcns);
|
rz_list_free(fcns);
|
||||||
return fcn;
|
return fcn;
|
||||||
}
|
}
|
||||||
|
|
||||||
RzAnalFunction *CutterCore::functionAt(ut64 addr)
|
RzAnalysisFunction *CutterCore::functionAt(ut64 addr)
|
||||||
{
|
{
|
||||||
CORE_LOCK();
|
CORE_LOCK();
|
||||||
return rz_anal_get_function_at(core->anal, addr);
|
return rz_analysis_get_function_at(core->analysis, addr);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -1154,7 +1154,7 @@ RzAnalFunction *CutterCore::functionAt(ut64 addr)
|
|||||||
RVA CutterCore::getFunctionStart(RVA addr)
|
RVA CutterCore::getFunctionStart(RVA addr)
|
||||||
{
|
{
|
||||||
CORE_LOCK();
|
CORE_LOCK();
|
||||||
RzAnalFunction *fcn = Core()->functionIn(addr);
|
RzAnalysisFunction *fcn = Core()->functionIn(addr);
|
||||||
return fcn ? fcn->addr : RVA_INVALID;
|
return fcn ? fcn->addr : RVA_INVALID;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1166,7 +1166,7 @@ RVA CutterCore::getFunctionStart(RVA addr)
|
|||||||
RVA CutterCore::getFunctionEnd(RVA addr)
|
RVA CutterCore::getFunctionEnd(RVA addr)
|
||||||
{
|
{
|
||||||
CORE_LOCK();
|
CORE_LOCK();
|
||||||
RzAnalFunction *fcn = Core()->functionIn(addr);
|
RzAnalysisFunction *fcn = Core()->functionIn(addr);
|
||||||
return fcn ? fcn->addr : RVA_INVALID;
|
return fcn ? fcn->addr : RVA_INVALID;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1178,12 +1178,12 @@ RVA CutterCore::getFunctionEnd(RVA addr)
|
|||||||
RVA CutterCore::getLastFunctionInstruction(RVA addr)
|
RVA CutterCore::getLastFunctionInstruction(RVA addr)
|
||||||
{
|
{
|
||||||
CORE_LOCK();
|
CORE_LOCK();
|
||||||
RzAnalFunction *fcn = Core()->functionIn(addr);
|
RzAnalysisFunction *fcn = Core()->functionIn(addr);
|
||||||
if (!fcn) {
|
if (!fcn) {
|
||||||
return RVA_INVALID;
|
return RVA_INVALID;
|
||||||
}
|
}
|
||||||
RzAnalBlock *lastBB = (RzAnalBlock *)rz_list_last(fcn->bbs);
|
RzAnalysisBlock *lastBB = (RzAnalysisBlock *)rz_list_last(fcn->bbs);
|
||||||
return lastBB ? lastBB->addr + rz_anal_bb_offset_inst(lastBB, lastBB->ninstr-1) : RVA_INVALID;
|
return lastBB ? lastBB->addr + rz_analysis_bb_offset_inst(lastBB, lastBB->ninstr-1) : RVA_INVALID;
|
||||||
}
|
}
|
||||||
|
|
||||||
QString CutterCore::cmdFunctionAt(QString addr)
|
QString CutterCore::cmdFunctionAt(QString addr)
|
||||||
@ -1377,7 +1377,7 @@ QList<QJsonObject> CutterCore::getStack(int size, int depth)
|
|||||||
return stack;
|
return stack;
|
||||||
}
|
}
|
||||||
|
|
||||||
int base = core->anal->bits;
|
int base = core->analysis->bits;
|
||||||
for (int i = 0; i < size; i += base / 8) {
|
for (int i = 0; i < size; i += base / 8) {
|
||||||
if ((base == 32 && addr + i >= UT32_MAX) || (base == 16 && addr + i >= UT16_MAX)) {
|
if ((base == 32 && addr + i >= UT32_MAX) || (base == 16 && addr + i >= UT16_MAX)) {
|
||||||
break;
|
break;
|
||||||
@ -1398,7 +1398,7 @@ QJsonObject CutterCore::getAddrRefs(RVA addr, int depth) {
|
|||||||
CORE_LOCK();
|
CORE_LOCK();
|
||||||
int bits = core->rasm->bits;
|
int bits = core->rasm->bits;
|
||||||
QByteArray buf = QByteArray();
|
QByteArray buf = QByteArray();
|
||||||
ut64 type = rz_core_anal_address(core, addr);
|
ut64 type = rz_core_analysis_address(core, addr);
|
||||||
|
|
||||||
json["addr"] = QString::number(addr);
|
json["addr"] = QString::number(addr);
|
||||||
|
|
||||||
@ -1426,7 +1426,7 @@ QJsonObject CutterCore::getAddrRefs(RVA addr, int depth) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Attempt to find the address within a function
|
// Attempt to find the address within a function
|
||||||
RzAnalFunction *fcn = rz_anal_get_fcn_in(core->anal, addr, 0);
|
RzAnalysisFunction *fcn = rz_analysis_get_fcn_in(core->analysis, addr, 0);
|
||||||
if (fcn) {
|
if (fcn) {
|
||||||
json["fcn"] = fcn->name;
|
json["fcn"] = fcn->name;
|
||||||
}
|
}
|
||||||
@ -2365,7 +2365,7 @@ void CutterCore::setSettings()
|
|||||||
setConfig("asm.tabs.once", true);
|
setConfig("asm.tabs.once", true);
|
||||||
setConfig("asm.flags.middle", 2);
|
setConfig("asm.flags.middle", 2);
|
||||||
|
|
||||||
setConfig("anal.hasnext", false);
|
setConfig("analysis.hasnext", false);
|
||||||
setConfig("asm.lines.call", false);
|
setConfig("asm.lines.call", false);
|
||||||
|
|
||||||
// Colors
|
// Colors
|
||||||
@ -2407,8 +2407,8 @@ QStringList CutterCore::getAnalPluginNames()
|
|||||||
RzListIter *it;
|
RzListIter *it;
|
||||||
QStringList ret;
|
QStringList ret;
|
||||||
|
|
||||||
RzAnalPlugin *ap;
|
RzAnalysisPlugin *ap;
|
||||||
CutterRListForeach(core->anal->plugins, it, RzAnalPlugin, ap) {
|
CutterRListForeach(core->analysis->plugins, it, RzAnalysisPlugin, ap) {
|
||||||
ret << ap->name;
|
ret << ap->name;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2515,24 +2515,24 @@ QList<FunctionDescription> CutterCore::getAllFunctions()
|
|||||||
CORE_LOCK();
|
CORE_LOCK();
|
||||||
|
|
||||||
QList<FunctionDescription> funcList;
|
QList<FunctionDescription> funcList;
|
||||||
funcList.reserve(rz_list_length(core->anal->fcns));
|
funcList.reserve(rz_list_length(core->analysis->fcns));
|
||||||
|
|
||||||
RzListIter *iter;
|
RzListIter *iter;
|
||||||
RzAnalFunction *fcn;
|
RzAnalysisFunction *fcn;
|
||||||
CutterRListForeach (core->anal->fcns, iter, RzAnalFunction, fcn) {
|
CutterRListForeach (core->analysis->fcns, iter, RzAnalysisFunction, fcn) {
|
||||||
FunctionDescription function;
|
FunctionDescription function;
|
||||||
function.offset = fcn->addr;
|
function.offset = fcn->addr;
|
||||||
function.linearSize = rz_anal_function_linear_size(fcn);
|
function.linearSize = rz_analysis_function_linear_size(fcn);
|
||||||
function.nargs = rz_anal_var_count(core->anal, fcn, 'b', 1) +
|
function.nargs = rz_analysis_var_count(core->analysis, fcn, 'b', 1) +
|
||||||
rz_anal_var_count(core->anal, fcn, 'r', 1) +
|
rz_analysis_var_count(core->analysis, fcn, 'r', 1) +
|
||||||
rz_anal_var_count(core->anal, fcn, 's', 1);
|
rz_analysis_var_count(core->analysis, fcn, 's', 1);
|
||||||
function.nlocals = rz_anal_var_count(core->anal, fcn, 'b', 0) +
|
function.nlocals = rz_analysis_var_count(core->analysis, fcn, 'b', 0) +
|
||||||
rz_anal_var_count(core->anal, fcn, 'r', 0) +
|
rz_analysis_var_count(core->analysis, fcn, 'r', 0) +
|
||||||
rz_anal_var_count(core->anal, fcn, 's', 0);
|
rz_analysis_var_count(core->analysis, fcn, 's', 0);
|
||||||
function.nbbs = rz_list_length (fcn->bbs);
|
function.nbbs = rz_list_length (fcn->bbs);
|
||||||
function.calltype = fcn->cc ? QString::fromUtf8(fcn->cc) : QString();
|
function.calltype = fcn->cc ? QString::fromUtf8(fcn->cc) : QString();
|
||||||
function.name = fcn->name ? QString::fromUtf8(fcn->name) : QString();
|
function.name = fcn->name ? QString::fromUtf8(fcn->name) : QString();
|
||||||
function.edges = rz_anal_function_count_edges(fcn, nullptr);
|
function.edges = rz_analysis_function_count_edges(fcn, nullptr);
|
||||||
function.stackframe = fcn->maxstack;
|
function.stackframe = fcn->maxstack;
|
||||||
funcList.append(function);
|
funcList.append(function);
|
||||||
}
|
}
|
||||||
@ -3002,7 +3002,7 @@ QList<QString> CutterCore::getAllAnalClasses(bool sorted)
|
|||||||
CORE_LOCK();
|
CORE_LOCK();
|
||||||
QList<QString> ret;
|
QList<QString> ret;
|
||||||
|
|
||||||
SdbListPtr l = makeSdbListPtr(rz_anal_class_get_all(core->anal, sorted));
|
SdbListPtr l = makeSdbListPtr(rz_analysis_class_get_all(core->analysis, sorted));
|
||||||
if (!l) {
|
if (!l) {
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
@ -3023,14 +3023,14 @@ QList<AnalMethodDescription> CutterCore::getAnalClassMethods(const QString &cls)
|
|||||||
CORE_LOCK();
|
CORE_LOCK();
|
||||||
QList<AnalMethodDescription> ret;
|
QList<AnalMethodDescription> ret;
|
||||||
|
|
||||||
RzVector *meths = rz_anal_class_method_get_all(core->anal, cls.toUtf8().constData());
|
RzVector *meths = rz_analysis_class_method_get_all(core->analysis, cls.toUtf8().constData());
|
||||||
if (!meths) {
|
if (!meths) {
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
ret.reserve(static_cast<int>(meths->len));
|
ret.reserve(static_cast<int>(meths->len));
|
||||||
RzAnalMethod *meth;
|
RzAnalysisMethod *meth;
|
||||||
CutterRVectorForeach(meths, meth, RzAnalMethod) {
|
CutterRVectorForeach(meths, meth, RzAnalysisMethod) {
|
||||||
AnalMethodDescription desc;
|
AnalMethodDescription desc;
|
||||||
desc.name = QString::fromUtf8(meth->name);
|
desc.name = QString::fromUtf8(meth->name);
|
||||||
desc.addr = meth->addr;
|
desc.addr = meth->addr;
|
||||||
@ -3047,14 +3047,14 @@ QList<AnalBaseClassDescription> CutterCore::getAnalClassBaseClasses(const QStrin
|
|||||||
CORE_LOCK();
|
CORE_LOCK();
|
||||||
QList<AnalBaseClassDescription> ret;
|
QList<AnalBaseClassDescription> ret;
|
||||||
|
|
||||||
RzVector *bases = rz_anal_class_base_get_all(core->anal, cls.toUtf8().constData());
|
RzVector *bases = rz_analysis_class_base_get_all(core->analysis, cls.toUtf8().constData());
|
||||||
if (!bases) {
|
if (!bases) {
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
ret.reserve(static_cast<int>(bases->len));
|
ret.reserve(static_cast<int>(bases->len));
|
||||||
RzAnalBaseClass *base;
|
RzAnalysisBaseClass *base;
|
||||||
CutterRVectorForeach(bases, base, RzAnalBaseClass) {
|
CutterRVectorForeach(bases, base, RzAnalysisBaseClass) {
|
||||||
AnalBaseClassDescription desc;
|
AnalBaseClassDescription desc;
|
||||||
desc.id = QString::fromUtf8(base->id);
|
desc.id = QString::fromUtf8(base->id);
|
||||||
desc.offset = base->offset;
|
desc.offset = base->offset;
|
||||||
@ -3071,14 +3071,14 @@ QList<AnalVTableDescription> CutterCore::getAnalClassVTables(const QString &cls)
|
|||||||
CORE_LOCK();
|
CORE_LOCK();
|
||||||
QList<AnalVTableDescription> acVtables;
|
QList<AnalVTableDescription> acVtables;
|
||||||
|
|
||||||
RzVector *vtables = rz_anal_class_vtable_get_all(core->anal, cls.toUtf8().constData());
|
RzVector *vtables = rz_analysis_class_vtable_get_all(core->analysis, cls.toUtf8().constData());
|
||||||
if (!vtables) {
|
if (!vtables) {
|
||||||
return acVtables;
|
return acVtables;
|
||||||
}
|
}
|
||||||
|
|
||||||
acVtables.reserve(static_cast<int>(vtables->len));
|
acVtables.reserve(static_cast<int>(vtables->len));
|
||||||
RzAnalVTable *vtable;
|
RzAnalysisVTable *vtable;
|
||||||
CutterRVectorForeach(vtables, vtable, RzAnalVTable) {
|
CutterRVectorForeach(vtables, vtable, RzAnalysisVTable) {
|
||||||
AnalVTableDescription desc;
|
AnalVTableDescription desc;
|
||||||
desc.id = QString::fromUtf8(vtable->id);
|
desc.id = QString::fromUtf8(vtable->id);
|
||||||
desc.offset = vtable->offset;
|
desc.offset = vtable->offset;
|
||||||
@ -3093,50 +3093,50 @@ QList<AnalVTableDescription> CutterCore::getAnalClassVTables(const QString &cls)
|
|||||||
void CutterCore::createNewClass(const QString &cls)
|
void CutterCore::createNewClass(const QString &cls)
|
||||||
{
|
{
|
||||||
CORE_LOCK();
|
CORE_LOCK();
|
||||||
rz_anal_class_create(core->anal, cls.toUtf8().constData());
|
rz_analysis_class_create(core->analysis, cls.toUtf8().constData());
|
||||||
}
|
}
|
||||||
|
|
||||||
void CutterCore::renameClass(const QString &oldName, const QString &newName)
|
void CutterCore::renameClass(const QString &oldName, const QString &newName)
|
||||||
{
|
{
|
||||||
CORE_LOCK();
|
CORE_LOCK();
|
||||||
rz_anal_class_rename(core->anal, oldName.toUtf8().constData(), newName.toUtf8().constData());
|
rz_analysis_class_rename(core->analysis, oldName.toUtf8().constData(), newName.toUtf8().constData());
|
||||||
}
|
}
|
||||||
|
|
||||||
void CutterCore::deleteClass(const QString &cls)
|
void CutterCore::deleteClass(const QString &cls)
|
||||||
{
|
{
|
||||||
CORE_LOCK();
|
CORE_LOCK();
|
||||||
rz_anal_class_delete(core->anal, cls.toUtf8().constData());
|
rz_analysis_class_delete(core->analysis, cls.toUtf8().constData());
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CutterCore::getAnalMethod(const QString &cls, const QString &meth, AnalMethodDescription *desc)
|
bool CutterCore::getAnalMethod(const QString &cls, const QString &meth, AnalMethodDescription *desc)
|
||||||
{
|
{
|
||||||
CORE_LOCK();
|
CORE_LOCK();
|
||||||
RzAnalMethod analMeth;
|
RzAnalysisMethod analMeth;
|
||||||
if (rz_anal_class_method_get(core->anal, cls.toUtf8().constData(), meth.toUtf8().constData(), &analMeth) != RZ_ANAL_CLASS_ERR_SUCCESS) {
|
if (rz_analysis_class_method_get(core->analysis, cls.toUtf8().constData(), meth.toUtf8().constData(), &analMeth) != RZ_ANAL_CLASS_ERR_SUCCESS) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
desc->name = QString::fromUtf8(analMeth.name);
|
desc->name = QString::fromUtf8(analMeth.name);
|
||||||
desc->addr = analMeth.addr;
|
desc->addr = analMeth.addr;
|
||||||
desc->vtableOffset = analMeth.vtable_offset;
|
desc->vtableOffset = analMeth.vtable_offset;
|
||||||
rz_anal_class_method_fini(&analMeth);
|
rz_analysis_class_method_fini(&analMeth);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CutterCore::setAnalMethod(const QString &className, const AnalMethodDescription &meth)
|
void CutterCore::setAnalMethod(const QString &className, const AnalMethodDescription &meth)
|
||||||
{
|
{
|
||||||
CORE_LOCK();
|
CORE_LOCK();
|
||||||
RzAnalMethod analMeth;
|
RzAnalysisMethod analMeth;
|
||||||
analMeth.name = strdup (meth.name.toUtf8().constData());
|
analMeth.name = strdup (meth.name.toUtf8().constData());
|
||||||
analMeth.addr = meth.addr;
|
analMeth.addr = meth.addr;
|
||||||
analMeth.vtable_offset = meth.vtableOffset;
|
analMeth.vtable_offset = meth.vtableOffset;
|
||||||
rz_anal_class_method_set(core->anal, className.toUtf8().constData(), &analMeth);
|
rz_analysis_class_method_set(core->analysis, className.toUtf8().constData(), &analMeth);
|
||||||
rz_anal_class_method_fini(&analMeth);
|
rz_analysis_class_method_fini(&analMeth);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CutterCore::renameAnalMethod(const QString &className, const QString &oldMethodName, const QString &newMethodName)
|
void CutterCore::renameAnalMethod(const QString &className, const QString &oldMethodName, const QString &newMethodName)
|
||||||
{
|
{
|
||||||
CORE_LOCK();
|
CORE_LOCK();
|
||||||
rz_anal_class_method_rename(core->anal, className.toUtf8().constData(), oldMethodName.toUtf8().constData(), newMethodName.toUtf8().constData());
|
rz_analysis_class_method_rename(core->analysis, className.toUtf8().constData(), oldMethodName.toUtf8().constData(), newMethodName.toUtf8().constData());
|
||||||
}
|
}
|
||||||
|
|
||||||
QList<ResourcesDescription> CutterCore::getAllResources()
|
QList<ResourcesDescription> CutterCore::getAllResources()
|
||||||
@ -3304,7 +3304,7 @@ QString CutterCore::addTypes(const char *str)
|
|||||||
{
|
{
|
||||||
CORE_LOCK();
|
CORE_LOCK();
|
||||||
char *error_msg = nullptr;
|
char *error_msg = nullptr;
|
||||||
char *parsed = rz_parse_c_string(core->anal, str, &error_msg);
|
char *parsed = rz_parse_c_string(core->analysis, str, &error_msg);
|
||||||
QString error;
|
QString error;
|
||||||
|
|
||||||
if (!parsed) {
|
if (!parsed) {
|
||||||
@ -3315,7 +3315,7 @@ QString CutterCore::addTypes(const char *str)
|
|||||||
return error;
|
return error;
|
||||||
}
|
}
|
||||||
|
|
||||||
rz_anal_save_parsed_type(core->anal, parsed);
|
rz_analysis_save_parsed_type(core->analysis, parsed);
|
||||||
rz_mem_free(parsed);
|
rz_mem_free(parsed);
|
||||||
|
|
||||||
if (error_msg) {
|
if (error_msg) {
|
||||||
@ -3722,7 +3722,7 @@ QString CutterCore::getVersionInformation()
|
|||||||
const char *name;
|
const char *name;
|
||||||
const char *(*callback)();
|
const char *(*callback)();
|
||||||
} vcs[] = {
|
} vcs[] = {
|
||||||
{ "rz_anal", &rz_anal_version },
|
{ "rz_analysis", &rz_analysis_version },
|
||||||
{ "rz_lib", &rz_lib_version },
|
{ "rz_lib", &rz_lib_version },
|
||||||
{ "rz_egg", &rz_egg_version },
|
{ "rz_egg", &rz_egg_version },
|
||||||
{ "rz_asm", &rz_asm_version },
|
{ "rz_asm", &rz_asm_version },
|
||||||
|
@ -162,13 +162,13 @@ public:
|
|||||||
* @param addr
|
* @param addr
|
||||||
* @return a function that contains addr or nullptr
|
* @return a function that contains addr or nullptr
|
||||||
*/
|
*/
|
||||||
RzAnalFunction *functionIn(ut64 addr);
|
RzAnalysisFunction *functionIn(ut64 addr);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param addr
|
* @param addr
|
||||||
* @return the function that has its entrypoint at addr or nullptr
|
* @return the function that has its entrypoint at addr or nullptr
|
||||||
*/
|
*/
|
||||||
RzAnalFunction *functionAt(ut64 addr);
|
RzAnalysisFunction *functionAt(ut64 addr);
|
||||||
|
|
||||||
RVA getFunctionStart(RVA addr);
|
RVA getFunctionStart(RVA addr);
|
||||||
RVA getFunctionEnd(RVA addr);
|
RVA getFunctionEnd(RVA addr);
|
||||||
|
@ -26,7 +26,7 @@ struct FunctionDescription {
|
|||||||
bool contains(RVA addr) const
|
bool contains(RVA addr) const
|
||||||
{
|
{
|
||||||
// TODO: this is not exactly correct in edge cases.
|
// TODO: this is not exactly correct in edge cases.
|
||||||
// rz_anal_function_contains() does it right.
|
// rz_analysis_function_contains() does it right.
|
||||||
return addr >= offset && addr < offset + linearSize;
|
return addr >= offset && addr < offset + linearSize;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -65,9 +65,9 @@ InitialOptionsDialog::InitialOptionsDialog(MainWindow *main):
|
|||||||
{ { "aaft", tr("Type and Argument matching analysis") }, new QCheckBox(), false },
|
{ { "aaft", tr("Type and Argument matching analysis") }, new QCheckBox(), false },
|
||||||
{ { "aaT", tr("Analyze code after trap-sleds") }, new QCheckBox(), false },
|
{ { "aaT", tr("Analyze code after trap-sleds") }, new QCheckBox(), false },
|
||||||
{ { "aap", tr("Analyze function preludes") }, new QCheckBox(), false },
|
{ { "aap", tr("Analyze function preludes") }, new QCheckBox(), false },
|
||||||
{ { "e! anal.jmp.tbl", tr("Analyze jump tables in switch statements") }, new QCheckBox(), false },
|
{ { "e! analysis.jmp.tbl", tr("Analyze jump tables in switch statements") }, new QCheckBox(), false },
|
||||||
{ { "e! anal.pushret", tr("Analyze PUSH+RET as JMP") }, new QCheckBox(), false },
|
{ { "e! analysis.pushret", tr("Analyze PUSH+RET as JMP") }, new QCheckBox(), false },
|
||||||
{ { "e! anal.hasnext", tr("Continue analysis after each function") }, new QCheckBox(), false }};
|
{ { "e! analysis.hasnext", tr("Continue analysis after each function") }, new QCheckBox(), false }};
|
||||||
|
|
||||||
// Per each checkbox, set a tooltip desccribing it
|
// Per each checkbox, set a tooltip desccribing it
|
||||||
AnalysisCommands item;
|
AnalysisCommands item;
|
||||||
|
@ -18,7 +18,7 @@ win32 {
|
|||||||
-lr_hash \
|
-lr_hash \
|
||||||
-lr_bin \
|
-lr_bin \
|
||||||
-lr_lang \
|
-lr_lang \
|
||||||
-lr_anal \
|
-lr_analysis \
|
||||||
-lr_parse \
|
-lr_parse \
|
||||||
-lr_bp \
|
-lr_bp \
|
||||||
-lr_egg \
|
-lr_egg \
|
||||||
@ -95,7 +95,7 @@ win32 {
|
|||||||
-lr_syscall \
|
-lr_syscall \
|
||||||
-lr_socket \
|
-lr_socket \
|
||||||
-lr_fs \
|
-lr_fs \
|
||||||
-lr_anal \
|
-lr_analysis \
|
||||||
-lr_magic \
|
-lr_magic \
|
||||||
-lr_util \
|
-lr_util \
|
||||||
-lr_crypto
|
-lr_crypto
|
||||||
|
@ -395,7 +395,7 @@ void DecompilerContextMenu::actionRenameThingHereTriggered()
|
|||||||
if (type == RZ_CODE_ANNOTATION_TYPE_FUNCTION_NAME) {
|
if (type == RZ_CODE_ANNOTATION_TYPE_FUNCTION_NAME) {
|
||||||
QString currentName(annotationHere->reference.name);
|
QString currentName(annotationHere->reference.name);
|
||||||
RVA func_addr = annotationHere->reference.offset;
|
RVA func_addr = annotationHere->reference.offset;
|
||||||
RzAnalFunction *func = Core()->functionAt(func_addr);
|
RzAnalysisFunction *func = Core()->functionAt(func_addr);
|
||||||
if (func == NULL) {
|
if (func == NULL) {
|
||||||
QString function_name = QInputDialog::getText(this,
|
QString function_name = QInputDialog::getText(this,
|
||||||
tr("Define this function at %2").arg(RAddressString(func_addr)),
|
tr("Define this function at %2").arg(RAddressString(func_addr)),
|
||||||
|
@ -372,7 +372,7 @@ void DisassemblyContextMenu::setCurHighlightedWord(const QString &text)
|
|||||||
DisassemblyContextMenu::ThingUsedHere DisassemblyContextMenu::getThingAt(ut64 address)
|
DisassemblyContextMenu::ThingUsedHere DisassemblyContextMenu::getThingAt(ut64 address)
|
||||||
{
|
{
|
||||||
ThingUsedHere tuh;
|
ThingUsedHere tuh;
|
||||||
RzAnalFunction *fcn = Core()->functionAt(address);
|
RzAnalysisFunction *fcn = Core()->functionAt(address);
|
||||||
RzFlagItem *flag = rz_flag_get_i(Core()->core()->flags, address);
|
RzFlagItem *flag = rz_flag_get_i(Core()->core()->flags, address);
|
||||||
|
|
||||||
// We will lookup through existing r2 types to find something relevant
|
// We will lookup through existing r2 types to find something relevant
|
||||||
@ -560,7 +560,7 @@ void DisassemblyContextMenu::aboutToShowSlot()
|
|||||||
setupRenaming();
|
setupRenaming();
|
||||||
|
|
||||||
// Only show retype for local vars if in a function
|
// Only show retype for local vars if in a function
|
||||||
RzAnalFunction *in_fcn = Core()->functionIn(offset);
|
RzAnalysisFunction *in_fcn = Core()->functionIn(offset);
|
||||||
if (in_fcn) {
|
if (in_fcn) {
|
||||||
auto vars = Core()->getVariables(offset);
|
auto vars = Core()->getVariables(offset);
|
||||||
actionSetFunctionVarTypes.setVisible(!vars.empty());
|
actionSetFunctionVarTypes.setVisible(!vars.empty());
|
||||||
@ -835,7 +835,7 @@ void DisassemblyContextMenu::on_actionRename_triggered()
|
|||||||
FlagDialog dialog(doRenameInfo.addr, this->mainWindow);
|
FlagDialog dialog(doRenameInfo.addr, this->mainWindow);
|
||||||
ok = dialog.exec();
|
ok = dialog.exec();
|
||||||
} else if (doRenameAction == RENAME_LOCAL) {
|
} else if (doRenameAction == RENAME_LOCAL) {
|
||||||
RzAnalFunction *fcn = Core()->functionIn(offset);
|
RzAnalysisFunction *fcn = Core()->functionIn(offset);
|
||||||
if (fcn) {
|
if (fcn) {
|
||||||
EditVariablesDialog dialog(fcn->addr, curHighlightedWord, this->mainWindow);
|
EditVariablesDialog dialog(fcn->addr, curHighlightedWord, this->mainWindow);
|
||||||
if (!dialog.empty()) {
|
if (!dialog.empty()) {
|
||||||
@ -858,7 +858,7 @@ void DisassemblyContextMenu::on_actionRename_triggered()
|
|||||||
|
|
||||||
void DisassemblyContextMenu::on_actionSetFunctionVarTypes_triggered()
|
void DisassemblyContextMenu::on_actionSetFunctionVarTypes_triggered()
|
||||||
{
|
{
|
||||||
RzAnalFunction *fcn = Core()->functionIn(offset);
|
RzAnalysisFunction *fcn = Core()->functionIn(offset);
|
||||||
|
|
||||||
if (!fcn) {
|
if (!fcn) {
|
||||||
QMessageBox::critical(this, tr("Re-type Local Variables"),
|
QMessageBox::critical(this, tr("Re-type Local Variables"),
|
||||||
@ -1004,7 +1004,7 @@ void DisassemblyContextMenu::on_actionEditFunction_triggered()
|
|||||||
{
|
{
|
||||||
RzCore *core = Core()->core();
|
RzCore *core = Core()->core();
|
||||||
EditFunctionDialog dialog(mainWindow);
|
EditFunctionDialog dialog(mainWindow);
|
||||||
RzAnalFunction *fcn = rz_anal_get_fcn_in(core->anal, offset, 0);
|
RzAnalysisFunction *fcn = rz_analysis_get_fcn_in(core->analysis, offset, 0);
|
||||||
|
|
||||||
if (fcn) {
|
if (fcn) {
|
||||||
dialog.setWindowTitle(tr("Edit function %1").arg(fcn->name));
|
dialog.setWindowTitle(tr("Edit function %1").arg(fcn->name));
|
||||||
|
@ -615,20 +615,20 @@ void ClassesWidget::refreshClasses()
|
|||||||
case Source::BIN:
|
case Source::BIN:
|
||||||
if (!bin_model) {
|
if (!bin_model) {
|
||||||
proxy_model->setSourceModel(nullptr);
|
proxy_model->setSourceModel(nullptr);
|
||||||
delete anal_model;
|
delete analysis_model;
|
||||||
anal_model = nullptr;
|
analysis_model = nullptr;
|
||||||
bin_model = new BinClassesModel(this);
|
bin_model = new BinClassesModel(this);
|
||||||
proxy_model->setSourceModel(bin_model);
|
proxy_model->setSourceModel(bin_model);
|
||||||
}
|
}
|
||||||
bin_model->setClasses(Core()->getAllClassesFromBin());
|
bin_model->setClasses(Core()->getAllClassesFromBin());
|
||||||
break;
|
break;
|
||||||
case Source::ANAL:
|
case Source::ANAL:
|
||||||
if (!anal_model) {
|
if (!analysis_model) {
|
||||||
proxy_model->setSourceModel(nullptr);
|
proxy_model->setSourceModel(nullptr);
|
||||||
delete bin_model;
|
delete bin_model;
|
||||||
bin_model = nullptr;
|
bin_model = nullptr;
|
||||||
anal_model = new AnalClassesModel(this);
|
analysis_model = new AnalClassesModel(this);
|
||||||
proxy_model->setSourceModel(anal_model);
|
proxy_model->setSourceModel(analysis_model);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -653,7 +653,7 @@ void ClassesWidget::on_classesTreeView_doubleClicked(const QModelIndex &index)
|
|||||||
|
|
||||||
void ClassesWidget::showContextMenu(const QPoint &pt)
|
void ClassesWidget::showContextMenu(const QPoint &pt)
|
||||||
{
|
{
|
||||||
if(!anal_model) {
|
if(!analysis_model) {
|
||||||
// no context menu for bin classes
|
// no context menu for bin classes
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -98,7 +98,7 @@ private:
|
|||||||
/**
|
/**
|
||||||
* @brief List entry below a class
|
* @brief List entry below a class
|
||||||
*
|
*
|
||||||
* This roughly corresponds to attributes of r2 anal classes, which means it is not an attribute in the sense of
|
* This roughly corresponds to attributes of r2 analysis classes, which means it is not an attribute in the sense of
|
||||||
* a class member variable, but any kind of sub-info associated with the class.
|
* a class member variable, but any kind of sub-info associated with the class.
|
||||||
* This struct in particular is used to provide a model for the list entries below a class.
|
* This struct in particular is used to provide a model for the list entries below a class.
|
||||||
*/
|
*/
|
||||||
@ -200,7 +200,7 @@ private:
|
|||||||
std::unique_ptr<Ui::ClassesWidget> ui;
|
std::unique_ptr<Ui::ClassesWidget> ui;
|
||||||
|
|
||||||
BinClassesModel *bin_model = nullptr;
|
BinClassesModel *bin_model = nullptr;
|
||||||
AnalClassesModel *anal_model = nullptr;
|
AnalClassesModel *analysis_model = nullptr;
|
||||||
ClassesSortFilterProxyModel *proxy_model;
|
ClassesSortFilterProxyModel *proxy_model;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -444,7 +444,7 @@ void DecompilerWidget::updateSelection()
|
|||||||
|
|
||||||
QString DecompilerWidget::getWindowTitle() const
|
QString DecompilerWidget::getWindowTitle() const
|
||||||
{
|
{
|
||||||
RzAnalFunction *fcn = Core()->functionAt(decompiledFunctionAddr);
|
RzAnalysisFunction *fcn = Core()->functionAt(decompiledFunctionAddr);
|
||||||
QString windowTitle = tr("Decompiler");
|
QString windowTitle = tr("Decompiler");
|
||||||
if (fcn != NULL) {
|
if (fcn != NULL) {
|
||||||
windowTitle += " (" + QString(fcn->name) + ")";
|
windowTitle += " (" + QString(fcn->name) + ")";
|
||||||
|
@ -177,7 +177,7 @@ void DisassemblerGraphView::loadCurrentGraph()
|
|||||||
.set("asm.lines.fcn", false);
|
.set("asm.lines.fcn", false);
|
||||||
|
|
||||||
QJsonArray functions;
|
QJsonArray functions;
|
||||||
RzAnalFunction *fcn = Core()->functionIn(seekable->getOffset());
|
RzAnalysisFunction *fcn = Core()->functionIn(seekable->getOffset());
|
||||||
if (fcn) {
|
if (fcn) {
|
||||||
currentFcnAddr = fcn->addr;
|
currentFcnAddr = fcn->addr;
|
||||||
QJsonDocument functionsDoc = Core()->cmdj("agJ " + RAddressString(fcn->addr));
|
QJsonDocument functionsDoc = Core()->cmdj("agJ " + RAddressString(fcn->addr));
|
||||||
|
Loading…
Reference in New Issue
Block a user