Ghidra 11.3.2
Ghidra internal decompiler documentation.
Loading...
Searching...
No Matches
ghidra::ModelRule Class Reference

A rule controlling how parameters are assigned addresses. More...

#include <modelrules.hh>

Collaboration diagram for ghidra::ModelRule:
[legend]

Public Member Functions

 ModelRule (void)
 Constructor for use with decode.
 
 ModelRule (const ModelRule &op2, const ParamListStandard *res)
 Copy constructor.
 
 ModelRule (const DatatypeFilter &typeFilter, const AssignAction &action, const ParamListStandard *res)
 Construct from components.
 
 ~ModelRule (void)
 Destructor.
 
uint4 assignAddress (Datatype *dt, const PrototypePieces &proto, int4 pos, TypeFactory &tlist, vector< int4 > &status, ParameterPieces &res) const
 Assign an address and other details for a specific parameter or for return storage in context.
 
bool fillinOutputMap (ParamActive *active) const
 Test and mark the trial(s) that can be valid return value.
 
bool canAffectFillinOutput (void) const
 Return true if fillinOutputMap is active for this rule.
 
void decode (Decoder &decoder, const ParamListStandard *res)
 Decode this rule from stream.
 

Private Attributes

DatatypeFilterfilter
 Which data-types this rule applies to.
 
QualifierFilterqualifier
 Additional qualifiers for when the rule should apply (if non-null)
 
AssignActionassign
 How the Address should be assigned.
 
vector< AssignAction * > sideeffects
 Extra actions that happen on success.
 

Detailed Description

A rule controlling how parameters are assigned addresses.

Rules are applied to a parameter in the context of a full function prototype. A rule applies only for a specific class of data-type associated with the parameter, as determined by its DatatypeFilter, and may have other criteria limiting when it applies (via QualifierFilter).

Constructor & Destructor Documentation

◆ ModelRule()

ghidra::ModelRule::ModelRule ( const DatatypeFilter typeFilter,
const AssignAction action,
const ParamListStandard res 
)

Construct from components.

The provided components are cloned into the new object.

Parameters
typeFilteris the data-type filter the rule applies before performing the action
actionis the action that will be applied
resis the resource list to which this rule will be applied

References assign, ghidra::AssignAction::clone(), ghidra::DatatypeFilter::clone(), filter, and qualifier.

Member Function Documentation

◆ assignAddress()

uint4 ghidra::ModelRule::assignAddress ( Datatype dt,
const PrototypePieces proto,
int4  pos,
TypeFactory tlist,
vector< int4 > &  status,
ParameterPieces res 
) const

Assign an address and other details for a specific parameter or for return storage in context.

The Address is only assigned if the data-type filter and the optional qualifier filter pass, otherwise a fail response is returned. If the filters pass, the Address is assigned based on the AssignAction specific to this rule, and the action's response code is returned.

Parameters
dtis the data-type of the parameter or return value
protois the high-level description of the function prototype
posis the position of the parameter (pos>=0) or return storage (pos=-1)
tlistis a data-type factory for (possibly) transforming the data-type
statusis the resource consumption array
reswill hold the resulting description of the parameter
Returns
the response code

References assign, ghidra::AssignAction::assignAddress(), ghidra::AssignAction::fail, ghidra::QualifierFilter::filter(), ghidra::DatatypeFilter::filter(), filter, qualifier, and sideeffects.

◆ canAffectFillinOutput()

bool ghidra::ModelRule::canAffectFillinOutput ( void  ) const
inline

Return true if fillinOutputMap is active for this rule.

Returns
true if the assign action can affect fillinOutputMap()

References assign, and ghidra::AssignAction::canAffectFillinOutput().

◆ decode()

void ghidra::ModelRule::decode ( Decoder decoder,
const ParamListStandard res 
)

◆ fillinOutputMap()

bool ghidra::ModelRule::fillinOutputMap ( ParamActive active) const
inline

Test and mark the trial(s) that can be valid return value.

If the assign action could produce the trials as return value storage, return true

Parameters
activeis the set of trials
Returns
true if the trials form a return value

References assign, and ghidra::AssignAction::fillinOutputMap().


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