Class AbstractPcodeExecutorState<A,T>

java.lang.Object
ghidra.pcode.exec.AbstractPcodeExecutorState<A,T>
All Implemented Interfaces:
PcodeExecutorState<T>, PcodeExecutorStatePiece<T,T>
Direct Known Subclasses:
DebuggerPcodeUtils.WatchValuePcodeExecutorState, DefaultPcodeExecutorState

public abstract class AbstractPcodeExecutorState<A,T> extends Object implements PcodeExecutorState<T>
  • Field Details

  • Constructor Details

  • Method Details

    • getLanguage

      public Language getLanguage()
      Description copied from interface: PcodeExecutorStatePiece
      Get the language defining the address spaces of this state piece
      Specified by:
      getLanguage in interface PcodeExecutorStatePiece<A,T>
      Returns:
      the language
    • getArithmetic

      public PcodeArithmetic<T> getArithmetic()
      Description copied from interface: PcodeExecutorStatePiece
      Get the arithmetic used to manipulate values of the type stored by this state
      Specified by:
      getArithmetic in interface PcodeExecutorStatePiece<A,T>
      Returns:
      the arithmetic
    • streamPieces

      public Stream<PcodeExecutorStatePiece<?,?>> streamPieces()
      Description copied from interface: PcodeExecutorStatePiece
      Stream over the pieces within.

      If this piece is not a composition of others, then simply stream this piece in a singleton. Otherwise, stream the component pieces. (Do not include the composition itself, just the component pieces.)

      Specified by:
      streamPieces in interface PcodeExecutorStatePiece<A,T>
      Returns:
      the stream
    • extractAddress

      protected abstract A extractAddress(T value)
    • getVar

      public T getVar(AddressSpace space, T offset, int size, boolean quantize, PcodeExecutorStatePiece.Reason reason)
      Description copied from interface: PcodeExecutorStatePiece
      Get the value of a variable
      Specified by:
      getVar in interface PcodeExecutorStatePiece<A,T>
      Parameters:
      space - the address space
      offset - the offset within the space
      size - the size of the variable
      quantize - true to quantize to the language's "addressable unit"
      reason - the reason for reading the variable
      Returns:
      the value
    • getVarInternal

      public T getVarInternal(AddressSpace space, T offset, int size, PcodeExecutorStatePiece.Reason reason)
      Description copied from interface: PcodeExecutorStatePiece
      Get the value of a variable without issuing callbacks
      Specified by:
      getVarInternal in interface PcodeExecutorStatePiece<A,T>
      Parameters:
      space - the address space
      offset - the offset within the space
      size - the size of the variable
      reason - the reason for reading the variable
      Returns:
      the value
    • getVar

      public T getVar(AddressSpace space, long offset, int size, boolean quantize, PcodeExecutorStatePiece.Reason reason)
      Description copied from interface: PcodeExecutorStatePiece
      Get the value of a variable

      This method is typically used for reading memory variables.

      Specified by:
      getVar in interface PcodeExecutorStatePiece<A,T>
      Parameters:
      space - the address space
      offset - the offset within the space
      size - the size of the variable
      quantize - true to quantize to the language's "addressable unit"
      reason - the reason for reading the variable
      Returns:
      the value
    • getVarInternal

      public T getVarInternal(AddressSpace space, long offset, int size, PcodeExecutorStatePiece.Reason reason)
      Description copied from interface: PcodeExecutorStatePiece
      Get the value of a variable without issuing callbacks
      Specified by:
      getVarInternal in interface PcodeExecutorStatePiece<A,T>
      Parameters:
      space - the address space
      offset - the offset within the space
      size - the size of the variable
      reason - the reason for reading the variable
      Returns:
      the value
    • setVar

      public void setVar(AddressSpace space, T offset, int size, boolean quantize, T val)
      Description copied from interface: PcodeExecutorStatePiece
      Set the value of a variable
      Specified by:
      setVar in interface PcodeExecutorStatePiece<A,T>
      Parameters:
      space - the address space
      offset - the offset within the space
      size - the size of the variable
      quantize - true to quantize to the language's "addressable unit"
      val - the value
    • setVarInternal

      public void setVarInternal(AddressSpace space, T offset, int size, T val)
      Description copied from interface: PcodeExecutorStatePiece
      Set the value of a variable without issuing callbacks
      Specified by:
      setVarInternal in interface PcodeExecutorStatePiece<A,T>
      Parameters:
      space - the address space
      offset - the offset within the space
      size - the size of the variable
      val - the value
    • setVar

      public void setVar(AddressSpace space, long offset, int size, boolean quantize, T val)
      Description copied from interface: PcodeExecutorStatePiece
      Set the value of a variable
      Specified by:
      setVar in interface PcodeExecutorStatePiece<A,T>
      Parameters:
      space - the address space
      offset - the offset within the space
      size - the size of the variable
      quantize - true to quantize to the language's "addressable unit"
      val - the value
    • setVarInternal

      public void setVarInternal(AddressSpace space, long offset, int size, T val)
      Description copied from interface: PcodeExecutorStatePiece
      Set the value of a variable without issuing callbacks
      Specified by:
      setVarInternal in interface PcodeExecutorStatePiece<A,T>
      Parameters:
      space - the address space
      offset - the offset within the space
      size - the size of the variable
      val - the value
    • getRegisterValues

      public Map<Register,T> getRegisterValues()
      Description copied from interface: PcodeExecutorStatePiece
      Get all register values known to this state

      When the state acts as a cache, it should only return those cached.

      Specified by:
      getRegisterValues in interface PcodeExecutorStatePiece<A,T>
      Returns:
      a map of registers and their values
    • getConcreteBuffer

      public MemBuffer getConcreteBuffer(Address address, PcodeArithmetic.Purpose purpose)
      Description copied from interface: PcodeExecutorStatePiece
      Bind a buffer of concrete bytes at the given start address
      Specified by:
      getConcreteBuffer in interface PcodeExecutorStatePiece<A,T>
      Parameters:
      address - the start address
      purpose - the reason why the emulator needs a concrete value
      Returns:
      a buffer
    • clear

      public void clear()
      Description copied from interface: PcodeExecutorStatePiece
      Erase the entire state or piece

      This is generally only useful when the state is itself a cache to another object. This will ensure the state is reading from that object rather than a stale cache. If this is not a cache, this could in fact clear the whole state, and the machine using it will be left in the dark.

      Specified by:
      clear in interface PcodeExecutorStatePiece<A,T>
    • getNextEntryInternal NEW

      public Map.Entry<Long,T> getNextEntryInternal(AddressSpace space, long offset)
      Description copied from interface: PcodeExecutorStatePiece
      Get the entry at a given offset (without issuing callbacks)

      (Optional operation) For pieces where each value is effective over a range, it is common to use an internal map (vice a byte array). When serializing the state, or otherwise seeking a complete examination, it is useful to retrieve those internal entries. This returns the next entry at or after the given offset within the given space. NOTE the returned entry must be for the given space. If no such entry exists, return null.

      Specified by:
      getNextEntryInternal in interface PcodeExecutorStatePiece<A,T>
      Parameters:
      space - the address space
      offset - the offset within the space
      Returns:
      the entry or null