|
decompiler
1.0.0
|
A helper class describing the pointer being passed to a LOAD or STORE. More...
Public Member Functions | |
| bool | find (PcodeOp *op, Datatype *valueType) |
| Locate root pointer for underlying LOAD or STORE. More... | |
| void | freePointerChain (Funcdata &data) |
| Remove unused pointer calculations. More... | |
Private Member Functions | |
| bool | backUpPointer (void) |
| Follow flow of pointer back thru INT_ADD or PTRSUB. More... | |
Private Attributes | |
| PcodeOp * | loadStore |
| LOAD or STORE op. | |
| TypePointer * | ptrType |
| Base pointer data-type of LOAD or STORE. | |
| Varnode * | firstPointer |
| Direct pointer input for LOAD or STORE. | |
| Varnode * | pointer |
| The root pointer. | |
| int4 | baseOffset |
| Offset of the LOAD or STORE relative to root pointer. | |
Friends | |
| class | SplitDatatype |
A helper class describing the pointer being passed to a LOAD or STORE.
It makes distinction between the immediate pointer to the LOAD or STORE and a root pointer to the main structure or array, which the immediate pointer may be at an offset from.
|
private |
Follow flow of pointer back thru INT_ADD or PTRSUB.
If pointer Varnode is written by an INT_ADD, PTRSUB, or PTRADD from a another pointer to a structure or array, update pointer Varnode, baseOffset, and ptrType to this.
References ghidra::SplitFlow::addOp(), ghidra::AddrSpace::addressToByteInt(), ghidra::PcodeOp::code(), ghidra::CPUI_INT_ADD, ghidra::CPUI_PTRADD, ghidra::CPUI_PTRSUB, ghidra::PcodeOp::getIn(), ghidra::Datatype::getMetatype(), ghidra::Varnode::getOffset(), ghidra::Varnode::getTypeReadFacing(), ghidra::Varnode::isConstant(), ghidra::TYPE_ARRAY, ghidra::TYPE_PTR, and ghidra::TYPE_STRUCT.
Locate root pointer for underlying LOAD or STORE.
The LOAD or STORE pointer Varnode is examined. If it is a pointer to the given data-type, the root pointer is returned. If not, we try to recursively walk back through either PTRSUB or INT_ADD instructions, until a pointer Varnode matching the data-type is found. Any accumulated offset, relative to the original LOAD or STORE pointer is recorded in the baseOffset. If a matching pointer is not found, false is returned.
| op | is the LOAD or STORE |
| valueType | is the specific data-type to match |
References ghidra::PcodeOp::getIn(), ghidra::Datatype::getMetatype(), ghidra::TYPE_PARTIALSTRUCT, and ghidra::TYPE_PTR.
Referenced by ghidra::SplitDatatype::splitLoad(), and ghidra::SplitDatatype::splitStore().
| void ghidra::SplitDatatype::RootPointer::freePointerChain | ( | Funcdata & | data | ) |
Remove unused pointer calculations.
If the pointer Varnode is no longer used, recursively check and remove the op producing it, which will be either an INT_ADD or PTRSUB, until the root pointer is reached or a Varnode still being used is encountered.
| data | is the containing function |
References ghidra::PcodeOp::getIn(), and ghidra::Funcdata::opDestroy().
Referenced by ghidra::SplitDatatype::splitLoad(), and ghidra::SplitDatatype::splitStore().
1.8.13