Class ContextState


  • public class ContextState
    extends java.lang.Object
    • Constructor Detail

      • ContextState

        public ContextState​(Address entryPt,
                            Program program)
        Constructs an empty state.
        Parameters:
        pcodeEntry - instruction identifies the instruction entry point for this context state. A pcodeIndex of 0 is assumed. Initial state utilizes the program's stored context.
        program -
      • ContextState

        public ContextState​(Address entryPt,
                            ProgramContext programCtx,
                            Program program)
        Constructs an empty state.
        Parameters:
        pcodeEntry - instruction identifies the instruction entry point for this context state. A pcodeIndex of 0 is assumed.
        programCtx - initial program context or null
        program -
      • ContextState

        public ContextState​(SequenceNumber pcodeEntry,
                            ContextState previousState)
        Derive a new context state from an initial state
        Parameters:
        instructionAddr - instruction identifies the instruction entry point for this context state.
        pcodeIndex - pcode identifies the pcode entry point for this context state.
        previousState - 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.
      • 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 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 java.util.List<Register> getDifferingRegisters​(ContextState other)
      • hasDifferingRegisters

        public boolean hasDifferingRegisters​(ContextState other)