Package ghidra.program.util
Class SymbolicPropogator
java.lang.Object
ghidra.program.util.SymbolicPropogator
-
Nested Class Summary
Modifier and TypeClassDescriptionprotected class
class
Value
corresponds to a constant value or register relative value. -
Field Summary
Modifier and TypeFieldDescriptionprotected boolean
protected VarnodeContext
protected boolean
protected ContextEvaluator
protected boolean
protected int
protected int
protected static final int
protected List
<AddressSpace> protected Program
protected ProgramContext
protected boolean
protected int
protected ProgramContext
protected ProgramContext
protected ProgramContext
protected AddressSet
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionboolean
flowConstants
(Address fromAddr, Address startAddr, AddressSetView restrictSet, ContextEvaluator eval, VarnodeContext vContext, TaskMonitor monitor) flowConstants
(Address startAddr, AddressSetView restrictSet, ContextEvaluator eval, boolean saveContext, TaskMonitor monitor) Process a subroutine using the processor function.flowConstants
(Address startAddr, AddressSetView restrictSet, ContextEvaluator eval, VarnodeContext vContext, TaskMonitor monitor) getRegisterValue
(Address toAddr, Register reg) Get constant or register relative value assigned to the specified register at the specified addressgetRegisterValueRepresentation
(Address addr, Register reg) Do not depend on this method! For display debugging purposes only.makeReference
(VarnodeContext vContext, Instruction instruction, int opIndex, long knownSpaceID, long wordOffset, int size, DataType dataType, RefType refType, int pcodeop, boolean knownReference, boolean preExisting, TaskMonitor monitor) Make a reference from the instruction to the address based on the spaceID,offset passed in.makeReference
(VarnodeContext varnodeContext, Instruction instruction, int opIndex, Varnode vt, DataType dataType, RefType refType, int pcodeop, boolean knownReference, TaskMonitor monitor) Make from the instruction to the reference based on the varnode passed in.boolean
protected VarnodeContext
saveOffCurrentContext
(Address startAddr) Save off the current context and set the current context to a copy This is done so that the values in the context are not changed, but can be used for computation.void
setDebug
(boolean debug) void
setParamPointerRefCheck
(boolean checkParamRefsOption) enable/disable creating param references for constants only if the function parameter is specified as a known pointervoid
setParamRefCheck
(boolean checkParamRefsOption) enable/disable checking parameters for constant referencesvoid
setRegister
(Address addr, Register stackReg) void
setReturnRefCheck
(boolean checkReturnRefsOption) enable/disable checking return for constant referencesvoid
setStoredRefCheck
(boolean checkStoredRefsOption) enable/disable checking stored values for constant references
-
Field Details
-
memorySpaces
-
evaluator
-
program
-
programContext
-
spaceContext
-
savedProgramContext
-
savedSpaceContext
-
canceled
protected boolean canceled -
readExecutableAddress
protected boolean readExecutableAddress -
context
-
visitedBody
-
hitCodeFlow
protected boolean hitCodeFlow -
debug
protected boolean debug -
MAX_EXACT_INSTRUCTIONS
protected static final int MAX_EXACT_INSTRUCTIONS- See Also:
-
lastFullHashCode
protected int lastFullHashCode -
lastInstrCode
protected int lastInstrCode -
sameInstrCount
protected int sameInstrCount
-
-
Constructor Details
-
SymbolicPropogator
-
-
Method Details
-
setDebug
public void setDebug(boolean debug) -
flowConstants
public AddressSet flowConstants(Address startAddr, AddressSetView restrictSet, ContextEvaluator eval, boolean saveContext, TaskMonitor monitor) throws CancelledException Process a subroutine using the processor function. The process function can control what flows are followed and when to stop.- Parameters:
startAddr
- start addressrestrictSet
- the address set to restrict the constant flow toeval
- the context evaluator to usesaveContext
- true if the context should be savedmonitor
- the task monitor- Returns:
- the address set of instructions that were followed
- Throws:
CancelledException
- if the task is cancelled
-
saveOffCurrentContext
Save off the current context and set the current context to a copy This is done so that the values in the context are not changed, but can be used for computation.- Parameters:
startAddr
-- Returns:
-
getRegisterValue
Get constant or register relative value assigned to the specified register at the specified address- Parameters:
toAddr
- addressreg
- register- Returns:
- register value
-
getRegisterValueRepresentation
Do not depend on this method! For display debugging purposes only. This will change.- Parameters:
addr
-reg
-- Returns:
-
setRegister
-
flowConstants
public AddressSet flowConstants(Address startAddr, AddressSetView restrictSet, ContextEvaluator eval, VarnodeContext vContext, TaskMonitor monitor) throws CancelledException - Throws:
CancelledException
-
flowConstants
public AddressSet flowConstants(Address fromAddr, Address startAddr, AddressSetView restrictSet, ContextEvaluator eval, VarnodeContext vContext, TaskMonitor monitor) throws CancelledException - Throws:
CancelledException
-
makeReference
public Address makeReference(VarnodeContext varnodeContext, Instruction instruction, int opIndex, Varnode vt, DataType dataType, RefType refType, int pcodeop, boolean knownReference, TaskMonitor monitor) Make from the instruction to the reference based on the varnode passed in.- Parameters:
varnodeContext
- - context to use for any other infomation neededinstruction
- - instruction to place the reference on.opIndex
- - operand it should be placed on, or -1 if unknownvt
- - place to reference, could be a full address, or just a constantrefType
- - type of referencepcodeop
- - pcode op that caused the referenceknownReference
- true if this is a know good address, speculative otherwisemonitor
- to cancel- Returns:
- address that was marked up, null otherwise
-
makeReference
public Address makeReference(VarnodeContext vContext, Instruction instruction, int opIndex, long knownSpaceID, long wordOffset, int size, DataType dataType, RefType refType, int pcodeop, boolean knownReference, boolean preExisting, TaskMonitor monitor) Make a reference from the instruction to the address based on the spaceID,offset passed in. This could make a reference into an overlay (overriding the spaceID), or into memory, if spaceID is a constant space. The target could be an external Address carried along and then finally used. External addresses are OK as long as nothing is done to the offset.- Parameters:
vContext
- - context to use for any other information neededinstruction
- - instruction to place the reference on.opIndex
- - operand it should be placed on, or -1 if unknownknownSpaceID
- target space ID or -1 if only offset is knownwordOffset
- - target offset that is word addressing basedsize
- - size of the access to the locationrefType
- - type of referencepcodeop
- - op that caused the referenceknownReference
- - true if reference is known to be a real reference, not speculativepreExisting
- preExisting referencemonitor
- - the task monitor- Returns:
- address that was marked up, null otherwise
-
encounteredBranch
public boolean encounteredBranch()- Returns:
- true if any branching instructions have been encountered
-
readExecutable
public boolean readExecutable()- Returns:
- return true if the code ever read from an executable location
-
setParamRefCheck
public void setParamRefCheck(boolean checkParamRefsOption) enable/disable checking parameters for constant references- Parameters:
checkParamRefsOption
- true to enable
-
setParamPointerRefCheck
public void setParamPointerRefCheck(boolean checkParamRefsOption) enable/disable creating param references for constants only if the function parameter is specified as a known pointer- Parameters:
checkParamRefsOption
- true to enable
-
setReturnRefCheck
public void setReturnRefCheck(boolean checkReturnRefsOption) enable/disable checking return for constant references- Parameters:
checkReturnRefsOption
- true if enable check return for constant references
-
setStoredRefCheck
public void setStoredRefCheck(boolean checkStoredRefsOption) enable/disable checking stored values for constant references- Parameters:
checkStoredRefsOption
- true if enable check for stored values for constant references
-