mirror of
https://github.com/NationalSecurityAgency/ghidra.git
synced 2025-10-05 02:39:44 +02:00
added stability tests to ValueSet
This commit is contained in:
parent
32793712fe
commit
4ae42d0bd4
2 changed files with 17 additions and 3 deletions
|
@ -1442,6 +1442,8 @@ void ValueSet::setVarnode(Varnode *v,int4 tCode)
|
|||
opCode = CPUI_MAX;
|
||||
numParams = 0;
|
||||
range.setRange(0,vn->getSize()); // Treat as offset of 0 relative to special value
|
||||
leftIsStable = true;
|
||||
rightIsStable = true;
|
||||
}
|
||||
else if (vn->isWritten()) {
|
||||
PcodeOp *op = vn->getDef();
|
||||
|
@ -1452,17 +1454,23 @@ void ValueSet::setVarnode(Varnode *v,int4 tCode)
|
|||
}
|
||||
else
|
||||
numParams = op->numInput();
|
||||
leftIsStable = false;
|
||||
rightIsStable = false;
|
||||
}
|
||||
else if (vn->isConstant()) {
|
||||
opCode = CPUI_MAX;
|
||||
numParams = 0;
|
||||
range.setRange(vn->getOffset(),vn->getSize());
|
||||
leftIsStable = true;
|
||||
rightIsStable = true;
|
||||
}
|
||||
else { // Some other form of input
|
||||
opCode = CPUI_MAX;
|
||||
numParams = 0;
|
||||
typeCode = 0;
|
||||
range.setFull(vn->getSize());
|
||||
leftIsStable = false;
|
||||
rightIsStable = false;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1633,6 +1641,8 @@ bool ValueSet::iterate(Widener &widener)
|
|||
|
||||
if (res == range)
|
||||
return false;
|
||||
leftIsStable = range.getMin() == res.getMin();
|
||||
rightIsStable = range.getEnd() == res.getEnd();
|
||||
if (partHead != (Partition *)0) {
|
||||
if (!widener.doWidening(*this, range, res))
|
||||
setFull();
|
||||
|
|
|
@ -127,11 +127,13 @@ public:
|
|||
private:
|
||||
friend class ValueSetSolver;
|
||||
int4 typeCode; ///< 0=pure constant 1=stack relative
|
||||
Varnode *vn; ///< Varnode whose set this represents
|
||||
OpCode opCode; ///< Op-code defining Varnode
|
||||
int4 numParams; ///< Number of input parameters to defining operation
|
||||
CircleRange range; ///< Range of values or offsets in this set
|
||||
int4 count; ///< Depth first numbering / widening count
|
||||
OpCode opCode; ///< Op-code defining Varnode
|
||||
bool leftIsStable; ///< Set to \b true if left boundary of range didn't change (last iteration)
|
||||
bool rightIsStable; ///< Set to \b true if right boundary of range didn't change (last iteration)
|
||||
Varnode *vn; ///< Varnode whose set this represents
|
||||
CircleRange range; ///< Range of values or offsets in this set
|
||||
vector<Equation> equations; ///< Any equations associated with this value set
|
||||
Partition *partHead; ///< If Varnode is a component head, pointer to corresponding Partition
|
||||
ValueSet *next; ///< Next ValueSet to iterate
|
||||
|
@ -148,6 +150,8 @@ public:
|
|||
int4 getTypeCode(void) const { return typeCode; } ///< Return '0' for normal constant, '1' for spacebase relative
|
||||
Varnode *getVarnode(void) const { return vn; } ///< Get the Varnode attached to \b this ValueSet
|
||||
const CircleRange &getRange(void) const { return range; } ///< Get the actual range of values
|
||||
bool isLeftStable(void) const { return leftIsStable; }
|
||||
bool isRightStable(void) const { return rightIsStable; }
|
||||
void printRaw(ostream &s) const; ///< Write a text description of \b to the given stream
|
||||
};
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue