mirror of
https://github.com/rizinorg/cutter.git
synced 2024-12-18 19:06:10 +00:00
Show sizes of structs and unions (#1203)
Show sizes of structs and unions and update radare2 submodule for r_core_save_parsed_type()
This commit is contained in:
parent
cd96856959
commit
a8fbe72bf7
2
radare2
2
radare2
@ -1 +1 @@
|
|||||||
Subproject commit b84e57ec4c509afeaf856471d70e9dd9d9fd0013
|
Subproject commit b1bf3fea9edf231ba99c27b147ec83664ac06638
|
@ -2204,10 +2204,13 @@ QList<TypeDescription> CutterCore::getAllUnions()
|
|||||||
QList<TypeDescription> ret;
|
QList<TypeDescription> ret;
|
||||||
|
|
||||||
QJsonArray typesArray = cmdj("tuj").array();
|
QJsonArray typesArray = cmdj("tuj").array();
|
||||||
for (auto value: typesArray) {
|
for (const QJsonValue value: typesArray) {
|
||||||
|
QJsonObject typeObject = value.toObject();
|
||||||
|
|
||||||
TypeDescription exp;
|
TypeDescription exp;
|
||||||
exp.type = value.toString();
|
|
||||||
exp.size = 0;
|
exp.type = typeObject[RJsonKey::type].toString();
|
||||||
|
exp.size = typeObject[RJsonKey::size].toVariant().toULongLong();
|
||||||
exp.category = "Union";
|
exp.category = "Union";
|
||||||
ret << exp;
|
ret << exp;
|
||||||
}
|
}
|
||||||
@ -2221,10 +2224,13 @@ QList<TypeDescription> CutterCore::getAllStructs()
|
|||||||
QList<TypeDescription> ret;
|
QList<TypeDescription> ret;
|
||||||
|
|
||||||
QJsonArray typesArray = cmdj("tsj").array();
|
QJsonArray typesArray = cmdj("tsj").array();
|
||||||
for (auto value: typesArray) {
|
for (const QJsonValue value: typesArray) {
|
||||||
|
QJsonObject typeObject = value.toObject();
|
||||||
|
|
||||||
TypeDescription exp;
|
TypeDescription exp;
|
||||||
exp.type = value.toString();
|
|
||||||
exp.size = 0;
|
exp.type = typeObject[RJsonKey::type].toString();
|
||||||
|
exp.size = typeObject[RJsonKey::size].toVariant().toULongLong();
|
||||||
exp.category = "Struct";
|
exp.category = "Struct";
|
||||||
ret << exp;
|
ret << exp;
|
||||||
}
|
}
|
||||||
@ -2280,7 +2286,7 @@ QString CutterCore::addTypes(const char *str)
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
sdb_query_lines(core_->anal->sdb_types, parsed);
|
r_core_save_parsed_type(core_, parsed);
|
||||||
r_mem_free(parsed);
|
r_mem_free(parsed);
|
||||||
|
|
||||||
if (error_msg) {
|
if (error_msg) {
|
||||||
@ -2631,4 +2637,4 @@ QString CutterCore::ansiEscapeToHtml(const QString &text)
|
|||||||
QString r = QString::fromUtf8(html, len);
|
QString r = QString::fromUtf8(html, len);
|
||||||
free(html);
|
free(html);
|
||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
|
@ -37,7 +37,7 @@ QVariant TypesModel::data(const QModelIndex &index, int role) const
|
|||||||
case TYPE:
|
case TYPE:
|
||||||
return exp.type;
|
return exp.type;
|
||||||
case SIZE:
|
case SIZE:
|
||||||
return exp.category == tr("Primitive") ? exp.size : QVariant();
|
return exp.size ? exp.size : QVariant();
|
||||||
case FORMAT:
|
case FORMAT:
|
||||||
return exp.format;
|
return exp.format;
|
||||||
case CATEGORY:
|
case CATEGORY:
|
||||||
|
Loading…
Reference in New Issue
Block a user