|
decompiler 1.0.0
|
Calculate the prototype for the function. More...
#include <coreaction.hh>
Classes | |
| class | InputRef |
| A reference into the stack. More... | |
Public Member Functions | |
| ActionInputPrototype (const string &g) | |
| Constructor. | |
| 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 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. More... | |
| 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 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... | |
Private Member Functions | |
| void | gatherParamSpacebaseRefs (list< InputRef > &refs, Funcdata &data) |
| Gather references into the region of the stack reserved for parameters. More... | |
| void | markActiveInputRefs (ParamActive &active, list< InputRef > &refs, vector< Datatype * > &typeList, Funcdata &data) |
| Add an active parameter trial for any reference that is a possible input and doesn't intersect a Varnode. More... | |
| void | addRefOnlySymbols (list< InputRef > &refs, Funcdata &data) |
| Add a Symbol for any reference that doesn't intersect an existing input Varnode. 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. | |
Calculate the prototype for the function.
If the prototype wasn't originally known, the discovered input Varnodes are analyzed to determine a prototype based on the prototype model.
|
private |
Add a Symbol for any reference that doesn't intersect an existing input Varnode.
| refs | is the list of references |
| data | is the function |
References ghidra::Scope::addSymbol(), ghidra::ScopeInternal::findOverlap(), and ghidra::Funcdata::getScopeLocal().
|
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 ghidra::Action.
References ghidra::Funcdata::beginDef(), ghidra::ScopeInternal::clearCategory(), ghidra::Funcdata::clearDeadVarnodes(), ghidra::FuncProto::clearUnlockedInput(), ghidra::FuncProto::deriveInputMap(), ghidra::Funcdata::endDef(), ghidra::Symbol::fake_input, ghidra::Funcdata::findDisjointCover(), ghidra::Action::flags, ghidra::Varnode::getAddr(), ghidra::ParamTrial::getAddress(), ghidra::Funcdata::getArch(), ghidra::TypeFactory::getBase(), ghidra::Funcdata::getFuncProto(), ghidra::Varnode::getHigh(), ghidra::ParamActive::getNumTrials(), ghidra::Funcdata::getScopeLocal(), ghidra::ParamTrial::getSize(), ghidra::Varnode::getSize(), ghidra::ParamActive::getTrial(), ghidra::HighVariable::getType(), ghidra::Varnode::getType(), ghidra::Funcdata::hasInputIntersection(), ghidra::Varnode::hasNoDescend(), ghidra::ScopeLocal::hasOpenParamRefs(), ghidra::Varnode::input, ghidra::Funcdata::isHighOn(), ghidra::FuncProto::isInputLocked(), ghidra::Varnode::isPersist(), ghidra::ParamTrial::isUnref(), ghidra::ParamTrial::isUsed(), ghidra::ParamTrial::markActive(), ghidra::ParamTrial::markNoUse(), ghidra::FuncProto::possibleInputParam(), ghidra::ScopeInternal::printEntries(), ghidra::ParamActive::registerTrial(), ghidra::FuncProto::resolveModel(), ghidra::Action::rule_debug, ghidra::ParamTrial::setSlot(), ghidra::TYPE_UNKNOWN, ghidra::Architecture::types, and ghidra::FuncProto::updateInputTypes().
|
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 ghidra::Action.
References ActionInputPrototype(), ghidra::ActionGroupList::contains(), and ghidra::Action::getGroup().
|
private |
Gather references into the region of the stack reserved for parameters.
Look for PTRSUBs and PTRADDs off of the spacebase pointer for the local scope. Calculate the base address being referenced, and if it is a possible parameter, store the address and data-type associated with the reference. Sort and deup the references.
| refs | will hold any collected parameter references |
| data | is the function |
References ghidra::Varnode::beginDescend(), ghidra::PcodeOp::code(), ghidra::CPUI_PTRADD, ghidra::CPUI_PTRSUB, ghidra::Varnode::endDescend(), ghidra::Funcdata::findSpacebaseInput(), ghidra::PcodeOp::getAddr(), ghidra::VarnodeData::getAddr(), ghidra::TypeSpacebase::getAddress(), ghidra::Funcdata::getArch(), ghidra::TypeFactory::getBase(), ghidra::Funcdata::getFuncProto(), ghidra::PcodeOp::getIn(), ghidra::Datatype::getMetatype(), ghidra::Varnode::getOffset(), ghidra::PcodeOp::getOut(), ghidra::FuncProto::getParamRange(), ghidra::Funcdata::getScopeLocal(), ghidra::Datatype::getSize(), ghidra::Varnode::getSize(), ghidra::ScopeLocal::getSpaceId(), ghidra::Varnode::getType(), ghidra::Varnode::getTypeDefFacing(), ghidra::RangeList::inRange(), ghidra::Varnode::isConstant(), ghidra::FuncProto::possibleInputParam(), ghidra::VarnodeData::size, ghidra::TYPE_PTR, ghidra::TYPE_SPACEBASE, ghidra::TYPE_UNKNOWN, ghidra::Architecture::types, and ghidra::FuncProto::unjustifiedInputParam().
|
private |
Add an active parameter trial for any reference that is a possible input and doesn't intersect a Varnode.
| active | is the container accumulating parameter trials |
| refs | is the list of references |
| typeList | accumulates a data-type per parameter trial |
| data | is the function |
References ghidra::Funcdata::getFuncProto(), ghidra::ParamActive::getNumTrials(), ghidra::ParamActive::getTrial(), ghidra::Funcdata::hasInputIntersection(), ghidra::ParamTrial::markActive(), ghidra::FuncProto::possibleInputParam(), and ghidra::ParamActive::registerTrial().