Ghidra Decompiler Analysis Engine
|
Large scale transformations applied to the varnode/op graph. More...
#include <action.hh>
Inherited by ActionActiveParam, ActionActiveReturn, ActionAssignHigh, ActionBlockStructure, ActionConditionalConst, ActionConditionalExe, ActionConstantPtr, ActionConstbase, ActionCopyMarker, ActionDeadCode, ActionDefaultParams, ActionDeindirect, ActionDeterminedBranch, ActionDirectWrite, ActionDominantCopy, ActionDoNothing, ActionDynamicMapping, ActionDynamicSymbols, ActionExtraPopSetup, ActionFinalStructure, ActionForceGoto, ActionFuncLink, ActionFuncLinkOutOnly, ActionGroup, ActionHeritage, ActionHideShadow, ActionInferTypes, ActionInputPrototype, ActionLaneDivide, ActionLikelyTrash, ActionMapGlobals, ActionMarkExplicit, ActionMarkImplied, ActionMarkIndirectOnly, ActionMergeAdjacent, ActionMergeCopy, ActionMergeMultiEntry, ActionMergeRequired, ActionMergeType, ActionMultiCse, ActionNameVars, ActionNodeJoin, ActionNonzeroMask, ActionNormalizeBranches, ActionNormalizeSetup, ActionOutputPrototype, ActionParamDouble, ActionPool, ActionPreferComplement, ActionPrototypeTypes, ActionPrototypeWarnings, ActionRedundBranch, ActionRestrictLocal, ActionRestructureHigh, ActionRestructureVarnode, ActionReturnRecovery, ActionReturnSplit, ActionSegmentize, ActionSetCasts, ActionShadowVar, ActionSpacebase, ActionStackPtrFlow, ActionStart, ActionStartCleanUp, ActionStartTypes, ActionStop, ActionStructureTransform, ActionSwitchNorm, ActionUnjustifiedParams, ActionUnreachable, and ActionVarnodeProps.
Public Types | |
enum | ruleflags { rule_repeatapply = 4, rule_onceperfunc = 8, rule_oneactperfunc = 16, rule_debug = 32, rule_warnings_on = 64, rule_warnings_given = 128 } |
Boolean behavior properties governing this particular Action. More... | |
enum | statusflags { status_start =1, status_breakstarthit =2, status_repeat =4, status_mid =8, status_end =16, status_actionbreak =32 } |
Boolean properties describing the status of an action. More... | |
enum | breakflags { break_start = 1, tmpbreak_start = 2, break_action = 4, tmpbreak_action = 8 } |
Break points associated with an Action. More... | |
Public Member Functions | |
Action (uint4 f, const string &nm, const string &g) | |
Base constructor for an Action. More... | |
virtual void | printStatistics (ostream &s) const |
Dump statistics to stream. More... | |
int4 | perform (Funcdata &data) |
Perform this action (if necessary) More... | |
bool | setBreakPoint (uint4 tp, const string &specify) |
Set a breakpoint on this action. More... | |
virtual void | clearBreakPoints (void) |
Clear all breakpoints set on this Action. | |
bool | setWarning (bool val, const string &specify) |
Set a warning on this action. More... | |
bool | disableRule (const string &specify) |
Disable a specific Rule within this. More... | |
bool | enableRule (const string &specify) |
Enable a specific Rule within this. More... | |
virtual Action * | clone (const ActionGroupList &grouplist) const =0 |
Clone the Action. More... | |
virtual void | reset (Funcdata &data) |
Reset the Action for a new function. More... | |
virtual void | resetStats (void) |
Reset all the counts to zero. More... | |
virtual int4 | apply (Funcdata &data)=0 |
Make a single attempt to apply this Action. More... | |
virtual int4 | print (ostream &s, int4 num, int4 depth) const |
Print a description of this Action to stream. More... | |
virtual void | printState (ostream &s) const |
Print status to stream. More... | |
virtual Action * | getSubAction (const string &specify) |
Retrieve a specific sub-action by name. More... | |
virtual Rule * | getSubRule (const string &specify) |
Retrieve a specific sub-rule by name. More... | |
Protected Member Functions | |
void | issueWarning (Architecture *glb) |
Warn that this Action has applied. More... | |
bool | checkStartBreak (void) |
Check start breakpoint. More... | |
bool | checkActionBreak (void) |
Check action breakpoint. More... | |
Protected Attributes | |
int4 | lcount |
Changes not including last call to apply() | |
int4 | count |
Number of changes made by this action so far. | |
uint4 | status |
Current status. | |
uint4 | breakpoint |
Breakpoint properties. | |
uint4 | flags |
Behavior properties. | |
uint4 | count_tests |
Number of times apply() has been called. | |
uint4 | count_apply |
Number of times apply() made changes. | |
string | name |
Name of the action. | |
string | basegroup |
Base group this action belongs to. | |
Large scale transformations applied to the varnode/op graph.
The base for objects that make changes to the syntax tree of a Funcdata The action is invoked through the apply(Funcdata &data) method. This base class keeps track of basic statistics about how the action is being applied. Derived classes indicate that a change has been applied by incrementing the count field. With OPACTION_DEBUG macro defined, actions support a break point debugging in console mode.
enum Action::breakflags |
Break points associated with an Action.
Enumerator | |
---|---|
break_start | Break at beginning of action. |
tmpbreak_start | Temporary break at start of action. |
break_action | Break if a change has been made. |
enum Action::ruleflags |
Boolean behavior properties governing this particular Action.
enum Action::statusflags |
Boolean properties describing the status of an action.
Action::Action | ( | uint4 | f, |
const string & | nm, | ||
const string & | g | ||
) |
|
pure virtual |
Make a single attempt to apply this Action.
This is the main entry point for applying changes to a function that are specific to this Action. The method can inspect whatever it wants to decide if the Action does or does not apply. Changes are indicated by incrementing the count field.
data | is the function to inspect/modify |
Implemented in ActionPrototypeWarnings, ActionDynamicSymbols, ActionDynamicMapping, ActionCopyMarker, ActionDominantCopy, ActionHideShadow, ActionInferTypes, ActionUnjustifiedParams, ActionOutputPrototype, ActionInputPrototype, ActionMapGlobals, ActionRestructureHigh, ActionRestructureVarnode, ActionLikelyTrash, ActionRestrictLocal, ActionReturnRecovery, ActionActiveReturn, ActionActiveParam, ActionParamDouble, ActionFuncLinkOutOnly, ActionFuncLink, ActionExtraPopSetup, ActionDefaultParams, ActionPrototypeTypes, ActionNormalizeSetup, ActionSwitchNorm, ActionConditionalConst, ActionDeadCode, ActionDeterminedBranch, ActionRedundBranch, ActionDoNothing, ActionUnreachable, ActionNameVars, ActionMarkImplied, ActionMarkExplicit, ActionMergeType, ActionMergeMultiEntry, ActionMergeCopy, ActionMergeAdjacent, ActionNodeJoin, ActionMergeRequired, ActionReturnSplit, ActionMarkIndirectOnly, ActionAssignHigh, ActionFinalStructure, ActionSetCasts, ActionBlockStructure, ActionPreferComplement, ActionNonzeroMask, ActionNormalizeBranches, ActionHeritage, ActionPool, ActionStructureTransform, ActionSpacebase, ActionConstbase, ActionDirectWrite, ActionVarnodeProps, ActionDeindirect, ActionConstantPtr, ActionRestartGroup, ActionConditionalExe, ActionShadowVar, ActionMultiCse, ActionGroup, ActionForceGoto, ActionSegmentize, ActionLaneDivide, ActionStackPtrFlow, ActionStartTypes, ActionStartCleanUp, ActionStop, and ActionStart.
|
protected |
Check action breakpoint.
Check if there was an active action breakpoint on this Action
|
protected |
Check start breakpoint.
Check if there was an active start break point on this action
|
pure virtual |
Clone the Action.
If this Action is a member of one of the groups in the grouplist, this returns a clone of the Action, otherwise NULL is returned.
grouplist | is the list of groups being cloned |
Implemented in ActionPrototypeWarnings, ActionDynamicSymbols, ActionDynamicMapping, ActionCopyMarker, ActionDominantCopy, ActionHideShadow, ActionInferTypes, ActionUnjustifiedParams, ActionOutputPrototype, ActionInputPrototype, ActionMapGlobals, ActionRestructureHigh, ActionRestructureVarnode, ActionLikelyTrash, ActionRestrictLocal, ActionReturnRecovery, ActionActiveReturn, ActionActiveParam, ActionParamDouble, ActionFuncLinkOutOnly, ActionFuncLink, ActionExtraPopSetup, ActionDefaultParams, ActionPrototypeTypes, ActionNormalizeSetup, ActionSwitchNorm, ActionConditionalConst, ActionDeadCode, ActionDeterminedBranch, ActionRedundBranch, ActionDoNothing, ActionUnreachable, ActionNameVars, ActionMarkImplied, ActionMarkExplicit, ActionMergeType, ActionMergeMultiEntry, ActionMergeCopy, ActionMergeAdjacent, ActionNodeJoin, ActionMergeRequired, ActionReturnSplit, ActionMarkIndirectOnly, ActionAssignHigh, ActionFinalStructure, ActionSetCasts, ActionBlockStructure, ActionPreferComplement, ActionNonzeroMask, ActionNormalizeBranches, ActionHeritage, ActionPool, ActionStructureTransform, ActionSpacebase, ActionConstbase, ActionDirectWrite, ActionVarnodeProps, ActionDeindirect, ActionConstantPtr, ActionRestartGroup, ActionConditionalExe, ActionShadowVar, ActionMultiCse, ActionGroup, ActionForceGoto, ActionSegmentize, ActionLaneDivide, ActionStackPtrFlow, ActionStartTypes, ActionStartCleanUp, ActionStop, and ActionStart.
bool Action::disableRule | ( | const string & | specify | ) |
bool Action::enableRule | ( | const string & | specify | ) |
|
virtual |
Retrieve a specific sub-action by name.
If this Action matches the given name, it is returned. If the name matches a sub-action, this is returned.
specify | is the action name to match |
Reimplemented in ActionGroup.
|
virtual |
Retrieve a specific sub-rule by name.
Find a Rule, as a component of this Action, with the given name.
specify | is the name of the rule |
Reimplemented in ActionPool, and ActionGroup.
|
protected |
Warn that this Action has applied.
If enabled, issue a warning that this Action has been applied
glb | is the controlling Architecture |
int4 Action::perform | ( | Funcdata & | data | ) |
Perform this action (if necessary)
Run this Action until completion or a breakpoint occurs. Depending on the behavior properties of this instance, the apply() method may get called many times or none. Generally the number of changes made by the action is returned, but if a breakpoint occurs -1 is returned. A successive call to perform() will "continue" from the break point.
data | is the function being acted on |
|
virtual |
Print a description of this Action to stream.
The description is suitable for a console mode listing of actions
s | is the output stream |
num | is a starting index to associate with the action (and its sub-actions) |
depth | is amount of indent necessary before printing |
Reimplemented in ActionPool, and ActionGroup.
|
virtual |
Print status to stream.
This will the Action name and the next step to execute
s | is the output stream |
Reimplemented in ActionPool, and ActionGroup.
|
virtual |
Dump statistics to stream.
Print out the collected statistics for the Action to stream
s | is the output stream |
Reimplemented in ActionPool, and ActionGroup.
|
virtual |
Reset the Action for a new function.
data | is the new function this Action may affect |
Reimplemented in ActionInferTypes, ActionRestructureVarnode, ActionPool, ActionConstantPtr, ActionRestartGroup, ActionGroup, ActionSegmentize, and ActionStackPtrFlow.
|
virtual |
bool Action::setBreakPoint | ( | uint4 | tp, |
const string & | specify | ||
) |
Set a breakpoint on this action.
A breakpoint can be placed on this Action or some sub-action by properly specifying the (sub)action name.
tp | is the type of breakpoint (break_start, break_action, etc.) |
specify | is the (possibly sub)action to apply the break point to |
bool Action::setWarning | ( | bool | val, |
const string & | specify | ||
) |
Set a warning on this action.
If enabled, a warning will be printed whenever this action applies. The warning can be toggled for this Action or some sub-action by specifying its name.
val | is the toggle value for the warning |
specify | is the name of the action or sub-action to toggle |