Class ContextState

java.lang.Object
ghidra.util.state.ContextState

public class ContextState extends Object
  • Constructor Details

    • ContextState

      public ContextState(Address entryPt, Program program)
      Constructs an empty state.
      Parameters:
      entryPt - the entry point for the context state
      program - the program
    • ContextState

      public ContextState(Address entryPt, ProgramContext programCtx, Program program)
      Constructs an empty state.
      Parameters:
      entryPt - the entry point for the context state
      programCtx - initial program context or null
      program - the program
    • ContextState

      public ContextState(SequenceNumber pcodeEntry, ContextState previousState)
      Derive a new context state from an initial state
      Parameters:
      pcodeEntry - the pcode entry sequence number
      previousState - previous context state flowing into the specified pcode location
  • Method Details

    • 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 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 HashMap<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 boolean store(int spaceID, Varnode offsetValue, Varnode storedValue, int size)
    • 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 List<Register> getDifferingRegisters(ContextState other)
    • hasDifferingRegisters

      public boolean hasDifferingRegisters(ContextState other)