Package ghidra.util.state
Class ContextState
- java.lang.Object
 - 
- ghidra.util.state.ContextState
 
 
- 
public class ContextState extends java.lang.Object 
- 
- 
Constructor Summary
Constructors Constructor Description ContextState(Address entryPt, Program program)Constructs an empty state.ContextState(Address entryPt, ProgramContext programCtx, Program program)Constructs an empty state.ContextState(SequenceNumber pcodeEntry, ContextState previousState)Derive a new context state from an initial state 
- 
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ContextStatebranchState(SequenceNumber pcodeEntry)Branch the current state.java.util.HashMap<java.lang.Long,Varnode>clearUniqueState()When done processing a particular instruction, this method should be invoked to clear any unique Varnode state.Varnodeget(int spaceID, Varnode offsetValue, int size)Retrieve the value/operation stored within the specified space using an offset identified by a value/operation.Varnodeget(int spaceID, Varnode offsetValue, int size, TaskMonitor monitor)Retrieve the value/operation stored within the specified space using an offset identified by a value/operation.Varnodeget(Varnode varnode)Retrieve the value/operation stored in the specified addressable location (address or register varnode).Varnodeget(Varnode varnode, TaskMonitor monitor)Retrieve the value/operation stored in the specified addressable location (address or register varnode).java.util.List<Register>getDifferingRegisters(ContextState other)SequenceNumbergetEntryPoint()Returns the point at which the state was instantiated.SequenceNumbergetExitPoint()java.util.Set<SequenceNumber>getFlowFroms()ContextStategetPreviousContextState()Returns previous ContextState which flowed into this one.ProgramgetProgram()Returns program associated with this context stateSequenceRangegetSequenceRange()booleanhasDifferingRegisters(ContextState other)booleanisFlowFrom(SequenceNumber seq)voidlock()When no longer updating this state, this method should be invoked to cleanup resources no longer needed (e.g., uniqueState no longer maintained).voidsetDebugVarnod(Varnode varnode)Set a varnode to be debugged.booleanstore(int spaceID, Varnode offsetValue, Varnode storedValue, int size)voidstore(Varnode addressVarnode, Varnode storedValue)Store a value. 
 - 
 
- 
- 
Constructor Detail
- 
ContextState
public ContextState(Address entryPt, Program program)
Constructs an empty state.- Parameters:
 entryPt- the entry point for the context stateprogram- the program
 
- 
ContextState
public ContextState(Address entryPt, ProgramContext programCtx, Program program)
Constructs an empty state.- Parameters:
 entryPt- the entry point for the context stateprogramCtx- initial program context or nullprogram- the program
 
- 
ContextState
public ContextState(SequenceNumber pcodeEntry, ContextState previousState)
Derive a new context state from an initial state- Parameters:
 pcodeEntry- the pcode entry sequence numberpreviousState- previous context state flowing into the specified pcode location
 
 - 
 
- 
Method Detail
- 
getProgram
public Program getProgram()
Returns program associated with this context state 
- 
getPreviousContextState
public ContextState getPreviousContextState()
Returns previous ContextState which flowed into this one. 
- 
isFlowFrom
public boolean isFlowFrom(SequenceNumber seq)
 
- 
getFlowFroms
public java.util.Set<SequenceNumber> getFlowFroms()
 
- 
getExitPoint
public SequenceNumber getExitPoint()
 
- 
getSequenceRange
public SequenceRange getSequenceRange()
 
- 
setDebugVarnod
public void setDebugVarnod(Varnode varnode)
Set a varnode to be debugged. This will be passed to any states derived from this state.- Parameters:
 varnode- varnode to be debugged
 
- 
branchState
public ContextState branchState(SequenceNumber pcodeEntry)
Branch the current state. The current state should be associated with branch target, the returned state should be used for the fall-through flow.- Returns:
 
 
- 
getEntryPoint
public SequenceNumber getEntryPoint()
Returns the point at which the state was instantiated. 
- 
clearUniqueState
public java.util.HashMap<java.lang.Long,Varnode> clearUniqueState()
When done processing a particular instruction, this method should be invoked to clear any unique Varnode state.- Returns:
 - previous unique state
 
 
- 
lock
public void lock()
When no longer updating this state, this method should be invoked to cleanup resources no longer needed (e.g., uniqueState no longer maintained). 
- 
store
public void store(Varnode addressVarnode, Varnode storedValue)
Store a value. Unique varnodes not permitted once locked.- Parameters:
 addressVarnode- identifies storage (address, register or unique)storedValue- constant or OperationVarnode
 
- 
get
public Varnode get(int spaceID, Varnode offsetValue, int size)
Retrieve the value/operation stored within the specified space using an offset identified by a value/operation.- Parameters:
 spaceID-offsetValue-size-- Returns:
 - stored value/operation or null or DUMMY_BYTE_VARNODE
 
 
- 
get
public Varnode get(int spaceID, Varnode offsetValue, int size, TaskMonitor monitor) throws CancelledException
Retrieve the value/operation stored within the specified space using an offset identified by a value/operation.- Parameters:
 spaceID-offsetValue-size-- Returns:
 - stored value/operation or null or DUMMY_BYTE_VARNODE
 - Throws:
 CancelledException
 
- 
get
public Varnode get(Varnode varnode)
Retrieve the value/operation stored in the specified addressable location (address or register varnode). If varnode is a constant, the input argument will be returned. Unique varnodes not permitted once locked.- Parameters:
 varnode- identifies constant or storage (constant, address, register or unique), if VarnodeOperation specified null will always be returned.- Returns:
 - stored value/operation
 
 
- 
get
public Varnode get(Varnode varnode, TaskMonitor monitor) throws CancelledException
Retrieve the value/operation stored in the specified addressable location (address or register varnode). If varnode is a constant, the input argument will be returned. Unique varnodes not permitted once locked.- Parameters:
 varnode- identifies constant or storage (constant, address, register or unique), if VarnodeOperation specified null will always be returned.- Returns:
 - stored value/operation
 - Throws:
 CancelledException
 
- 
getDifferingRegisters
public java.util.List<Register> getDifferingRegisters(ContextState other)
 
- 
hasDifferingRegisters
public boolean hasDifferingRegisters(ContextState other)
 
 - 
 
 -