Interface MemoryAdapter

All Superinterfaces:
AddressSetView, Iterable<AddressRange>, Memory
All Known Implementing Classes:
AbstractDBTraceProgramViewMemory, DBTraceProgramViewMemory

public interface MemoryAdapter extends Memory
  • Method Details

    • mustRead

      default ByteBuffer mustRead(Address addr, int length, boolean bigEndian) throws MemoryAccessException
      Throws:
      MemoryAccessException
    • getBytes

      default int getBytes(Address addr, byte[] dest) throws MemoryAccessException
      Description copied from interface: Memory
      Get dest.length number of bytes starting at the given address.
      Specified by:
      getBytes in interface Memory
      Parameters:
      addr - the starting Address.
      dest - the byte array to populate.
      Returns:
      the number of bytes put into dest. May be less than dest.length if the requested number extends beyond available memory.
      Throws:
      MemoryAccessException - if the starting address is not contained in any memory block.
    • getByte

      default byte getByte(Address addr) throws MemoryAccessException
      Description copied from interface: Memory
      Get byte at addr.
      Specified by:
      getByte in interface Memory
      Parameters:
      addr - the Address of the byte.
      Returns:
      the byte.
      Throws:
      MemoryAccessException - if the address is not contained in any memory block.
    • getShort

      default short getShort(Address addr) throws MemoryAccessException
      Description copied from interface: Memory
      Get the short at addr.
      Specified by:
      getShort in interface Memory
      Parameters:
      addr - the Address where the short starts.
      Returns:
      the short.
      Throws:
      MemoryAccessException - if not all needed bytes are contained in initialized memory.
    • getShort

      default short getShort(Address addr, boolean bigEndian) throws MemoryAccessException
      Description copied from interface: Memory
      Get the short at addr using the specified endian order.
      Specified by:
      getShort in interface Memory
      Parameters:
      addr - the Address where the short starts.
      bigEndian - true means to get the short in bigEndian order
      Returns:
      the short.
      Throws:
      MemoryAccessException - if not all needed bytes are contained in initialized memory.
    • getShorts

      default int getShorts(Address addr, short[] dest) throws MemoryAccessException
      Description copied from interface: Memory
      Get dest.length number of shorts starting at the given address.
      Specified by:
      getShorts in interface Memory
      Parameters:
      addr - the starting Address.
      dest - the short array to populate.
      Returns:
      the number of shorts put into dest. May be less than dest.length if the requested number extends beyond available memory. If the number of retrievable bytes is odd, the final byte will be discarded.
      Throws:
      MemoryAccessException - if not all needed bytes are contained in initialized memory.
    • getShorts

      default int getShorts(Address addr, short[] dest, int dIndex, int nElem) throws MemoryAccessException
      Description copied from interface: Memory
      Get dest.length number of shorts starting at the given address.
      Specified by:
      getShorts in interface Memory
      Parameters:
      addr - the starting Address.
      dest - the short array to populate.
      dIndex - the offset into dest to place the shorts.
      nElem - the number of shorts to get.
      Returns:
      the number of shorts put into dest. May be less than dest.length if the requested number extends beyond available memory. If the number of retrievable bytes is odd, the final byte will be discarded.
      Throws:
      MemoryAccessException - if not all needed bytes are contained in initialized memory.
    • getShorts

      default int getShorts(Address addr, short[] dest, int dIndex, int nElem, boolean bigEndian) throws MemoryAccessException
      Description copied from interface: Memory
      Get dest.length number of shorts starting at the given address.
      Specified by:
      getShorts in interface Memory
      Parameters:
      addr - the starting Address.
      dest - the short array to populate.
      dIndex - the offset into dest to place the shorts.
      nElem - the number of shorts to get.
      bigEndian - true means to get the shorts in bigEndian order
      Returns:
      the number of shorts put into dest. May be less than dest.length if the requested number extends beyond available memory. If the number of retrievable bytes is odd, the final byte will be discarded.
      Throws:
      MemoryAccessException - if not all needed bytes are contained in initialized memory.
    • getInt

      default int getInt(Address addr) throws MemoryAccessException
      Description copied from interface: Memory
      Get the int at addr.
      Specified by:
      getInt in interface Memory
      Parameters:
      addr - the Address where the int starts.
      Returns:
      the int.
      Throws:
      MemoryAccessException - if not all needed bytes are contained in initialized memory.
    • getInt

      default int getInt(Address addr, boolean bigEndian) throws MemoryAccessException
      Description copied from interface: Memory
      Get the int at addr using the specified endian order.
      Specified by:
      getInt in interface Memory
      Parameters:
      addr - the Address where the int starts.
      bigEndian - true means to get the int in big endian order
      Returns:
      the int.
      Throws:
      MemoryAccessException - if not all needed bytes are contained in initialized memory.
    • getInts

      default int getInts(Address addr, int[] dest) throws MemoryAccessException
      Description copied from interface: Memory
      Get dest.length number of ints starting at the given address.
      Specified by:
      getInts in interface Memory
      Parameters:
      addr - the starting Address.
      dest - the int array to populate.
      Returns:
      the number of ints put into dest. May be less than dest.length if the requested number extends beyond available memory. If the number of retrievable bytes is not 0 mod 4, the final byte(s) will be discarded.
      Throws:
      MemoryAccessException - if the starting address is not contained in any memory block.
    • getInts

      default int getInts(Address addr, int[] dest, int dIndex, int nElem) throws MemoryAccessException
      Description copied from interface: Memory
      Get dest.length number of ints starting at the given address.
      Specified by:
      getInts in interface Memory
      Parameters:
      addr - the starting Address.
      dest - the int array to populate.
      dIndex - the offset into dest to place the ints.
      nElem - the number of ints to get.
      Returns:
      the number of ints put into dest. May be less than dest.length if the requested number extends beyond available memory. If the number of retrievable bytes is not 0 mod 4, the final byte(s) will be discarded.
      Throws:
      MemoryAccessException - if not all needed bytes are contained in initialized memory.
    • getInts

      default int getInts(Address addr, int[] dest, int dIndex, int nElem, boolean bigEndian) throws MemoryAccessException
      Description copied from interface: Memory
      Get dest.length number of ints starting at the given address.
      Specified by:
      getInts in interface Memory
      Parameters:
      addr - the starting Address.
      dest - the int array to populate.
      dIndex - the offset into dest to place the ints.
      nElem - the number of ints to get.
      bigEndian - true means to get the ints in bigEndian order
      Returns:
      the number of ints put into dest. May be less than dest.length if the requested number extends beyond available memory. If the number of retrievable bytes is not 0 mod 4, the final byte(s) will be discarded.
      Throws:
      MemoryAccessException - if not all needed bytes are contained in initialized memory.
    • getLong

      default long getLong(Address addr) throws MemoryAccessException
      Description copied from interface: Memory
      Get the long at addr.
      Specified by:
      getLong in interface Memory
      Parameters:
      addr - the Address where the long starts.
      Returns:
      the long.
      Throws:
      MemoryAccessException - if not all needed bytes are contained in initialized memory.
    • getLong

      default long getLong(Address addr, boolean bigEndian) throws MemoryAccessException
      Description copied from interface: Memory
      Get the long at addr in the specified endian order.
      Specified by:
      getLong in interface Memory
      Parameters:
      addr - the Address where the long starts.
      bigEndian - true means to get the long in big endian order
      Returns:
      the long.
      Throws:
      MemoryAccessException - if not all needed bytes are contained in initialized memory.
    • getLongs

      default int getLongs(Address addr, long[] dest) throws MemoryAccessException
      Description copied from interface: Memory
      Get dest.length number of longs starting at the given address.
      Specified by:
      getLongs in interface Memory
      Parameters:
      addr - the starting Address.
      dest - the long array to populate.
      Returns:
      the number of longs put into dest. May be less than dest.length if the requested number extends beyond available memory. If the number of retrievable bytes is not 0 mod 8, the final byte(s) will be discarded.
      Throws:
      MemoryAccessException - if not all needed bytes are contained in initialized memory.
    • getLongs

      default int getLongs(Address addr, long[] dest, int dIndex, int nElem) throws MemoryAccessException
      Description copied from interface: Memory
      Get dest.length number of longs starting at the given address.
      Specified by:
      getLongs in interface Memory
      Parameters:
      addr - the starting Address.
      dest - the long array to populate.
      dIndex - the offset into dest to place the longs.
      nElem - the number of longs to get.
      Returns:
      the number of longs put into dest. May be less than dest.length if the requested number extends beyond available memory. If the number of retrievable bytes is not 0 mod 8, the final byte(s) will be discarded.
      Throws:
      MemoryAccessException - if not all needed bytes are contained in initialized memory.
    • getLongs

      default int getLongs(Address addr, long[] dest, int dIndex, int nElem, boolean bigEndian) throws MemoryAccessException
      Description copied from interface: Memory
      Get dest.length number of longs starting at the given address.
      Specified by:
      getLongs in interface Memory
      Parameters:
      addr - the starting Address.
      dest - the long array to populate.
      dIndex - the offset into dest to place the longs.
      nElem - the number of longs to get.
      bigEndian - true means to get the longs in bigEndian order
      Returns:
      the number of longs put into dest. May be less than dest.length if the requested number extends beyond available memory. If the number of retrievable bytes is not 0 mod 8, the final byte(s) will be discarded.
      Throws:
      MemoryAccessException - if not all needed bytes are contained in initialized memory.
    • setBytes

      default void setBytes(Address addr, byte[] source) throws MemoryAccessException
      Description copied from interface: Memory
      Write size bytes from values at addr.
      Specified by:
      setBytes in interface Memory
      Parameters:
      addr - the starting Address.
      source - the bytes to write.
      Throws:
      MemoryAccessException - if writing is not allowed.
    • setByte

      default void setByte(Address addr, byte value) throws MemoryAccessException
      Description copied from interface: Memory
      Write byte at addr.
      Specified by:
      setByte in interface Memory
      Parameters:
      addr - the Address of the byte.
      value - the data to write.
      Throws:
      MemoryAccessException - if writing is not allowed.
    • setShort

      default void setShort(Address addr, short value) throws MemoryAccessException
      Description copied from interface: Memory
      Write short at addr in default endian order.
      Specified by:
      setShort in interface Memory
      Parameters:
      addr - the Address of the short.
      value - the data to write.
      Throws:
      MemoryAccessException - if writing is not allowed.
    • setShort

      default void setShort(Address addr, short value, boolean bigEndian) throws MemoryAccessException
      Description copied from interface: Memory
      Write short at addr in the specified endian order.
      Specified by:
      setShort in interface Memory
      Parameters:
      addr - the Address of the short.
      value - the data to write.
      bigEndian - true means to write short in big endian order
      Throws:
      MemoryAccessException - if writing is not allowed.
    • setInt

      default void setInt(Address addr, int value) throws MemoryAccessException
      Description copied from interface: Memory
      Write int at addr in the default endian order.
      Specified by:
      setInt in interface Memory
      Parameters:
      addr - the Address of the int.
      value - the data to write.
      Throws:
      MemoryAccessException - if writing is not allowed.
    • setInt

      default void setInt(Address addr, int value, boolean bigEndian) throws MemoryAccessException
      Description copied from interface: Memory
      Write int at addr in the specified endian order.
      Specified by:
      setInt in interface Memory
      Parameters:
      addr - the Address of the int.
      value - the data to write.
      bigEndian - true means to write the short in bigEndian order
      Throws:
      MemoryAccessException - if writing is not allowed.
    • setLong

      default void setLong(Address addr, long value) throws MemoryAccessException
      Description copied from interface: Memory
      Write long at addr in the default endian order.
      Specified by:
      setLong in interface Memory
      Parameters:
      addr - the Address of the long.
      value - the data to write.
      Throws:
      MemoryAccessException - if writing is not allowed.
    • setLong

      default void setLong(Address addr, long value, boolean bigEndian) throws MemoryAccessException
      Description copied from interface: Memory
      Write long at addr in the specified endian order.
      Specified by:
      setLong in interface Memory
      Parameters:
      addr - the Address of the long.
      value - the data to write.
      bigEndian - true means to write the long in bigEndian order
      Throws:
      MemoryAccessException - if writing is not allowed.