mirror of
https://github.com/NationalSecurityAgency/ghidra.git
synced 2025-10-03 17:59:46 +02:00
Fix for NEW operator
This commit is contained in:
parent
14d7bd2b1f
commit
e47fa51518
4 changed files with 11 additions and 8 deletions
|
@ -3425,11 +3425,11 @@ int4 ActionDeadCode::apply(Funcdata &data)
|
||||||
|
|
||||||
op->clearIndirectSource();
|
op->clearIndirectSource();
|
||||||
if (op->isCall()) {
|
if (op->isCall()) {
|
||||||
if (op->code() == CPUI_CALLOTHER) {
|
// Postpone setting consumption on CALL and CALLIND inputs
|
||||||
|
if (op->isCallWithoutSpec()) {
|
||||||
for(i=0;i<op->numInput();++i)
|
for(i=0;i<op->numInput();++i)
|
||||||
pushConsumed(~((uintb)0),op->getIn(i),worklist);
|
pushConsumed(~((uintb)0),op->getIn(i),worklist);
|
||||||
}
|
}
|
||||||
// Postpone setting consumption on CALL and CALLIND inputs
|
|
||||||
if (!op->isAssignment())
|
if (!op->isAssignment())
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
|
@ -433,7 +433,7 @@ public:
|
||||||
void opMarkNonPrinting(PcodeOp *op) { op->setFlag(PcodeOp::nonprinting); } ///< Mark PcodeOp as not being printed
|
void opMarkNonPrinting(PcodeOp *op) { op->setFlag(PcodeOp::nonprinting); } ///< Mark PcodeOp as not being printed
|
||||||
void opMarkSpecialPrint(PcodeOp *op) { op->setAdditionalFlag(PcodeOp::special_print); } ///< Mark PcodeOp as needing special printing
|
void opMarkSpecialPrint(PcodeOp *op) { op->setAdditionalFlag(PcodeOp::special_print); } ///< Mark PcodeOp as needing special printing
|
||||||
void opMarkNoCollapse(PcodeOp *op) { op->setFlag(PcodeOp::nocollapse); } ///< Mark PcodeOp as not collapsible
|
void opMarkNoCollapse(PcodeOp *op) { op->setFlag(PcodeOp::nocollapse); } ///< Mark PcodeOp as not collapsible
|
||||||
void opMarkCpoolTransformed(PcodeOp *op) { op->setFlag(PcodeOp::is_cpool_transformed); } ///< Mark cpool record was visited
|
void opMarkCpoolTransformed(PcodeOp *op) { op->setAdditionalFlag(PcodeOp::is_cpool_transformed); } ///< Mark cpool record was visited
|
||||||
void opMarkCalculatedBool(PcodeOp *op) { op->setFlag(PcodeOp::calculated_bool); } ///< Mark PcodeOp as having boolean output
|
void opMarkCalculatedBool(PcodeOp *op) { op->setFlag(PcodeOp::calculated_bool); } ///< Mark PcodeOp as having boolean output
|
||||||
void opMarkSpacebasePtr(PcodeOp *op) { op->setFlag(PcodeOp::spacebase_ptr); } ///< Mark PcodeOp as LOAD/STORE from spacebase ptr
|
void opMarkSpacebasePtr(PcodeOp *op) { op->setFlag(PcodeOp::spacebase_ptr); } ///< Mark PcodeOp as LOAD/STORE from spacebase ptr
|
||||||
void opClearSpacebasePtr(PcodeOp *op) { op->clearFlag(PcodeOp::spacebase_ptr); } ///< Unmark PcodeOp as using spacebase ptr
|
void opClearSpacebasePtr(PcodeOp *op) { op->clearFlag(PcodeOp::spacebase_ptr); } ///< Unmark PcodeOp as using spacebase ptr
|
||||||
|
|
|
@ -95,7 +95,7 @@ public:
|
||||||
spacebase_ptr = 0x4000000, ///< Loads or stores from a dynamic pointer into a spacebase
|
spacebase_ptr = 0x4000000, ///< Loads or stores from a dynamic pointer into a spacebase
|
||||||
indirect_creation = 0x8000000, ///< Output varnode is created by indirect effect
|
indirect_creation = 0x8000000, ///< Output varnode is created by indirect effect
|
||||||
calculated_bool = 0x10000000, ///< Output has been determined to be a 1-bit boolean value
|
calculated_bool = 0x10000000, ///< Output has been determined to be a 1-bit boolean value
|
||||||
is_cpool_transformed = 0x20000000, ///< Have we checked for cpool transforms
|
has_callspec = 0x20000000, ///< Op has a call specification associated with it
|
||||||
ptrflow = 0x40000000, ///< Op consumes or produces a ptr
|
ptrflow = 0x40000000, ///< Op consumes or produces a ptr
|
||||||
indirect_store = 0x80000000 ///< CPUI_INDIRECT is caused by CPUI_STORE
|
indirect_store = 0x80000000 ///< CPUI_INDIRECT is caused by CPUI_STORE
|
||||||
};
|
};
|
||||||
|
@ -107,7 +107,8 @@ public:
|
||||||
special_print = 0x10, ///< Op is marked for special printing
|
special_print = 0x10, ///< Op is marked for special printing
|
||||||
modified = 0x20, ///< This op has been modified by the current action
|
modified = 0x20, ///< This op has been modified by the current action
|
||||||
warning = 0x40, ///< Warning has been generated for this op
|
warning = 0x40, ///< Warning has been generated for this op
|
||||||
incidental_copy = 0x80 ///< Treat this as \e incidental for parameter recovery algorithms
|
incidental_copy = 0x80, ///< Treat this as \e incidental for parameter recovery algorithms
|
||||||
|
is_cpool_transformed = 0x100 ///< Have we checked for cpool transforms
|
||||||
};
|
};
|
||||||
private:
|
private:
|
||||||
TypeOp *opcode; ///< Pointer to class providing behavioral details of the operation
|
TypeOp *opcode; ///< Pointer to class providing behavioral details of the operation
|
||||||
|
@ -164,6 +165,8 @@ public:
|
||||||
bool isDead(void) const { return ((flags&PcodeOp::dead)!=0); } ///< Return \b true if this op is dead
|
bool isDead(void) const { return ((flags&PcodeOp::dead)!=0); } ///< Return \b true if this op is dead
|
||||||
bool isAssignment(void) const { return (output!=(Varnode *)0); } ///< Return \b true is this op has an output
|
bool isAssignment(void) const { return (output!=(Varnode *)0); } ///< Return \b true is this op has an output
|
||||||
bool isCall(void) const { return ((flags&PcodeOp::call)!=0); } ///< Return \b true if this op indicates call semantics
|
bool isCall(void) const { return ((flags&PcodeOp::call)!=0); } ///< Return \b true if this op indicates call semantics
|
||||||
|
/// \brief Return \b true if this op acts as call but does not have a full specification
|
||||||
|
bool isCallWithoutSpec(void) const { return ((flags&(PcodeOp::call|PcodeOp::has_callspec))==PcodeOp::call); }
|
||||||
bool isMarker(void) const { return ((flags&PcodeOp::marker)!=0); } ///< Return \b true is a special SSA form op
|
bool isMarker(void) const { return ((flags&PcodeOp::marker)!=0); } ///< Return \b true is a special SSA form op
|
||||||
bool isIndirectCreation(void) const { return ((flags&PcodeOp::indirect_creation)!=0); } ///< Return \b true if op creates a varnode indirectly
|
bool isIndirectCreation(void) const { return ((flags&PcodeOp::indirect_creation)!=0); } ///< Return \b true if op creates a varnode indirectly
|
||||||
bool isIndirectStore(void) const { return ((flags&PcodeOp::indirect_store)!=0); } ///< Return \b true if \b this INDIRECT is caused by STORE
|
bool isIndirectStore(void) const { return ((flags&PcodeOp::indirect_store)!=0); } ///< Return \b true if \b this INDIRECT is caused by STORE
|
||||||
|
@ -203,7 +206,7 @@ public:
|
||||||
/// \brief Return \b true if output is 1-bit boolean
|
/// \brief Return \b true if output is 1-bit boolean
|
||||||
bool isCalculatedBool(void) const { return ((flags&(PcodeOp::calculated_bool|PcodeOp::booloutput))!=0); }
|
bool isCalculatedBool(void) const { return ((flags&(PcodeOp::calculated_bool|PcodeOp::booloutput))!=0); }
|
||||||
/// \brief Return \b true if we have already examined this cpool
|
/// \brief Return \b true if we have already examined this cpool
|
||||||
bool isCpoolTransformed(void) const { return ((flags&PcodeOp::is_cpool_transformed)!=0); }
|
bool isCpoolTransformed(void) const { return ((addlflags&PcodeOp::is_cpool_transformed)!=0); }
|
||||||
bool isCollapsible(void) const; ///< Return \b true if this can be collapsed to a COPY of a constant
|
bool isCollapsible(void) const; ///< Return \b true if this can be collapsed to a COPY of a constant
|
||||||
/// \brief Return \b true if this LOADs or STOREs from a dynamic \e spacebase pointer
|
/// \brief Return \b true if this LOADs or STOREs from a dynamic \e spacebase pointer
|
||||||
bool usesSpacebasePtr(void) const { return ((flags&PcodeOp::spacebase_ptr)!=0); }
|
bool usesSpacebasePtr(void) const { return ((flags&PcodeOp::spacebase_ptr)!=0); }
|
||||||
|
|
|
@ -537,7 +537,7 @@ void TypeOpBranchind::printRaw(ostream &s,const PcodeOp *op)
|
||||||
TypeOpCall::TypeOpCall(TypeFactory *t) : TypeOp(t,CPUI_CALL,"call")
|
TypeOpCall::TypeOpCall(TypeFactory *t) : TypeOp(t,CPUI_CALL,"call")
|
||||||
|
|
||||||
{
|
{
|
||||||
opflags = (PcodeOp::special|PcodeOp::call|PcodeOp::coderef|PcodeOp::nocollapse);
|
opflags = (PcodeOp::special|PcodeOp::call|PcodeOp::has_callspec|PcodeOp::coderef|PcodeOp::nocollapse);
|
||||||
behave = new OpBehavior(CPUI_CALL,false,true); // Dummy behavior
|
behave = new OpBehavior(CPUI_CALL,false,true); // Dummy behavior
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -610,7 +610,7 @@ Datatype *TypeOpCall::getOutputLocal(const PcodeOp *op) const
|
||||||
TypeOpCallind::TypeOpCallind(TypeFactory *t) : TypeOp(t,CPUI_CALLIND,"callind")
|
TypeOpCallind::TypeOpCallind(TypeFactory *t) : TypeOp(t,CPUI_CALLIND,"callind")
|
||||||
|
|
||||||
{
|
{
|
||||||
opflags = PcodeOp::special|PcodeOp::call|PcodeOp::nocollapse;
|
opflags = PcodeOp::special|PcodeOp::call|PcodeOp::has_callspec|PcodeOp::nocollapse;
|
||||||
behave = new OpBehavior(CPUI_CALLIND,false,true); // Dummy behavior
|
behave = new OpBehavior(CPUI_CALLIND,false,true); // Dummy behavior
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue