decompiler  1.0.0
Classes | Public Member Functions | Static Private Member Functions | List of all members
ghidra::ActionMarkImplied Class Reference

Mark all the implied Varnode objects, which will have no explicit token in the output. More...

#include <coreaction.hh>

Inheritance diagram for ghidra::ActionMarkImplied:
ghidra::Action

Classes

struct  DescTreeElement
 This class holds a single entry in a stack used to forward traverse Varnode expressions. More...
 

Public Member Functions

 ActionMarkImplied (const string &g)
 Constructor.
 
virtual Actionclone (const ActionGroupList &grouplist) const
 Clone the Action. More...
 
virtual int4 apply (Funcdata &data)
 Make a single attempt to apply this Action. More...
 
- Public Member Functions inherited from ghidra::Action
 Action (uint4 f, const string &nm, const string &g)
 Base constructor for an Action. More...
 
virtual ~Action (void)
 Destructor.
 
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...
 
const string & getName (void) const
 Get the Action's name.
 
const string & getGroup (void) const
 Get the Action's group.
 
uint4 getStatus (void) const
 Get the current status of this Action.
 
uint4 getNumTests (void)
 Get the number of times apply() was invoked.
 
uint4 getNumApply (void)
 
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 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 ActiongetSubAction (const string &specify)
 Retrieve a specific sub-action by name. More...
 
virtual RulegetSubRule (const string &specify)
 Retrieve a specific sub-rule by name. More...
 

Static Private Member Functions

static bool isPossibleAliasStep (Varnode *vn1, Varnode *vn2)
 Check for additive relationship. More...
 
static bool isPossibleAlias (Varnode *vn1, Varnode *vn2, int4 depth)
 Check for possible duplicate value. More...
 
static bool checkImpliedCover (Funcdata &data, Varnode *vn)
 Check for cover violation if Varnode is implied. More...
 

Additional Inherited Members

- Public Types inherited from ghidra::Action
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...
 
- Protected Member Functions inherited from ghidra::Action
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...
 
void turnOnWarnings (void)
 Enable warnings for this Action.
 
void turnOffWarnings (void)
 Disable warnings for this Action.
 
- Protected Attributes inherited from ghidra::Action
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.
 

Detailed Description

Mark all the implied Varnode objects, which will have no explicit token in the output.

Member Function Documentation

◆ apply()

int4 ghidra::ActionMarkImplied::apply ( Funcdata data)
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.

Parameters
datais the function to inspect/modify
Returns
0 for a complete application, -1 for a partial completion (due to breakpoint)

Implements ghidra::Action.

References ghidra::Funcdata::beginLoc(), ghidra::Varnode::endDescend(), ghidra::Funcdata::endLoc(), ghidra::Varnode::getDef(), ghidra::Varnode::getHigh(), ghidra::PcodeOp::getIn(), ghidra::Funcdata::getMerge(), ghidra::Varnode::hasCover(), ghidra::Merge::inflate(), ghidra::Varnode::isExplicit(), ghidra::Varnode::isFree(), ghidra::Varnode::isImplied(), ghidra::PcodeOp::numInput(), ghidra::Varnode::setExplicit(), and ghidra::Varnode::setImplied().

◆ checkImpliedCover()

bool ghidra::ActionMarkImplied::checkImpliedCover ( Funcdata data,
Varnode vn 
)
staticprivate

Check for cover violation if Varnode is implied.

Marking a Varnode as implied causes the input Varnodes to its defining op to propagate farther in the output. This may cause eventual variables to hold different values at the same point in the code. Any input must test that its propagated Cover doesn't intersect its current Cover.

Parameters
datais the function being analyzed
vnis the given Varnode
Returns
true if there is a Cover violation

References ghidra::Funcdata::beginOp(), ghidra::PcodeOp::code(), ghidra::Cover::contain(), ghidra::CPUI_LOAD, ghidra::CPUI_STORE, ghidra::Funcdata::endOp(), ghidra::Funcdata::getCallSpecs(), ghidra::Varnode::getCover(), ghidra::Varnode::getDef(), ghidra::Varnode::getHigh(), ghidra::PcodeOp::getIn(), ghidra::Funcdata::getMerge(), ghidra::Varnode::getOffset(), ghidra::FuncCallSpecs::getOp(), ghidra::Merge::inflateTest(), ghidra::PcodeOp::isCall(), ghidra::Varnode::isConstant(), ghidra::PcodeOp::isDead(), ghidra::Funcdata::numCalls(), and ghidra::PcodeOp::numInput().

◆ clone()

virtual Action* ghidra::ActionMarkImplied::clone ( const ActionGroupList grouplist) const
inlinevirtual

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.

Parameters
grouplistis the list of groups being cloned
Returns
the cloned Action or NULL

Implements ghidra::Action.

References ghidra::ActionStart::apply(), ghidra::ActionGroupList::contains(), and ghidra::Action::getGroup().

◆ isPossibleAlias()

bool ghidra::ActionMarkImplied::isPossibleAlias ( Varnode vn1,
Varnode vn2,
int4  depth 
)
staticprivate

Check for possible duplicate value.

Return false only if we can guarantee two Varnodes have different values.

Parameters
vn1is the first Varnode
vn2is the second Varnode
depthis the maximum level to recurse
Returns
true if its possible the Varnodes hold the same value

References ghidra::PcodeOp::code(), ghidra::CPUI_COPY, ghidra::CPUI_INT_2COMP, ghidra::CPUI_INT_ADD, ghidra::CPUI_INT_NEGATE, ghidra::CPUI_INT_SEXT, ghidra::CPUI_INT_ZEXT, ghidra::CPUI_PTRADD, ghidra::CPUI_PTRSUB, ghidra::Varnode::getDef(), ghidra::PcodeOp::getIn(), ghidra::Varnode::getOffset(), ghidra::Varnode::isConstant(), and ghidra::Varnode::isWritten().

◆ isPossibleAliasStep()

bool ghidra::ActionMarkImplied::isPossibleAliasStep ( Varnode vn1,
Varnode vn2 
)
staticprivate

Check for additive relationship.

Return false only if one Varnode is obtained by adding non-zero thing to another Varnode. The order of the Varnodes is not important.

Parameters
vn1is the first Varnode
vn2is the second Varnode
Returns
false if the additive relationship holds

References ghidra::PcodeOp::code(), ghidra::CPUI_INT_ADD, ghidra::CPUI_INT_XOR, ghidra::CPUI_PTRADD, ghidra::CPUI_PTRSUB, ghidra::Varnode::getDef(), ghidra::PcodeOp::getIn(), ghidra::Varnode::isConstant(), and ghidra::Varnode::isWritten().


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