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

Forward declaration. More...

#include <variable.hh>

Classes

struct  PieceCompareByOffset
 Compare two VariablePiece pointers by offset then by size. More...
 

Public Member Functions

bool empty (void) const
 Return true if this group has no pieces.
 
void addPiece (VariablePiece *piece)
 Add a new piece to this group. More...
 
void adjustOffsets (int4 amt)
 Adjust offset for every piece by the given amount. More...
 
void removePiece (VariablePiece *piece)
 Remove a piece from this group.
 
int4 getSize (void) const
 Get the number of bytes this group covers.
 
void setSymbolOffset (int4 val)
 Cache the symbol offset for the group.
 
int4 getSymbolOffset (void) const
 Get offset of this group within its Symbol.
 
void combineGroups (VariableGroup *op2)
 Combine given VariableGroup into this. More...
 

Private Attributes

set< VariablePiece *, PieceCompareByOffsetpieceSet
 The set of VariablePieces making up this group.
 
int4 size
 Number of contiguous bytes covered by the whole group.
 
int4 symbolOffset
 Byte offset of this group within its containing Symbol.
 

Friends

class VariablePiece
 

Detailed Description

Forward declaration.

A collection of HighVariable objects that overlap

A HighVariable represents a variable or partial variable that is manipulated as a unit by the (de)compiler. A formal Symbol may be manipulated using multiple HighVariables that in principal can overlap. For a set of HighVariable objects that mutually overlap, a VariableGroup is a central access point for information about the intersections. The information is used in particular to extend HighVariable Cover objects to take into account the intersections.

Member Function Documentation

◆ addPiece()

void ghidra::VariableGroup::addPiece ( VariablePiece piece)

Add a new piece to this group.

The VariablePiece takes partial ownership of this, via refCount.

Parameters
pieceis the new piece to add

References ghidra::VariablePiece::getOffset(), ghidra::VariablePiece::getSize(), ghidra::VariablePiece::group, pieceSet, and size.

Referenced by empty(), and ghidra::VariablePiece::transferGroup().

◆ adjustOffsets()

void ghidra::VariableGroup::adjustOffsets ( int4  amt)

Adjust offset for every piece by the given amount.

The adjustment amount must be positive, and this effectively increases the size of the group.

Parameters
amtis the given amount to add to offsets

References pieceSet, and size.

Referenced by empty(), and ghidra::VariablePiece::mergeGroups().

◆ combineGroups()

void ghidra::VariableGroup::combineGroups ( VariableGroup op2)

Combine given VariableGroup into this.

Every VariablePiece in the given group is moved into this and the VariableGroup object is deleted. There must be no matching VariablePieces with the same size and offset between the two groups or a LowlevelError exception is thrown.

Parameters
op2is the given VariableGroup to merge into this

References pieceSet, and ghidra::VariablePiece::transferGroup().

Referenced by getSymbolOffset(), and ghidra::HighVariable::groupWith().


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