Update ghidra-native to 0.7.3

* Implement the new Scope::findSymbolBefore/After by asking the cache
* Look up join records through AddrSpace::findJoin
* Iterate main ops now that INDIRECTs live in their own container
* Follow the new size argument of pushUnnamedLocation
* Refresh test expectations for the new decompiler and sleigh output
This commit is contained in:
pancake authored and pancake committed 2026-11-06 00:44:50 +01:00
1 parent 5f5e607bb9
commit ab2d3b9b48
13 files changed
+112 -104

No files matched your search

+1 -1
View File
@@ -87,7 +87,7 @@ add_global_arguments('-DNDEBUG', language: ['c', 'cpp'])
r2ghidra_incdirs = include_directories(incdirs)
ghidra = subproject('ghidra-native', version: '>=0.7.2', default_options: ['default_library=static', 'werror=false', 'warning_level=0'])
ghidra = subproject('ghidra-native', version: '>=0.7.3', default_options: ['default_library=static', 'werror=false', 'warning_level=0'])
r2ghidra_deps = [r_core, ghidra.get_variable('ghidra_dep').as_system()]
r2ghidra_cpp_args = []
+1 -1
View File
@@ -26,7 +26,7 @@ struct ParseCodeXMLContext {
std::map<ut64, Symbol *> symbols;
explicit ParseCodeXMLContext(ghidra::Funcdata *func) : func (func) {
for (auto it=func->beginOpAll (); it != func->endOpAll (); it++) {
for (auto it=func->beginOpMain (); it != func->endOpMain (); it++) {
ops[it->first.getTime ()] = it->second;
}
for (auto it = func->beginLoc (); it != func->endLoc (); it++) {
+2 -2
View File
@@ -69,7 +69,7 @@ fprintf (stderr, "opCast%c", 10);
}
#endif
void R2PrintC::pushUnnamedLocation(const Address &addr, const Varnode *vn, const PcodeOp *op) {
void R2PrintC::pushUnnamedLocation(const Address &addr, int4 size, const Varnode *vn, const PcodeOp *op) {
// option_nocasts = true;
// print (*(type *)0x0000...) instead of ram00000...
AddrSpace *space = addr.getSpace ();
@@ -78,7 +78,7 @@ void R2PrintC::pushUnnamedLocation(const Address &addr, const Varnode *vn, const
auto type = glb->types->getTypePointer (space->getAddrSize (), vn->getType (), space->getWordSize ());
pushConstant (addr.getOffset (), type, vartoken, vn, op, type->getDisplayFormat ());
} else {
PrintC::pushUnnamedLocation (addr,vn, op);
PrintC::pushUnnamedLocation (addr, size, vn, op);
}
}
+1 -1
View File
@@ -10,7 +10,7 @@ using namespace ghidra;
class R2PrintC : public PrintC {
protected:
void pushUnnamedLocation(const Address &addr, const Varnode *vn,const PcodeOp *op) override;
void pushUnnamedLocation(const Address &addr, int4 size, const Varnode *vn, const PcodeOp *op) override;
// void opCast(const PcodeOp *op) override;
public:
+1 -1
View File
@@ -108,7 +108,7 @@ static Element *childAddr(Element *el, const std::string &name, const Address &a
}
// Join addresses must be marshaled with their physical pieces.
JoinRecord *record = space->getManager ()->findJoin (addr.getOffset ());
JoinRecord *record = space->findJoin (addr.getOffset ());
const int4 numPieces = record->numPieces ();
constexpr int4 maxMarshaledJoinPieces = 64; // JoinSpace::MAX_PIECES is private.
if (numPieces > maxMarshaledJoinPieces) {
+2
View File
@@ -67,6 +67,8 @@ public:
Funcdata *resolveExternalRefFunction(ExternRefSymbol *sym) const override;
MapEntry *findOverlap(const Address &addr,int4 size) const override { throw LowlevelError("findOverlap unimplemented"); }
MapEntry *findSymbolBefore(const Address &addr,const Address &usepoint) const override { return cache->findSymbolBefore(addr,usepoint); }
MapEntry *findSymbolAfter(const Address &addr,const Address &usepoint) const override { return cache->findSymbolAfter(addr,usepoint); }
SymbolEntry *findBefore(const Address &addr) const { throw LowlevelError("findBefore unimplemented"); }
SymbolEntry *findAfter(const Address &addr) const { throw LowlevelError("findAfter unimplemented"); }
void findByName(const string &name,vector<Symbol *> &res) const override { throw LowlevelError("findByName unimplemented"); }
+3 -5
View File
@@ -229,11 +229,9 @@ struct PcodeSnapshot {
void capture(const Funcdata &func) {
operations.clear ();
for (auto it = func.beginOpAll (); it != func.endOpAll (); ++it) {
const PcodeOp *op = it->second;
if (!op->isDead ()) {
operations.emplace (it->first, Operation { op, op->code () });
}
for (auto it = func.beginOpAlive (); it != func.endOpAlive (); ++it) {
const PcodeOp *op = *it;
operations.emplace (op->getSeqNum (), Operation { op, op->code () });
}
}
+1 -1
View File
@@ -1,5 +1,5 @@
[wrap-git]
url = https://github.com/radareorg/ghidra-native
revision = 0.7.2
revision = 0.7.3
directory = ghidra-native
depth = 1
+24 -20
View File
@@ -44,7 +44,7 @@ CCu base64:Jg== @ 0x804858a
<localdb main="stack" lock="false">
<rangelist>
<range space="stack" first="0x4" last="0x1f7"/>
<range space="stack" first="0xfff0bdc0" last="0xffffff5f"/>
<range space="stack" first="0x80000000" last="0xffffff5f"/>
<range space="stack" first="0xffffff68" last="0xfffffffb"/>
</rangelist>
<symbollist>
@@ -699,25 +699,29 @@ shr eax, 4
(unique,0x49a00,1) = INT_AND (unique,0x49900,1), 0x1
PF = INT_EQUAL (unique,0x49a00,1), 0x0
0x08048557: SHR EAX,0x4
(unique,0xac000,4) = INT_AND 0x4, 0x1f
(unique,0xac100,4) = COPY EAX
EAX = INT_RIGHT EAX, (unique,0xac000,4)
(unique,0x50200,1) = INT_NOTEQUAL (unique,0xac000,4), 0x0
(unique,0x50300,4) = INT_SUB (unique,0xac000,4), 0x1
(unique,0x50400,4) = INT_RIGHT (unique,0xac100,4), (unique,0x50300,4)
(unique,0x50500,4) = INT_AND (unique,0x50400,4), 0x1
(unique,0x50700,1) = INT_NOTEQUAL (unique,0x50500,4), 0x0
(unique,0x50800,1) = BOOL_NEGATE (unique,0x50200,1)
(unique,0x50900,1) = INT_AND (unique,0x50800,1), CF
(unique,0x50a00,1) = INT_AND (unique,0x50200,1), (unique,0x50700,1)
CF = INT_OR (unique,0x50900,1), (unique,0x50a00,1)
(unique,0x50d00,1) = INT_EQUAL (unique,0xac000,4), 0x1
(unique,0x50f00,1) = INT_SLESS (unique,0xac100,4), 0x0
(unique,0x51000,1) = BOOL_NEGATE (unique,0x50d00,1)
(unique,0x51100,1) = INT_AND (unique,0x51000,1), OF
(unique,0x51200,1) = INT_AND (unique,0x50d00,1), (unique,0x50f00,1)
OF = INT_OR (unique,0x51100,1), (unique,0x51200,1)
(unique,0x49d00,1) = INT_NOTEQUAL (unique,0xac000,4), 0x0
(unique,0xa1f00,4) = INT_AND 0x4, 0x1f
(unique,0xa2000,4) = COPY EAX
EAX = INT_RIGHT EAX, (unique,0xa1f00,4)
(unique,0x4d300,1) = INT_EQUAL (unique,0xa1f00,4), 0x0
(unique,0x4d400,4) = INT_SUB (unique,0xa1f00,4), 0x1
(unique,0x4d500,4) = INT_RIGHT (unique,0xa2000,4), (unique,0x4d400,4)
(unique,0x4d600,4) = INT_AND (unique,0x4d500,4), 0x1
(unique,0x4d700,1) = INT_NOTEQUAL (unique,0x4d600,4), 0x0
(unique,0x0,1) = COPY (unique,0x4d300,1)
(unique,0x100,1) = INT_MULT (unique,0x0,1), CF
(unique,0x200,1) = BOOL_NEGATE (unique,0x4d300,1)
(unique,0x300,1) = COPY (unique,0x200,1)
(unique,0x400,1) = INT_MULT (unique,0x300,1), (unique,0x4d700,1)
CF = INT_OR (unique,0x100,1), (unique,0x400,1)
(unique,0x4d800,1) = INT_EQUAL (unique,0xa1f00,4), 0x1
(unique,0x4d900,1) = INT_SLESS (unique,0xa2000,4), 0x0
(unique,0x0,1) = COPY (unique,0x4d800,1)
(unique,0x100,1) = INT_MULT (unique,0x0,1), 0x0
(unique,0x200,1) = BOOL_NEGATE (unique,0x4d800,1)
(unique,0x300,1) = COPY (unique,0x200,1)
(unique,0x400,1) = INT_MULT (unique,0x300,1), (unique,0x4d900,1)
OF = INT_OR (unique,0x100,1), (unique,0x400,1)
(unique,0x49d00,1) = INT_NOTEQUAL (unique,0xa1f00,4), 0x0
(unique,0x49f00,1) = INT_SLESS EAX, 0x0
(unique,0x4a000,1) = BOOL_NEGATE (unique,0x49d00,1)
(unique,0x4a100,1) = INT_AND (unique,0x4a000,1), SF
+25 -25
View File
@@ -1262,7 +1262,7 @@ EXPECT=<<EOF
{
"space": "ram",
"offset": 134517295,
"uniq": 519,
"uniq": 522,
"opcode": 1,
"is_dead": false
},
@@ -1276,7 +1276,7 @@ EXPECT=<<EOF
{
"space": "ram",
"offset": 134517307,
"uniq": 526,
"uniq": 529,
"opcode": 64,
"is_dead": false
},
@@ -1297,161 +1297,161 @@ EXPECT=<<EOF
{
"space": "ram",
"offset": 134517334,
"uniq": 156,
"uniq": 160,
"opcode": 11,
"is_dead": false
},
{
"space": "ram",
"offset": 134517341,
"uniq": 161,
"uniq": 165,
"opcode": 5,
"is_dead": false
},
{
"space": "ram",
"offset": 134517443,
"uniq": 525,
"uniq": 528,
"opcode": 1,
"is_dead": false
},
{
"space": "ram",
"offset": 134517443,
"uniq": 177,
"uniq": 181,
"opcode": 7,
"is_dead": false
},
{
"space": "ram",
"offset": 134517451,
"uniq": 187,
"uniq": 191,
"opcode": 4,
"is_dead": false
},
{
"space": "ram",
"offset": 134517332,
"uniq": 118,
"uniq": 122,
"opcode": 6,
"is_dead": false
},
{
"space": "ram",
"offset": 134517425,
"uniq": 524,
"uniq": 527,
"opcode": 1,
"is_dead": false
},
{
"space": "ram",
"offset": 134517425,
"uniq": 202,
"uniq": 206,
"opcode": 7,
"is_dead": false
},
{
"space": "ram",
"offset": 134517433,
"uniq": 212,
"uniq": 216,
"opcode": 4,
"is_dead": false
},
{
"space": "ram",
"offset": 134517407,
"uniq": 523,
"uniq": 526,
"opcode": 1,
"is_dead": false
},
{
"space": "ram",
"offset": 134517407,
"uniq": 227,
"uniq": 231,
"opcode": 7,
"is_dead": false
},
{
"space": "ram",
"offset": 134517415,
"uniq": 237,
"uniq": 241,
"opcode": 4,
"is_dead": false
},
{
"space": "ram",
"offset": 134517389,
"uniq": 522,
"uniq": 525,
"opcode": 1,
"is_dead": false
},
{
"space": "ram",
"offset": 134517389,
"uniq": 252,
"uniq": 256,
"opcode": 7,
"is_dead": false
},
{
"space": "ram",
"offset": 134517397,
"uniq": 262,
"uniq": 266,
"opcode": 4,
"is_dead": false
},
{
"space": "ram",
"offset": 134517371,
"uniq": 521,
"uniq": 524,
"opcode": 1,
"is_dead": false
},
{
"space": "ram",
"offset": 134517371,
"uniq": 277,
"uniq": 281,
"opcode": 7,
"is_dead": false
},
{
"space": "ram",
"offset": 134517379,
"uniq": 287,
"uniq": 291,
"opcode": 4,
"is_dead": false
},
{
"space": "ram",
"offset": 134517353,
"uniq": 520,
"uniq": 523,
"opcode": 1,
"is_dead": false
},
{
"space": "ram",
"offset": 134517353,
"uniq": 302,
"uniq": 306,
"opcode": 7,
"is_dead": false
},
{
"space": "ram",
"offset": 134517361,
"uniq": 312,
"uniq": 316,
"opcode": 4,
"is_dead": false
},
{
"space": "ram",
"offset": 134517459,
"uniq": 133,
"uniq": 137,
"opcode": 7,
"is_dead": false
},
{
"space": "ram",
"offset": 134517469,
"uniq": 148,
"uniq": 152,
"opcode": 10,
"is_dead": false
}
+1 -1
View File
@@ -36,7 +36,7 @@ e r2ghidra.ccode=true
pdg~__libc_init
EOF
EXPECT=<<EOF
__libc_init(param_1,0,*(iRam00000424 + 0x418),&stack0xffffffec);
__libc_init(param_1,0,*(iRam00000424 + 0x418),&uStack_14);
EOF
RUN
+25 -21
View File
@@ -44,7 +44,7 @@ CCu base64:Jg== @ 0x804858a
<localdb main="stack" lock="false">
<rangelist>
<range space="stack" first="0x4" last="0x1f7"/>
<range space="stack" first="0xfff0bdc0" last="0xffffff5f"/>
<range space="stack" first="0x80000000" last="0xffffff5f"/>
<range space="stack" first="0xffffff68" last="0xfffffffb"/>
</rangelist>
<symbollist>
@@ -697,25 +697,29 @@ shr eax, 4
(unique,0x49a00,1) = INT_AND (unique,0x49900,1), 0x1
PF = INT_EQUAL (unique,0x49a00,1), 0x0
0x08048557: SHR EAX,0x4
(unique,0xac000,4) = INT_AND 0x4, 0x1f
(unique,0xac100,4) = COPY EAX
EAX = INT_RIGHT EAX, (unique,0xac000,4)
(unique,0x50200,1) = INT_NOTEQUAL (unique,0xac000,4), 0x0
(unique,0x50300,4) = INT_SUB (unique,0xac000,4), 0x1
(unique,0x50400,4) = INT_RIGHT (unique,0xac100,4), (unique,0x50300,4)
(unique,0x50500,4) = INT_AND (unique,0x50400,4), 0x1
(unique,0x50700,1) = INT_NOTEQUAL (unique,0x50500,4), 0x0
(unique,0x50800,1) = BOOL_NEGATE (unique,0x50200,1)
(unique,0x50900,1) = INT_AND (unique,0x50800,1), CF
(unique,0x50a00,1) = INT_AND (unique,0x50200,1), (unique,0x50700,1)
CF = INT_OR (unique,0x50900,1), (unique,0x50a00,1)
(unique,0x50d00,1) = INT_EQUAL (unique,0xac000,4), 0x1
(unique,0x50f00,1) = INT_SLESS (unique,0xac100,4), 0x0
(unique,0x51000,1) = BOOL_NEGATE (unique,0x50d00,1)
(unique,0x51100,1) = INT_AND (unique,0x51000,1), OF
(unique,0x51200,1) = INT_AND (unique,0x50d00,1), (unique,0x50f00,1)
OF = INT_OR (unique,0x51100,1), (unique,0x51200,1)
(unique,0x49d00,1) = INT_NOTEQUAL (unique,0xac000,4), 0x0
(unique,0xa1f00,4) = INT_AND 0x4, 0x1f
(unique,0xa2000,4) = COPY EAX
EAX = INT_RIGHT EAX, (unique,0xa1f00,4)
(unique,0x4d300,1) = INT_EQUAL (unique,0xa1f00,4), 0x0
(unique,0x4d400,4) = INT_SUB (unique,0xa1f00,4), 0x1
(unique,0x4d500,4) = INT_RIGHT (unique,0xa2000,4), (unique,0x4d400,4)
(unique,0x4d600,4) = INT_AND (unique,0x4d500,4), 0x1
(unique,0x4d700,1) = INT_NOTEQUAL (unique,0x4d600,4), 0x0
(unique,0x0,1) = COPY (unique,0x4d300,1)
(unique,0x100,1) = INT_MULT (unique,0x0,1), CF
(unique,0x200,1) = BOOL_NEGATE (unique,0x4d300,1)
(unique,0x300,1) = COPY (unique,0x200,1)
(unique,0x400,1) = INT_MULT (unique,0x300,1), (unique,0x4d700,1)
CF = INT_OR (unique,0x100,1), (unique,0x400,1)
(unique,0x4d800,1) = INT_EQUAL (unique,0xa1f00,4), 0x1
(unique,0x4d900,1) = INT_SLESS (unique,0xa2000,4), 0x0
(unique,0x0,1) = COPY (unique,0x4d800,1)
(unique,0x100,1) = INT_MULT (unique,0x0,1), 0x0
(unique,0x200,1) = BOOL_NEGATE (unique,0x4d800,1)
(unique,0x300,1) = COPY (unique,0x200,1)
(unique,0x400,1) = INT_MULT (unique,0x300,1), (unique,0x4d900,1)
OF = INT_OR (unique,0x100,1), (unique,0x400,1)
(unique,0x49d00,1) = INT_NOTEQUAL (unique,0xa1f00,4), 0x0
(unique,0x49f00,1) = INT_SLESS EAX, 0x0
(unique,0x4a000,1) = BOOL_NEGATE (unique,0x49d00,1)
(unique,0x4a100,1) = INT_AND (unique,0x4a000,1), SF
@@ -1053,6 +1057,6 @@ s main
pdg~gmon_start
EOF2
EXPECT=<<EOF2
(*_reloc.__gmon_start__)();
(*_reloc.__gmon_start__)();
EOF2
RUN
+25 -25
View File
@@ -1262,7 +1262,7 @@ EXPECT=<<EOF
{
"space": "ram",
"offset": 134517295,
"uniq": 519,
"uniq": 522,
"opcode": 1,
"is_dead": false
},
@@ -1276,7 +1276,7 @@ EXPECT=<<EOF
{
"space": "ram",
"offset": 134517307,
"uniq": 526,
"uniq": 529,
"opcode": 64,
"is_dead": false
},
@@ -1297,161 +1297,161 @@ EXPECT=<<EOF
{
"space": "ram",
"offset": 134517334,
"uniq": 156,
"uniq": 160,
"opcode": 11,
"is_dead": false
},
{
"space": "ram",
"offset": 134517341,
"uniq": 161,
"uniq": 165,
"opcode": 5,
"is_dead": false
},
{
"space": "ram",
"offset": 134517443,
"uniq": 525,
"uniq": 528,
"opcode": 1,
"is_dead": false
},
{
"space": "ram",
"offset": 134517443,
"uniq": 177,
"uniq": 181,
"opcode": 7,
"is_dead": false
},
{
"space": "ram",
"offset": 134517451,
"uniq": 187,
"uniq": 191,
"opcode": 4,
"is_dead": false
},
{
"space": "ram",
"offset": 134517332,
"uniq": 118,
"uniq": 122,
"opcode": 6,
"is_dead": false
},
{
"space": "ram",
"offset": 134517425,
"uniq": 524,
"uniq": 527,
"opcode": 1,
"is_dead": false
},
{
"space": "ram",
"offset": 134517425,
"uniq": 202,
"uniq": 206,
"opcode": 7,
"is_dead": false
},
{
"space": "ram",
"offset": 134517433,
"uniq": 212,
"uniq": 216,
"opcode": 4,
"is_dead": false
},
{
"space": "ram",
"offset": 134517407,
"uniq": 523,
"uniq": 526,
"opcode": 1,
"is_dead": false
},
{
"space": "ram",
"offset": 134517407,
"uniq": 227,
"uniq": 231,
"opcode": 7,
"is_dead": false
},
{
"space": "ram",
"offset": 134517415,
"uniq": 237,
"uniq": 241,
"opcode": 4,
"is_dead": false
},
{
"space": "ram",
"offset": 134517389,
"uniq": 522,
"uniq": 525,
"opcode": 1,
"is_dead": false
},
{
"space": "ram",
"offset": 134517389,
"uniq": 252,
"uniq": 256,
"opcode": 7,
"is_dead": false
},
{
"space": "ram",
"offset": 134517397,
"uniq": 262,
"uniq": 266,
"opcode": 4,
"is_dead": false
},
{
"space": "ram",
"offset": 134517371,
"uniq": 521,
"uniq": 524,
"opcode": 1,
"is_dead": false
},
{
"space": "ram",
"offset": 134517371,
"uniq": 277,
"uniq": 281,
"opcode": 7,
"is_dead": false
},
{
"space": "ram",
"offset": 134517379,
"uniq": 287,
"uniq": 291,
"opcode": 4,
"is_dead": false
},
{
"space": "ram",
"offset": 134517353,
"uniq": 520,
"uniq": 523,
"opcode": 1,
"is_dead": false
},
{
"space": "ram",
"offset": 134517353,
"uniq": 302,
"uniq": 306,
"opcode": 7,
"is_dead": false
},
{
"space": "ram",
"offset": 134517361,
"uniq": 312,
"uniq": 316,
"opcode": 4,
"is_dead": false
},
{
"space": "ram",
"offset": 134517459,
"uniq": 133,
"uniq": 137,
"opcode": 7,
"is_dead": false
},
{
"space": "ram",
"offset": 134517469,
"uniq": 148,
"uniq": 152,
"opcode": 10,
"is_dead": false
}