Class ModelRule
java.lang.Object
ghidra.program.model.lang.protorules.ModelRule
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 Summary
ConstructorDescriptionModelRule
(DatatypeFilter typeFilter, AssignAction action, ParamListStandard res) Construct from components The provided components are cloned into the new object.ModelRule
(ModelRule op2, ParamListStandard res) Copy constructor -
Method Summary
Modifier and TypeMethodDescriptionint
assignAddress
(DataType dt, PrototypePieces proto, int pos, DataTypeManager dtManager, int[] status, ParameterPieces res) 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.void
Encode this rule to a streamboolean
void
restoreXml
(XmlPullParser parser, ParamListStandard res) Decode this rule from stream
-
Constructor Details
-
ModelRule
public ModelRule() -
ModelRule
Copy constructor- Parameters:
op2
- is the ModelRule to copy fromres
- is the new resource set to associate with the copy- Throws:
InvalidInputException
- if necessary resources are not present in the resource set
-
ModelRule
public ModelRule(DatatypeFilter typeFilter, AssignAction action, ParamListStandard res) throws InvalidInputException Construct from components The provided components are cloned into the new object.- Parameters:
typeFilter
- is the data-type filter the rule applies before performing the actionaction
- is the action that will be appliedres
- is the resource list to which this rule will be applied- Throws:
InvalidInputException
- if necessary resources are missing from the list
-
-
Method Details
-
isEquivalent
-
assignAddress
public int assignAddress(DataType dt, PrototypePieces proto, int pos, DataTypeManager dtManager, int[] status, ParameterPieces res) 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:
dt
- is the data-type of the parameter or return valueproto
- is the high-level description of the function prototypepos
- is the position of the parameter (pos>=0) or return storage (pos=-1)dtManager
- is a data-type manager for (possibly) transforming the data-typestatus
- is the resource consumption arrayres
- will hold the resulting description of the parameter- Returns:
- the response code
-
encode
Encode this rule to a stream- Parameters:
encoder
- is the stream encode- Throws:
IOException
- for problems with the stream
-
restoreXml
Decode this rule from stream- Parameters:
parser
- is the stream decoderres
- is the parameter resource list owning this rule- Throws:
XmlParseException
- if there are problems decoding are missing resources
-