Package ghidra.program.util
Class SymbolicPropogator
- java.lang.Object
-
- ghidra.program.util.SymbolicPropogator
-
public class SymbolicPropogator extends java.lang.Object
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected classSymbolicPropogator.SavedFlowStateclassSymbolicPropogator.ValueValuecorresponds to a constant value or register relative value.
-
Field Summary
Fields Modifier and Type Field Description protected booleancanceledprotected booleanconflictprotected VarnodeContextcontextprotected booleandebugprotected ContextEvaluatorevaluatorprotected booleanhitCodeFlowprotected intlastFullHashCodeprotected intlastInstrCodeprotected static intMAX_EXACT_INSTRUCTIONSprotected java.util.List<AddressSpace>memorySpacesprotected Programprogramprotected ProgramContextprogramContextprotected booleanreadExecutableAddressprotected intsameInstrCountprotected ProgramContextsavedProgramContextprotected ProgramContextsavedSpaceContextprotected ProgramContextspaceContext
-
Constructor Summary
Constructors Constructor Description SymbolicPropogator(Program program)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanencounteredBranch()AddressSetflowConstants(Address fromAddr, Address startAddr, AddressSetView restrictSet, ContextEvaluator eval, VarnodeContext vContext, TaskMonitor monitor)AddressSetflowConstants(Address startAddr, AddressSetView restrictSet, ContextEvaluator eval, boolean saveContext, TaskMonitor monitor)Process a subroutine using the processor function.AddressSetflowConstants(Address startAddr, AddressSetView restrictSet, ContextEvaluator eval, VarnodeContext vContext, TaskMonitor monitor)SymbolicPropogator.ValuegetRegisterValue(Address toAddr, Register reg)Get constant or register relative value assigned to the specified register at the specified addressjava.lang.StringgetRegisterValueRepresentation(Address addr, Register reg)Do not depend on this method! For display debugging purposes only.voidmakeReference(VarnodeContext varnodeContext, Instruction instruction, int pcodeop, int opIndex, Varnode vt, RefType refType, TaskMonitor monitor)Make from the instruction to the reference based on the varnode passed in.voidmakeReference(VarnodeContext vContext, Instruction instruction, int opIndex, long knownSpaceID, long wordOffset, int size, RefType refType, int pcodeop, boolean knownReference, TaskMonitor monitor)Make a reference from the instruction to the address based on the spaceID,offset passed in.booleanreadExecutable()protected VarnodeContextsaveOffCurrentContext(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.voidsetDebug(boolean debug)voidsetParamRefCheck(boolean checkParamRefsOption)enable/disable checking parameters for constant referencesvoidsetRegister(Address addr, Register stackReg)voidsetReturnRefCheck(boolean checkReturnRefsOption)enable/disable checking return for constant referencesvoidsetStoredRefCheck(boolean checkStoredRefsOption)enable/disable checking stored values for constant references
-
-
-
Field Detail
-
memorySpaces
protected java.util.List<AddressSpace> memorySpaces
-
evaluator
protected ContextEvaluator evaluator
-
program
protected Program program
-
programContext
protected ProgramContext programContext
-
spaceContext
protected ProgramContext spaceContext
-
savedProgramContext
protected ProgramContext savedProgramContext
-
savedSpaceContext
protected ProgramContext savedSpaceContext
-
canceled
protected boolean canceled
-
readExecutableAddress
protected boolean readExecutableAddress
-
context
protected VarnodeContext context
-
conflict
protected boolean conflict
-
hitCodeFlow
protected boolean hitCodeFlow
-
debug
protected boolean debug
-
MAX_EXACT_INSTRUCTIONS
protected static final int MAX_EXACT_INSTRUCTIONS
- See Also:
- Constant Field Values
-
lastFullHashCode
protected int lastFullHashCode
-
lastInstrCode
protected int lastInstrCode
-
sameInstrCount
protected int sameInstrCount
-
-
Constructor Detail
-
SymbolicPropogator
public SymbolicPropogator(Program program)
-
-
Method Detail
-
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:
entryPoint- start addressprocessor- processor to use- Returns:
- the address set of instructions that were followed
- Throws:
CancelledException
-
saveOffCurrentContext
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.- Parameters:
startAddr-- Returns:
-
getRegisterValue
public SymbolicPropogator.Value getRegisterValue(Address toAddr, Register reg)
Get constant or register relative value assigned to the specified register at the specified address- Parameters:
addr- addressreg- register- Returns:
- register value
-
getRegisterValueRepresentation
public java.lang.String getRegisterValueRepresentation(Address addr, Register reg)
Do not depend on this method! For display debugging purposes only. This will change.- Parameters:
addr-reg-- Returns:
-
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 void makeReference(VarnodeContext varnodeContext, Instruction instruction, int pcodeop, int opIndex, Varnode vt, RefType refType, 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.pcodeop- - pcode op that caused the referenceopIndex- - operand it should be placed on, or -1 if unknownvt- - place to reference, could be a full address, or just a constantrefType- - type of referencemonitor-
-
makeReference
public void makeReference(VarnodeContext vContext, Instruction instruction, int opIndex, long knownSpaceID, long wordOffset, int size, RefType refType, int pcodeop, boolean knownReference, 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:
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 unknownspaceID- target space ID or -1 if only offset is knownwordOffset- - target offset that is word addressing basedrefType- - type of referencepcodeop- - pcode op that caused the referencemonitor-
-
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
-
setReturnRefCheck
public void setReturnRefCheck(boolean checkReturnRefsOption)
enable/disable checking return for constant references- Parameters:
checkReturnRefsOption-
-
setStoredRefCheck
public void setStoredRefCheck(boolean checkStoredRefsOption)
enable/disable checking stored values for constant references- Parameters:
checkStoredRefsOption-
-
-