mirror of
https://github.com/NationalSecurityAgency/ghidra.git
synced 2025-10-04 02:09:44 +02:00
GP-1954 Refactor characterizeAsParam, AncestorRealistic adjustments
This commit is contained in:
parent
91eb96f109
commit
b7955f2a79
15 changed files with 711 additions and 191 deletions
|
@ -59,11 +59,6 @@ class Funcdata {
|
|||
baddata_present = 0x800, ///< Set if function flowed into bad data
|
||||
double_precis_on = 0x1000 ///< Set if we are performing double precision recovery
|
||||
};
|
||||
enum {
|
||||
traverse_actionalt = 1, ///< Alternate path traverses a solid action or \e non-incidental COPY
|
||||
traverse_indirect = 2, ///< Main path traverses an INDIRECT
|
||||
traverse_indirectalt = 4 ///< Alternate path traverses an INDIRECT
|
||||
};
|
||||
uint4 flags; ///< Boolean properties associated with \b this function
|
||||
uint4 clean_up_index; ///< Creation index of first Varnode created after start of cleanup
|
||||
uint4 high_level_index; ///< Creation index of first Varnode created after HighVariables are created
|
||||
|
@ -124,7 +119,6 @@ class Funcdata {
|
|||
void nodeSplitCloneVarnode(PcodeOp *op,PcodeOp *newop);
|
||||
void nodeSplitRawDuplicate(BlockBasic *b,BlockBasic *bprime);
|
||||
void nodeSplitInputPatch(BlockBasic *b,BlockBasic *bprime,int4 inedge);
|
||||
static bool isAlternatePathValid(const Varnode *vn,uint4 flags);
|
||||
static bool descendantsOutside(Varnode *vn);
|
||||
static void saveVarnodeXml(ostream &s,VarnodeLocSet::const_iterator iter,VarnodeLocSet::const_iterator enditer);
|
||||
static bool checkIndirectUse(Varnode *vn);
|
||||
|
@ -374,7 +368,7 @@ public:
|
|||
void mapGlobals(void); ///< Make sure there is a Symbol entry for all global Varnodes
|
||||
bool checkCallDoubleUse(const PcodeOp *opmatch,const PcodeOp *op,const Varnode *vn,uint4 fl,const ParamTrial &trial) const;
|
||||
bool onlyOpUse(const Varnode *invn,const PcodeOp *opmatch,const ParamTrial &trial,uint4 mainFlags) const;
|
||||
bool ancestorOpUse(int4 maxlevel,const Varnode *invn,const PcodeOp *op,ParamTrial &trial,uint4 mainFlags) const;
|
||||
bool ancestorOpUse(int4 maxlevel,const Varnode *invn,const PcodeOp *op,ParamTrial &trial,int4 offset,uint4 mainFlags) const;
|
||||
bool syncVarnodesWithSymbols(const ScopeLocal *lm,bool typesyes);
|
||||
Datatype *checkSymbolType(Varnode *vn); ///< Check for any delayed symbol data-type information on the given Varnode
|
||||
void transferVarnodeProperties(Varnode *vn,Varnode *newVn,int4 lsbOffset);
|
||||
|
@ -599,9 +593,9 @@ class AncestorRealistic {
|
|||
seen_kill = 4 ///< Indicates the Varnode is killed by a call on at least path to MULTIEQUAL
|
||||
};
|
||||
PcodeOp *op; ///< Operation along the path to the Varnode
|
||||
Varnode *vn; ///< Varnode input to \b op, along path
|
||||
int4 slot; ///< vn = op->getIn(slot)
|
||||
uint4 flags; ///< Boolean properties of the node
|
||||
int4 offset; ///< Offset of the (eventual) trial value, within a possibly larger register
|
||||
|
||||
/// \brief Constructor given a Varnode read
|
||||
///
|
||||
|
@ -610,8 +604,20 @@ class AncestorRealistic {
|
|||
State(PcodeOp *o,int4 s) {
|
||||
op = o;
|
||||
slot = s;
|
||||
vn = op->getIn(slot);
|
||||
flags = 0;
|
||||
offset = 0;
|
||||
}
|
||||
|
||||
/// \brief Constructor from old state pulled back through a CPUI_SUBPIECE
|
||||
///
|
||||
/// Data ultimately in SUBPIECE output is copied from a non-zero offset within the input Varnode. Note this offset
|
||||
/// \param o is the CPUI_SUBPIECE
|
||||
/// \param oldState is the old state being pulled back from
|
||||
State(PcodeOp *o,const State &oldState) {
|
||||
op = o;
|
||||
slot = 0;
|
||||
flags = 0;
|
||||
offset = oldState.offset + (int4)op->getIn(1)->getOffset();
|
||||
}
|
||||
int4 getSolidSlot(void) const { return ((flags & seen_solid0)!=0) ? 0 : 1; } ///< Get slot associated with \e solid movement
|
||||
void markSolid(int4 s) { flags |= (s==0) ? seen_solid0 : seen_solid1; } ///< Mark given slot as having \e solid movement
|
||||
|
@ -641,8 +647,8 @@ class AncestorRealistic {
|
|||
vn->setMark();
|
||||
}
|
||||
|
||||
int4 enterNode(State &state); ///< Traverse into a new Varnode
|
||||
int4 uponPop(State &state,int4 command); ///< Pop a Varnode from the traversal stack
|
||||
int4 enterNode(void); ///< Traverse into a new Varnode
|
||||
int4 uponPop(int4 command); ///< Pop a Varnode from the traversal stack
|
||||
bool checkConditionalExe(State &state); ///< Check if current Varnode produced by conditional flow
|
||||
public:
|
||||
bool execute(PcodeOp *op,int4 slot,ParamTrial *t,bool allowFail);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue