|
decompiler 1.0.0
|
Class for transforming bitfield expressions. More...
#include <bitfield.hh>
Public Member Functions | |
| BitFieldTransform (Funcdata *f, Datatype *dt, int4 off) | |
| Constructor setting up basic info about bitfield data-type. | |
Protected Member Functions | |
| void | establishFields (Varnode *vn, bool followHoles) |
| Build worklist for each bitfield overlapped by given Varnode. | |
| Datatype * | buildPartialType (void) |
| Build the (partial) data-type associated with the root bitfield container. | |
Static Protected Member Functions | |
| static bool | findOverwrite (Varnode *vn, BlockBasic *bl, const BitRange &range) |
| Return true if specified bits in a Varnode are overwritten in the same basic block. | |
Protected Attributes | |
| Funcdata * | func |
| The containing function. | |
| TypeStruct * | parentStruct |
| Structure owning the bitfields. | |
| list< BitFieldNodeState > | workList |
| Fields that are being followed. | |
| int4 | initialOffset |
| Byte offset into parent structure. | |
| int4 | containerSize |
| Size of Varnode containing bitfields. | |
| bool | isBigEndian |
| Endianness associated with bitfields. | |
Class for transforming bitfield expressions.
For both insertion and extraction, establish the bitfields that need to be traced.
Constructor setting up basic info about bitfield data-type.
| f | is the containing function |
| dt | is the bitfield data-type |
| off | is any initial byte offset into the data-type for the root Varnode |
References containerSize, func, ghidra::Funcdata::getArch(), ghidra::AddrSpaceManager::getDefaultDataSpace(), ghidra::Datatype::getMetatype(), ghidra::TypePartialStruct::getOffset(), ghidra::TypePartialStruct::getParent(), initialOffset, isBigEndian, ghidra::AddrSpace::isBigEndian(), parentStruct, ghidra::TYPE_PARTIALSTRUCT, and ghidra::TYPE_STRUCT.
|
protected |
Build the (partial) data-type associated with the root bitfield container.
References containerSize, func, ghidra::Funcdata::getArch(), ghidra::Datatype::getSize(), ghidra::TypeFactory::getTypePartialStruct(), initialOffset, parentStruct, and ghidra::Architecture::types.
Referenced by ghidra::BitFieldInsertTransform::apply(), and ghidra::BitFieldPullTransform::apply().
|
protected |
Build worklist for each bitfield overlapped by given Varnode.
A BitFieldNodeState is constructed for each bitfield that the Varnode overlaps. Holes between bitfields can also have a BitFieldNodeState.
| vn | is the given Varnode |
| followHoles | is true if a record for each hole should be created |
References ghidra::BitFieldTriple::bitfield, ghidra::TypeBitField::bits, ghidra::TypeStruct::collectBitFields(), ghidra::BitFieldTriple::compare(), ghidra::Varnode::getSize(), initialOffset, isBigEndian, ghidra::BitRange::numBits, ghidra::BitRange::overlapTest(), parentStruct, ghidra::BitRange::translateLSB(), and workList.
Referenced by ghidra::BitFieldInsertTransform::BitFieldInsertTransform(), and ghidra::BitFieldPullTransform::BitFieldPullTransform().
|
staticprotected |
Return true if specified bits in a Varnode are overwritten in the same basic block.
This assumes other unspecified bits within the given Varnode are preserved at the point of overwrite.
References ghidra::Varnode::beginDescend(), ghidra::BitRange::byteOffset, ghidra::BitRange::byteSize, ghidra::PcodeOp::code(), ghidra::Address::containedBy(), ghidra::CPUI_COPY, ghidra::CPUI_INDIRECT, ghidra::CPUI_INSERT, ghidra::CPUI_INT_AND, ghidra::CPUI_INT_LEFT, ghidra::CPUI_INT_NEGATE, ghidra::CPUI_INT_OR, ghidra::CPUI_INT_RIGHT, ghidra::CPUI_INT_XOR, ghidra::CPUI_PIECE, ghidra::Varnode::endDescend(), ghidra::BitRange::extendBytes(), ghidra::Varnode::getAddr(), ghidra::PcodeOp::getIn(), ghidra::Varnode::getOffset(), ghidra::PcodeOp::getOut(), ghidra::PcodeOp::getParent(), ghidra::InsertExpression::getRangeMask(), ghidra::Varnode::getSize(), ghidra::Varnode::hasNoDescend(), ghidra::BitRange::intersectMask(), ghidra::Varnode::isConstant(), ghidra::Varnode::loneDescend(), ghidra::BitRange::minimizeContainer(), ghidra::BitRange::numBits, and ghidra::BitRange::shift().
Referenced by ghidra::BitFieldInsertTransform::isOverwrittenPartial().