decompiler  1.0.0
Public Member Functions | Private Attributes | Friends | List of all members
ghidra::VariablePiece Class Reference

Information about how a HighVariable fits into a larger group or Symbol. More...

#include <variable.hh>

Public Member Functions

 VariablePiece (HighVariable *h, int4 offset, HighVariable *grp=(HighVariable *) 0)
 
 ~VariablePiece (void)
 Destructor.
 
HighVariablegetHigh (void) const
 Get the HighVariable associate with this piece.
 
VariableGroupgetGroup (void) const
 Get the central group.
 
int4 getOffset (void) const
 Get the offset of this within its group.
 
int4 getSize (void) const
 Return the number of bytes in this piece.
 
const CovergetCover (void) const
 Get the cover associated with this piece.
 
int4 numIntersection (void) const
 Get number of pieces this intersects with.
 
const VariablePiecegetIntersection (int4 i) const
 Get i-th piece this intersects with.
 
void markIntersectionDirty (void) const
 Mark all pieces as needing intersection recalculation.
 
void markExtendCoverDirty (void) const
 Mark all intersecting pieces as having a dirty extended cover.
 
void updateIntersections (void) const
 Calculate intersections with other pieces in the group. More...
 
void updateCover (void) const
 Calculate extended cover based on intersections. More...
 
void transferGroup (VariableGroup *newGroup)
 Transfer this piece to another VariableGroup. More...
 
void setHigh (HighVariable *newHigh)
 Move ownership of this to another HighVariable.
 
void mergeGroups (VariablePiece *op2, vector< HighVariable *> &mergePairs)
 Combine two VariableGroups. More...
 

Private Attributes

VariableGroupgroup
 Group to which this piece belongs.
 
HighVariablehigh
 HighVariable owning this piece.
 
int4 groupOffset
 Byte offset of this piece within the group.
 
int4 size
 Number of bytes in this piece.
 
vector< const VariablePiece * > intersection
 List of VariablePieces this piece intersects with.
 
Cover cover
 Extended cover for the piece, taking into account intersections.
 

Friends

class VariableGroup
 

Detailed Description

Information about how a HighVariable fits into a larger group or Symbol.

This is an extension to a HighVariable object that is assigned if the HighVariable is part of a group of mutually overlapping HighVariables. It describes the overlaps and how they affect the HighVariable Cover.

Constructor & Destructor Documentation

◆ VariablePiece()

ghidra::VariablePiece::VariablePiece ( HighVariable h,
int4  offset,
HighVariable grp = (HighVariable *)0 
)

Construct piece given a HighVariable and its position within the whole. If this is the first piece in the group, allocate a new VariableGroup object.

Parameters
his the given HighVariable to treat as a piece
offsetis the byte offset of the piece within the whole
grpis another HighVariable in the whole, or null if this is the first piece

References getGroup(), ghidra::HighVariable::getInstance(), ghidra::Varnode::getSize(), ghidra::HighVariable::piece, and ghidra::VariableGroup::size.

Member Function Documentation

◆ mergeGroups()

void ghidra::VariablePiece::mergeGroups ( VariablePiece op2,
vector< HighVariable *> &  mergePairs 
)

Combine two VariableGroups.

Combine the VariableGroup associated this and the given other VariablePiece into one group. Offsets are adjusted so that this and the other VariablePiece have the same offset. Combining in this way requires pieces of the same size and offset to be merged. This method does not do the merging but passes back a list of HighVariable pairs that need to be merged. The first element in the pair will have its VariablePiece in the new group, and the second element will have its VariablePiece freed in preparation for the merge.

Parameters
op2is the given other VariablePiece
mergePairspasses back the collection of HighVariable pairs that must be merged

References ghidra::VariableGroup::adjustOffsets(), group, groupOffset, high, ghidra::HighVariable::piece, ghidra::VariableGroup::pieceSet, and transferGroup().

◆ transferGroup()

void ghidra::VariablePiece::transferGroup ( VariableGroup newGroup)

Transfer this piece to another VariableGroup.

If there are no remaining references to the old VariableGroup it is deleted.

Parameters
newGroupis the new VariableGroup to transfer this to

References ghidra::VariableGroup::addPiece().

Referenced by ghidra::VariableGroup::combineGroups(), and mergeGroups().

◆ updateCover()

void ghidra::VariablePiece::updateCover ( void  ) const

Calculate extended cover based on intersections.

Union internal covers of all pieces intersecting with this.

References ghidra::HighVariable::coverdirty, ghidra::HighVariable::extendcoverdirty, ghidra::HighVariable::internalCover, and ghidra::HighVariable::updateInternalCover().

◆ updateIntersections()

void ghidra::VariablePiece::updateIntersections ( void  ) const

Calculate intersections with other pieces in the group.

Compute list of exactly the HighVariable pieces that intersect with this.

References groupOffset, ghidra::HighVariable::intersectdirty, ghidra::VariableGroup::size, and size.

Referenced by ghidra::Merge::inflateTest().


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