mirror of
https://github.com/NationalSecurityAgency/ghidra.git
synced 2025-10-04 02:09:44 +02:00
Lock unused input varnodes with special flag, not typelock
This commit is contained in:
parent
6bac1a8712
commit
0a1da61da0
3 changed files with 8 additions and 7 deletions
|
@ -3469,6 +3469,7 @@ int4 ActionPrototypeTypes::apply(Funcdata &data)
|
||||||
ProtoParameter *param = data.getFuncProto().getParam(i);
|
ProtoParameter *param = data.getFuncProto().getParam(i);
|
||||||
Varnode *vn = data.newVarnode( param->getSize(), param->getAddress());
|
Varnode *vn = data.newVarnode( param->getSize(), param->getAddress());
|
||||||
vn = data.setInputVarnode(vn);
|
vn = data.setInputVarnode(vn);
|
||||||
|
vn->setLockedInput();
|
||||||
if (topbl != (BlockBasic *)0)
|
if (topbl != (BlockBasic *)0)
|
||||||
extendInput(data,vn,param,topbl);
|
extendInput(data,vn,param,topbl);
|
||||||
if (ptr_size > 0) {
|
if (ptr_size > 0) {
|
||||||
|
|
|
@ -711,12 +711,9 @@ void Funcdata::clearDeadVarnodes(void)
|
||||||
while(iter!=vbank.endLoc()) {
|
while(iter!=vbank.endLoc()) {
|
||||||
vn = *iter++;
|
vn = *iter++;
|
||||||
if (vn->hasNoDescend()) {
|
if (vn->hasNoDescend()) {
|
||||||
if (vn->isInput()&&(!vn->isMark())) {
|
if (vn->isInput() && !vn->isLockedInput()) {
|
||||||
if ((vn->isSpacebase())|| // Space base is always typelocked
|
vbank.makeFree(vn);
|
||||||
(!vn->isTypeLock())) {
|
vn->clearCover();
|
||||||
vbank.makeFree(vn);
|
|
||||||
vn->clearCover();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if (vn->isFree())
|
if (vn->isFree())
|
||||||
vbank.destroy(vn);
|
vbank.destroy(vn);
|
||||||
|
|
|
@ -116,7 +116,8 @@ public:
|
||||||
ptrcheck = 0x10, ///< The Varnode value is \e NOT a pointer
|
ptrcheck = 0x10, ///< The Varnode value is \e NOT a pointer
|
||||||
ptrflow = 0x20, ///< If this varnode flows to or from a pointer
|
ptrflow = 0x20, ///< If this varnode flows to or from a pointer
|
||||||
unsignedprint = 0x40, ///< Constant that must be explicitly printed as unsigned
|
unsignedprint = 0x40, ///< Constant that must be explicitly printed as unsigned
|
||||||
stack_store = 0x80 ///< Created by an explicit STORE
|
stack_store = 0x80, ///< Created by an explicit STORE
|
||||||
|
locked_input = 0x100 ///< Input that exists even if its unused
|
||||||
};
|
};
|
||||||
private:
|
private:
|
||||||
mutable uint4 flags; ///< The collection of boolean attributes for this Varnode
|
mutable uint4 flags; ///< The collection of boolean attributes for this Varnode
|
||||||
|
@ -237,6 +238,7 @@ public:
|
||||||
bool isMark(void) const { return ((flags&Varnode::mark)!=0); } ///< Has \b this been visited by the current algorithm?
|
bool isMark(void) const { return ((flags&Varnode::mark)!=0); } ///< Has \b this been visited by the current algorithm?
|
||||||
bool isActiveHeritage(void) const { return ((addlflags&Varnode::activeheritage)!=0); } ///< Is \b this currently being traced by the Heritage algorithm?
|
bool isActiveHeritage(void) const { return ((addlflags&Varnode::activeheritage)!=0); } ///< Is \b this currently being traced by the Heritage algorithm?
|
||||||
bool isStackStore(void) const { return ((addlflags&Varnode::stack_store)!=0); } ///< Was this originally produced by an explicit STORE
|
bool isStackStore(void) const { return ((addlflags&Varnode::stack_store)!=0); } ///< Was this originally produced by an explicit STORE
|
||||||
|
bool isLockedInput(void) const { return ((addlflags&Varnode::locked_input)!=0); } ///< Is always an input, even if unused
|
||||||
|
|
||||||
/// Is \b this just a special placeholder representing INDIRECT creation?
|
/// Is \b this just a special placeholder representing INDIRECT creation?
|
||||||
bool isIndirectZero(void) const { return ((flags&(Varnode::indirect_creation|Varnode::constant))==(Varnode::indirect_creation|Varnode::constant)); }
|
bool isIndirectZero(void) const { return ((flags&(Varnode::indirect_creation|Varnode::constant))==(Varnode::indirect_creation|Varnode::constant)); }
|
||||||
|
@ -297,6 +299,7 @@ public:
|
||||||
void setUnsignedPrint(void) { addlflags |= Varnode::unsignedprint; } ///< Force \b this to be printed as unsigned
|
void setUnsignedPrint(void) { addlflags |= Varnode::unsignedprint; } ///< Force \b this to be printed as unsigned
|
||||||
bool updateType(Datatype *ct,bool lock,bool override); ///< (Possibly) set the Datatype given various restrictions
|
bool updateType(Datatype *ct,bool lock,bool override); ///< (Possibly) set the Datatype given various restrictions
|
||||||
void setStackStore(void) { addlflags |= Varnode::stack_store; } ///< Mark as produced by explicit CPUI_STORE
|
void setStackStore(void) { addlflags |= Varnode::stack_store; } ///< Mark as produced by explicit CPUI_STORE
|
||||||
|
void setLockedInput(void) { addlflags |= Varnode::locked_input; } ///< Mark as existing input, even if unused
|
||||||
void copySymbol(const Varnode *vn); ///< Copy symbol info from \b vn
|
void copySymbol(const Varnode *vn); ///< Copy symbol info from \b vn
|
||||||
void copySymbolIfValid(const Varnode *vn); ///< Copy symbol info from \b vn if constant value matches
|
void copySymbolIfValid(const Varnode *vn); ///< Copy symbol info from \b vn if constant value matches
|
||||||
Datatype *getLocalType(void) const; ///< Calculate type of Varnode based on local information
|
Datatype *getLocalType(void) const; ///< Calculate type of Varnode based on local information
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue