decompiler 1.0.0
Public Member Functions | Protected Member Functions | Static Protected Member Functions | Protected Attributes | List of all members
ghidra::BitFieldTransform Class Reference

Class for transforming bitfield expressions. More...

#include <bitfield.hh>

Inheritance diagram for ghidra::BitFieldTransform:
ghidra::BitFieldInsertTransform ghidra::BitFieldPullTransform

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.
 
DatatypebuildPartialType (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

Funcdatafunc
 The containing function.
 
TypeStructparentStruct
 Structure owning the bitfields.
 
list< BitFieldNodeStateworkList
 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.
 

Detailed Description

Class for transforming bitfield expressions.

For both insertion and extraction, establish the bitfields that need to be traced.

Constructor & Destructor Documentation

◆ BitFieldTransform()

ghidra::BitFieldTransform::BitFieldTransform ( Funcdata f,
Datatype dt,
int4  off 
)

Constructor setting up basic info about bitfield data-type.

Parameters
fis the containing function
dtis the bitfield data-type
offis 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.

Member Function Documentation

◆ buildPartialType()

Datatype * ghidra::BitFieldTransform::buildPartialType ( void  )
protected

◆ establishFields()

void ghidra::BitFieldTransform::establishFields ( Varnode vn,
bool  followHoles 
)
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.

Parameters
vnis the given Varnode
followHolesis 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().

◆ findOverwrite()

bool ghidra::BitFieldTransform::findOverwrite ( Varnode vn,
BlockBasic bl,
const BitRange range 
)
staticprotected

The documentation for this class was generated from the following files: