Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/GP-3518_JoinDoublePrecision' int…
Browse files Browse the repository at this point in the history
…o patch
  • Loading branch information
ryanmkurtz committed Jun 12, 2023
2 parents 8e866ff + 603cf55 commit f7cdef1
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 5 deletions.
18 changes: 14 additions & 4 deletions Ghidra/Features/Decompiler/src/decompile/cpp/double.cc
Original file line number Diff line number Diff line change
Expand Up @@ -787,10 +787,14 @@ bool SplitVarnode::isAddrTiedContiguous(Varnode *lo,Varnode *hi,Address &res)
if (!hi->isAddrTied()) return false;

// Make sure there is no explicit symbol that would prevent the pieces from being joined
SymbolEntry *entry = lo->getSymbolEntry();
if ((entry != (SymbolEntry *)0)&&(entry->getOffset()==0)) return false;
entry = hi->getSymbolEntry();
if ((entry != (SymbolEntry *)0)&&(entry->getOffset()==0)) return false;
SymbolEntry *entryLo = lo->getSymbolEntry();
SymbolEntry *entryHi = hi->getSymbolEntry();
if (entryLo != (SymbolEntry *)0 || entryHi != (SymbolEntry *)0) {
if (entryLo == (SymbolEntry *)0 || entryHi == (SymbolEntry *)0)
return false; // One is marked with a symbol, the other is not
if (entryLo->getSymbol() != entryHi->getSymbol())
return false; // They are part of different symbols
}
AddrSpace *spc = lo->getSpace();
if (spc != hi->getSpace()) return false;
uintb looffset = lo->getOffset();
Expand Down Expand Up @@ -3093,6 +3097,12 @@ bool IndirectForm::verify(Varnode *h,Varnode *l,PcodeOp *ind)
if (affector != PcodeOp::getOpFromConst(indlo->getIn(1)->getAddr())) continue; // hi and lo must be affected by same op
reslo = indlo->getOut();
if (reslo->getSpace()->getType() == IPTR_INTERNAL) return false; // Indirect must not be through a temporary
if (reslo->isAddrTied() || reshi->isAddrTied()) {
Address addr;
// If one piece is address tied, the other must be as well, and they must fit together as contiguous whole
if (!SplitVarnode::isAddrTiedContiguous(reslo, reshi, addr))
return false;
}
return true;
}
return false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
<com>dec</com>
<com>print C</com>
<com>lo fu partial1</com>
<com>map unionfacet structunion 1 r0x1006ee 20603f6a8a0b89</com>
<com>map unionfacet structunion 1 r0x1006ee 10603f2c20ffa6</com>
<com>dec</com>
<com>print C</com>
<com>quit</com>
Expand Down

0 comments on commit f7cdef1

Please sign in to comment.