|
decompiler 1.0.0
|
A collection of specific union data-type and how they resolve in a given context. More...
#include <unionresolve.hh>
Classes | |
| class | Record |
| A specific resolution of a union data-type. More... | |
Public Member Functions | |
| ResolveCache (Funcdata &fd) | |
| Constructor. | |
| void | addResolution (int4 key, Datatype *dt, PcodeOp *op, int4 slot) |
| Add a specific resolution to the cache. More... | |
| Datatype * | resolve (int4 key, Datatype *dt) const |
| Look up the in context resolution for the given data-type. More... | |
| void | inheritResolution (int4 key, Datatype *dt, int4 off, Varnode *vn, PcodeOp *op, int4 slot) const |
| Associate a cached resolution with a new Varnode and read/write edge. More... | |
| void | inheritResolution (int4 key, Varnode *vn, PcodeOp *op, int4 slot) const |
| Associate a cached resolution with a Varnode and its new read/write edge. More... | |
Private Attributes | |
| Funcdata & | data |
| Function to which resolutions apply. | |
| list< Record > | resolveList |
| List of known resolutions. | |
A collection of specific union data-type and how they resolve in a given context.
Union resolutions are collected before a transform via addResolution(). Then afterwards Varnodes can inherit the the same resolutions via the inheritResolution() methods. Resolutions for multiple contexts can stored and retrieved by providing an id for the context in the key parameter.
Add a specific resolution to the cache.
If a resolution for the data-type exists along the given edge, it is cached. Otherwise there is no change.
| key | is the context id associated with the resolution |
| dt | is the data-type needing resolution |
| op | is the PcodeOp reading/writing the resolved data-type |
| slot | is the edge index of the resolution |
References data, ghidra::ResolvedUnion::getBase(), ghidra::ResolvedUnion::getFieldNum(), ghidra::Funcdata::getUnionResolution(), ghidra::Datatype::needsResolution(), and resolveList.
Referenced by ghidra::SplitDatatype::RootPointer::find(), and ghidra::SplitDatatype::splitCopy().
| void ghidra::ResolveCache::inheritResolution | ( | int4 | key, |
| Datatype * | dt, | ||
| int4 | off, | ||
| Varnode * | vn, | ||
| PcodeOp * | op, | ||
| int4 | slot | ||
| ) | const |
Associate a cached resolution with a new Varnode and read/write edge.
The data-type dt can either be the current data-type of the Varnode or it can be a parent data-type, with off corresponding to the offset of the Varnode within the parent.
| key | is the context id |
| dt | is the data-type needing resolution |
| off | is the offset within the data-type of the Varnode |
| vn | is the new Varnode inheriting the resolution |
| op | is the PcodeOp reading/writing the Varnode |
| slot | is the read/write edge |
References data, ghidra::Funcdata::getArch(), ghidra::TypeFactory::getExactPiece(), ghidra::Datatype::getMetatype(), ghidra::Varnode::getSize(), ghidra::Datatype::needsResolution(), resolveList, ghidra::Funcdata::setUnionField(), ghidra::TYPE_PARTIALUNION, ghidra::TYPE_PTR, ghidra::Architecture::types, and ghidra::Varnode::updateType().
Referenced by ghidra::SplitDatatype::buildPointers(), inheritResolution(), and ghidra::SplitDatatype::splitCopy().
|
inline |
Associate a cached resolution with a Varnode and its new read/write edge.
| key | is the context id |
| vn | is the new Varnode inheriting the resolution |
| op | is the PcodeOp reading/writing the Varnode |
| slot | is the read/write edge |
References ghidra::Varnode::getType(), and inheritResolution().
Look up the in context resolution for the given data-type.
If the resolved data-type is in this cache, it is returned. Otherwise the original data-type is returned.
| key | is the context id |
| dt | is the given data-type needing resolution |
References ghidra::Datatype::getDepend(), and resolveList.
Referenced by ghidra::SplitDatatype::buildPointers().