decompiler  1.0.0
Public Types | Public Member Functions | Static Public Member Functions | Private Attributes | List of all members
ghidra::EffectRecord Class Reference

Description of the indirect effect a sub-function has on a memory range. More...

#include <fspec.hh>

Public Types

enum  { unaffected = 1, killedbycall = 2, return_address = 3, unknown_effect = 4 }
 

Public Member Functions

 EffectRecord (void)
 Constructor for use with decode()
 
 EffectRecord (const EffectRecord &op2)
 Copy constructor.
 
 EffectRecord (const Address &addr, int4 size)
 Construct a memory range with an unknown effect. More...
 
 EffectRecord (const ParamEntry &entry, uint4 t)
 Construct an effect on a parameter storage location. More...
 
 EffectRecord (const VarnodeData &addr, uint4 t)
 Construct an effect on a memory range. More...
 
uint4 getType (void) const
 Get the type of effect.
 
Address getAddress (void) const
 Get the starting address of the affected range.
 
int4 getSize (void) const
 Get the size of the affected range.
 
bool operator== (const EffectRecord &op2) const
 Equality operator.
 
bool operator!= (const EffectRecord &op2) const
 Inequality operator.
 
void encode (Encoder &encoder) const
 Encode the record to a stream. More...
 
void decode (uint4 grouptype, Decoder &decoder)
 Decode the record from a stream. More...
 

Static Public Member Functions

static bool compareByAddress (const EffectRecord &op1, const EffectRecord &op2)
 Compare two EffectRecords by their start Address. More...
 

Private Attributes

VarnodeData range
 The memory range affected.
 
uint4 type
 The type of effect.
 

Detailed Description

Description of the indirect effect a sub-function has on a memory range.

This object applies only to the specific memory range, which is seen from the point of view of the calling function as a particular sub-function gets called. The main enumeration below lists the possible effects.

Member Enumeration Documentation

◆ anonymous enum

anonymous enum
Enumerator
unaffected 

The sub-function does not change the value at all.

killedbycall 

The memory is changed and is completely unrelated to its original value.

return_address 

The memory is being used to store the return address.

unknown_effect 

An unknown effect (indicates the absence of an EffectRecord)

Constructor & Destructor Documentation

◆ EffectRecord() [1/3]

ghidra::EffectRecord::EffectRecord ( const Address addr,
int4  size 
)

Construct a memory range with an unknown effect.

The type is set to unknown_effect

Parameters
addris the start of the memory range
sizeis the number of bytes in the memory range

References ghidra::Address::getOffset(), ghidra::Address::getSpace(), and ghidra::AddrSpace::type.

◆ EffectRecord() [2/3]

ghidra::EffectRecord::EffectRecord ( const ParamEntry entry,
uint4  t 
)

Construct an effect on a parameter storage location.

Parameters
entryis a model of the parameter storage
tis the effect type

References ghidra::ParamEntry::getBase(), ghidra::ParamEntry::getSize(), ghidra::ParamEntry::getSpace(), and ghidra::AddrSpace::type.

◆ EffectRecord() [3/3]

ghidra::EffectRecord::EffectRecord ( const VarnodeData data,
uint4  t 
)

Construct an effect on a memory range.

Parameters
datais the memory range affected
tis the effect type

References ghidra::AddrSpace::type.

Member Function Documentation

◆ compareByAddress()

bool ghidra::EffectRecord::compareByAddress ( const EffectRecord op1,
const EffectRecord op2 
)
inlinestatic

Compare two EffectRecords by their start Address.

Parameters
op1is the first record to compare
op2is the other record to compare
Returns
true if this should be ordered before the other record

References ghidra::AddrSpace::getIndex(), ghidra::VarnodeData::offset, range, and ghidra::VarnodeData::space.

Referenced by ghidra::ProtoModel::decode(), ghidra::FuncProto::decodeEffect(), ghidra::ProtoModelMerged::intersectEffects(), ghidra::ProtoModel::lookupEffect(), and ghidra::ProtoModel::lookupRecord().

◆ decode()

void ghidra::EffectRecord::decode ( uint4  grouptype,
Decoder decoder 
)

Decode the record from a stream.

Parse an <addr> element to get the memory range. The effect type is inherited from the parent.

Parameters
grouptypeis the effect inherited from the parent
decoderis the stream decoder

References ghidra::AddrSpace::type.

◆ encode()

void ghidra::EffectRecord::encode ( Encoder encoder) const

Encode the record to a stream.

Encode just an <addr> element. The effect type is indicated by the parent element.

Parameters
encoderis the stream encoder

References ghidra::Address::encode(), and ghidra::AddrSpace::type.

Referenced by ghidra::FuncProto::encodeEffect().


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