decompiler
1.0.0
|
Check for constants, with pointer type, that correspond to global symbols. More...
#include <coreaction.hh>
Public Member Functions | |
ActionConstantPtr (const string &g) | |
Constructor. | |
virtual void | reset (Funcdata &data) |
Reset the Action for a new function. More... | |
virtual Action * | clone (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 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 | 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 void | saveXml (ostream &s) const |
Save specifics of this action to stream. | |
virtual void | restoreXml (const Element *el, Funcdata *fd) |
Load specifics of action from XML. | |
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... | |
Static Private Member Functions | |
static AddrSpace * | searchForLoadStore (Varnode *vn, PcodeOp *op) |
Make a limited search from a constant for a LOAD or STORE so we can see the AddrSpace being accessed. More... | |
static AddrSpace * | selectInferSpace (Varnode *vn, PcodeOp *op, const vector< AddrSpace * > &spaceList) |
Select the AddrSpace in which we infer with the given constant is a pointer. More... | |
static SymbolEntry * | isPointer (AddrSpace *spc, Varnode *vn, PcodeOp *op, int4 slot, Address &rampoint, uintb &fullEncoding, Funcdata &data) |
Determine if given Varnode might be a pointer constant. More... | |
Private Attributes | |
int4 | localcount |
Number of passes made for this function. | |
Additional Inherited Members | |
Public Types inherited from 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 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 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. | |
Check for constants, with pointer type, that correspond to global symbols.
|
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 |
Implements Action.
References Funcdata::beginLoc(), PcodeOp::code(), CPUI_INT_ADD, CPUI_PTRADD, CPUI_PTRSUB, Funcdata::endLoc(), Funcdata::getArch(), AddrSpaceManager::getConstantSpace(), PcodeOp::getIn(), Varnode::getOffset(), Varnode::getSize(), PcodeOp::getSlot(), Varnode::hasNoDescend(), Architecture::inferPtrSpaces, Varnode::isConstant(), Varnode::isPtrCheck(), Varnode::isSpacebase(), Funcdata::isTypeRecoveryOn(), Varnode::loneDescend(), Funcdata::opSwapInput(), Varnode::setPtrCheck(), and Funcdata::spacebaseConstant().
|
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.
grouplist | is the list of groups being cloned |
Implements Action.
References ActionStart::apply(), ActionGroupList::contains(), and Action::getGroup().
|
staticprivate |
Determine if given Varnode might be a pointer constant.
If it is a pointer, return the symbol it points to, or NULL otherwise. If it is determined that the Varnode is a pointer to a specific symbol, the encoding of the full pointer is passed back. Usually this is just the constant value of the Varnode, but in this case of partial pointers (like near pointers) the full pointer may contain additional information.
spc | is the address space being pointed to |
vn | is the given Varnode |
op | is the lone descendant of the Varnode |
slot | is the slot index of the Varnode |
rampoint | will hold the Address of the resolved symbol |
fullEncoding | will hold the full pointer encoding being passed back |
data | is the function being analyzed |
References bit_transitions(), PcodeOp::code(), CPUI_CALL, CPUI_CALLIND, CPUI_COPY, CPUI_INT_ADD, CPUI_INT_EQUAL, CPUI_INT_LESS, CPUI_INT_LESSEQUAL, CPUI_INT_NOTEQUAL, CPUI_RETURN, CPUI_STORE, SymbolEntry::getAddr(), PcodeOp::getAddr(), Funcdata::getArch(), PcodeOp::getIn(), Datatype::getMetatype(), Varnode::getOffset(), PcodeOp::getOut(), Scope::getParent(), AddrSpace::getPointerLowerBound(), AddrSpace::getPointerUpperBound(), Funcdata::getScopeLocal(), Varnode::getSize(), SymbolEntry::getSymbol(), Varnode::getType(), Symbol::getType(), Architecture::infer_pointers, Datatype::isCharPrint(), Address::isInvalid(), Varnode::isTypeLock(), Scope::queryContainer(), AddrSpaceManager::resolveConstant(), TYPE_ARRAY, and TYPE_PTR.
|
inlinevirtual |
Make a limited search from a constant for a LOAD or STORE so we can see the AddrSpace being accessed.
We traverse forward through the op reading the constant, through INT_ADD, INDIRECT, COPY, and MULTIEQUAL until we hit a LOAD or STORE.
vn | is the constant we are searching from |
op | is the PcodeOp reading the constant |
References Varnode::beginDescend(), PcodeOp::code(), CPUI_COPY, CPUI_INDIRECT, CPUI_INT_ADD, CPUI_LOAD, CPUI_MULTIEQUAL, CPUI_STORE, Varnode::endDescend(), Varnode::getAddr(), PcodeOp::getIn(), PcodeOp::getOut(), Address::getSpaceFromConst(), and Varnode::loneDescend().
|
staticprivate |
Select the AddrSpace in which we infer with the given constant is a pointer.
The constant must match the AddrSpace address size. If there is more than one possible match, search for more information in the syntax tree.
vn | is the given constant Varnode |
op | is the PcodeOp which uses the constant |
spaceList | is the list of address spaces to select from |
References AddrSpace::getAddrSize(), AddrSpace::getMinimumPtrSize(), and Varnode::getSize().