mirror of
https://github.com/NationalSecurityAgency/ghidra.git
synced 2025-10-04 02:09:44 +02:00
GP-2627 TypePartialStruct
This commit is contained in:
parent
cc35d57933
commit
2591c17f22
15 changed files with 636 additions and 433 deletions
|
@ -869,24 +869,6 @@ bool Funcdata::syncVarnodesWithSymbols(const ScopeLocal *lm,bool updateDatatypes
|
|||
return updateoccurred;
|
||||
}
|
||||
|
||||
/// If the Varnode is a partial of a Symbol with a \e union data-type component, we assign
|
||||
/// a partial union data-type (TypePartialUnion) to the Varnode, so that facing resolutions
|
||||
/// can be provided.
|
||||
/// \param vn is the given Varnode
|
||||
/// \return the partial data-type or null
|
||||
Datatype *Funcdata::checkSymbolType(Varnode *vn)
|
||||
|
||||
{
|
||||
if (vn->isTypeLock()) return vn->getType();
|
||||
SymbolEntry *entry = vn->getSymbolEntry();
|
||||
Symbol *sym = entry->getSymbol();
|
||||
Datatype *curType = sym->getType();
|
||||
if (curType->getSize() == vn->getSize())
|
||||
return (Datatype *)0;
|
||||
int4 curOff = (vn->getAddr().getOffset() - entry->getAddr().getOffset()) + entry->getOffset();
|
||||
return glb->types->getExactPiece(curType, curOff, vn->getSize());
|
||||
}
|
||||
|
||||
/// A Varnode overlaps the given SymbolEntry. Make sure the Varnode is part of the variable
|
||||
/// underlying the Symbol. If not, remap things so that the Varnode maps to a distinct Symbol.
|
||||
/// In either case, attach the appropriate Symbol to the Varnode
|
||||
|
@ -1037,9 +1019,11 @@ void Funcdata::linkProtoPartial(Varnode *vn)
|
|||
Varnode *rootVn = PieceNode::findRoot(vn);
|
||||
if (rootVn == vn) return;
|
||||
|
||||
Varnode *nameRep = rootVn->getHigh()->getNameRepresentative();
|
||||
HighVariable *rootHigh = rootVn->getHigh();
|
||||
Varnode *nameRep = rootHigh->getNameRepresentative();
|
||||
Symbol *sym = linkSymbol(nameRep);
|
||||
if (sym == (Symbol *)0) return;
|
||||
rootHigh->establishGroupSymbolOffset();
|
||||
SymbolEntry *entry = sym->getFirstWholeMap();
|
||||
vn->setSymbolEntry(entry);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue