mirror of
https://github.com/rizinorg/cutter.git
synced 2025-01-31 16:47:26 +00:00
* Add more information in Function Panel #382 * Fix sort * Fix calltype * Fix build dir
This commit is contained in:
parent
b2c52a9aee
commit
997b68ac38
@ -923,6 +923,11 @@ QList<FunctionDescription> CutterCore::getAllFunctions()
|
|||||||
|
|
||||||
function.offset = (RVA)jsonObject["offset"].toVariant().toULongLong();
|
function.offset = (RVA)jsonObject["offset"].toVariant().toULongLong();
|
||||||
function.size = (RVA)jsonObject["size"].toVariant().toULongLong();
|
function.size = (RVA)jsonObject["size"].toVariant().toULongLong();
|
||||||
|
function.nargs = (RVA)jsonObject["nargs"].toVariant().toULongLong();
|
||||||
|
function.nbbs = (RVA)jsonObject["nbbs"].toVariant().toULongLong();
|
||||||
|
function.nlocals = (RVA)jsonObject["nlocals"].toVariant().toULongLong();
|
||||||
|
function.cc = (RVA)jsonObject["cc"].toVariant().toULongLong();
|
||||||
|
function.calltype = jsonObject["calltype"].toString();
|
||||||
function.name = jsonObject["name"].toString();
|
function.name = jsonObject["name"].toString();
|
||||||
|
|
||||||
ret << function;
|
ret << function;
|
||||||
|
@ -61,6 +61,11 @@ inline QString RSizeString(RVA size)
|
|||||||
struct FunctionDescription {
|
struct FunctionDescription {
|
||||||
RVA offset;
|
RVA offset;
|
||||||
RVA size;
|
RVA size;
|
||||||
|
RVA nargs;
|
||||||
|
RVA nbbs;
|
||||||
|
RVA nlocals;
|
||||||
|
RVA cc;
|
||||||
|
QString calltype;
|
||||||
QString name;
|
QString name;
|
||||||
|
|
||||||
bool contains(RVA addr) const
|
bool contains(RVA addr) const
|
||||||
|
@ -59,7 +59,7 @@ int FunctionModel::rowCount(const QModelIndex &parent) const
|
|||||||
|
|
||||||
if (nested) {
|
if (nested) {
|
||||||
if (parent.internalId() == 0)
|
if (parent.internalId() == 0)
|
||||||
return 3; // sub-nodes for nested functions
|
return 8; // sub-nodes for nested functions
|
||||||
return 0;
|
return 0;
|
||||||
} else
|
} else
|
||||||
return 0;
|
return 0;
|
||||||
@ -114,6 +114,16 @@ QVariant FunctionModel::data(const QModelIndex &index, int role) const
|
|||||||
return tr("Size: %1").arg(RSizeString(function.size));
|
return tr("Size: %1").arg(RSizeString(function.size));
|
||||||
case 2:
|
case 2:
|
||||||
return tr("Import: %1").arg(functionIsImport(function.offset) ? tr("true") : tr("false"));
|
return tr("Import: %1").arg(functionIsImport(function.offset) ? tr("true") : tr("false"));
|
||||||
|
case 3:
|
||||||
|
return tr("Nargs: %1").arg(RSizeString(function.nargs));
|
||||||
|
case 4:
|
||||||
|
return tr("Nbbs: %1").arg(RSizeString(function.nbbs));
|
||||||
|
case 5:
|
||||||
|
return tr("Nlocals: %1").arg(RSizeString(function.nlocals));
|
||||||
|
case 6:
|
||||||
|
return tr("Cyclomatic complexity: %1").arg(RSizeString(function.cc));
|
||||||
|
case 7:
|
||||||
|
return tr("Call type: %1").arg(function.calltype);
|
||||||
default:
|
default:
|
||||||
return QVariant();
|
return QVariant();
|
||||||
}
|
}
|
||||||
@ -127,6 +137,16 @@ QVariant FunctionModel::data(const QModelIndex &index, int role) const
|
|||||||
return function.size;
|
return function.size;
|
||||||
case OffsetColumn:
|
case OffsetColumn:
|
||||||
return RAddressString(function.offset);
|
return RAddressString(function.offset);
|
||||||
|
case NargsColumn:
|
||||||
|
return function.nargs;
|
||||||
|
case NbbsColumn:
|
||||||
|
return function.nbbs;
|
||||||
|
case NlocalsColumn:
|
||||||
|
return function.nlocals;
|
||||||
|
case CcColumn:
|
||||||
|
return function.cc;
|
||||||
|
case CalltypeColumn:
|
||||||
|
return function.calltype;
|
||||||
default:
|
default:
|
||||||
return QVariant();
|
return QVariant();
|
||||||
}
|
}
|
||||||
@ -196,6 +216,16 @@ QVariant FunctionModel::headerData(int section, Qt::Orientation orientation, int
|
|||||||
return tr("Imp.");
|
return tr("Imp.");
|
||||||
case OffsetColumn:
|
case OffsetColumn:
|
||||||
return tr("Offset");
|
return tr("Offset");
|
||||||
|
case NargsColumn:
|
||||||
|
return tr("Nargs");
|
||||||
|
case NbbsColumn:
|
||||||
|
return tr("Nbbs");
|
||||||
|
case NlocalsColumn:
|
||||||
|
return tr("Nlocals");
|
||||||
|
case CcColumn:
|
||||||
|
return tr("Cyclo. Comp.");
|
||||||
|
case CalltypeColumn:
|
||||||
|
return tr("Call type");
|
||||||
default:
|
default:
|
||||||
return QVariant();
|
return QVariant();
|
||||||
}
|
}
|
||||||
@ -316,6 +346,25 @@ bool FunctionSortFilterProxyModel::lessThan(const QModelIndex &left, const QMode
|
|||||||
}
|
}
|
||||||
case FunctionModel::NameColumn:
|
case FunctionModel::NameColumn:
|
||||||
return left_function.name < right_function.name;
|
return left_function.name < right_function.name;
|
||||||
|
case FunctionModel::NargsColumn:
|
||||||
|
if (left_function.nargs != right_function.nargs)
|
||||||
|
return left_function.nargs < right_function.nargs;
|
||||||
|
break;
|
||||||
|
case FunctionModel::NbbsColumn:
|
||||||
|
if (left_function.nbbs != right_function.nbbs)
|
||||||
|
return left_function.nbbs < right_function.nbbs;
|
||||||
|
break;
|
||||||
|
case FunctionModel::NlocalsColumn:
|
||||||
|
if (left_function.nlocals != right_function.nlocals)
|
||||||
|
return left_function.nlocals < right_function.nlocals;
|
||||||
|
break;
|
||||||
|
case FunctionModel::CcColumn:
|
||||||
|
if (left_function.cc != right_function.cc)
|
||||||
|
return left_function.cc < right_function.cc;
|
||||||
|
break;
|
||||||
|
case FunctionModel::CalltypeColumn:
|
||||||
|
return left_function.calltype < right_function.calltype;
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -41,7 +41,8 @@ public:
|
|||||||
static const int FunctionDescriptionRole = Qt::UserRole;
|
static const int FunctionDescriptionRole = Qt::UserRole;
|
||||||
static const int IsImportRole = Qt::UserRole + 1;
|
static const int IsImportRole = Qt::UserRole + 1;
|
||||||
|
|
||||||
enum Column { NameColumn = 0, SizeColumn, ImportColumn, OffsetColumn, ColumnCount };
|
enum Column { NameColumn = 0, SizeColumn, ImportColumn, OffsetColumn, NargsColumn, NbbsColumn,
|
||||||
|
NlocalsColumn, CcColumn, CalltypeColumn, ColumnCount };
|
||||||
|
|
||||||
FunctionModel(QList<FunctionDescription> *functions, QSet<RVA> *importAddresses, ut64 *mainAdress,
|
FunctionModel(QList<FunctionDescription> *functions, QSet<RVA> *importAddresses, ut64 *mainAdress,
|
||||||
bool nested, QFont defaultFont, QFont highlightFont, QObject *parent = 0);
|
bool nested, QFont defaultFont, QFont highlightFont, QObject *parent = 0);
|
||||||
|
Loading…
Reference in New Issue
Block a user