Module openj9.dtfj

Class Memory

java.lang.Object
com.ibm.dtfj.corereaders.j9.Memory

public class Memory extends Object
Memory adapter which removes the need for a component to know the address space ID that it is working with. This is set when the adapter is created.
  • Constructor Summary

    Constructors
    Constructor
    Description
    Create a memory representation
  • Method Summary

    Modifier and Type
    Method
    Description
    int
    Identify the memory as 32 or 64 bit
    long
    findPattern(byte[] whatBytes, int alignment, long startFrom)
    Search the memory for a specific byte pattern
    byte
    getByteAt(long address)
    Read a byte from the specified address
    int
    getBytesAt(long address, byte[] buffer)
    Read a byte from the specified address
    int
    getIntAt(long address)
    Read an int from the specified address
    long
    getLongAt(long address)
    Read a long from the specified address
    byte[]
    getMemoryBytes(long address, int size)
    Read bytes from the specified address
    Get the memory ranges for this address space
    long
    getPointerAt(long address)
    Read a pointer at the specified address
    short
    getShortAt(long address)
    Read a short from the specified address
    boolean
    isExecutable(long address)
    Flag for executable memory
    boolean
    isReadOnly(long address)
    Flag to indicate if the memory is read only
    boolean
    isShared(long address)
    Flag to indicate if the memory is shared

    Methods declared in class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • Memory

      public Memory(IAbstractAddressSpace space)
      Create a memory representation
      Parameters:
      space - the underlying address space
  • Method Details

    • bytesPerPointer

      public int bytesPerPointer()
      Identify the memory as 32 or 64 bit
      Returns:
      4 for 31/32 bit, 8 for 64 bit
    • findPattern

      public long findPattern(byte[] whatBytes, int alignment, long startFrom)
      Search the memory for a specific byte pattern
      Parameters:
      whatBytes - what to search for
      alignment - byte alignment
      startFrom - position to start the search from
      Returns:
      the address of the bytes if found or -1
    • getByteAt

      public byte getByteAt(long address) throws MemoryAccessException
      Read a byte from the specified address
      Parameters:
      address - address to read from
      Returns:
      the data
      Throws:
      MemoryAccessException
    • getBytesAt

      public int getBytesAt(long address, byte[] buffer) throws MemoryAccessException
      Read a byte from the specified address
      Parameters:
      address - address to read from
      Returns:
      the data
      Throws:
      MemoryAccessException
    • getIntAt

      public int getIntAt(long address) throws MemoryAccessException
      Read an int from the specified address
      Parameters:
      address - address to read from
      Returns:
      the data
      Throws:
      MemoryAccessException
    • getLongAt

      public long getLongAt(long address) throws MemoryAccessException
      Read a long from the specified address
      Parameters:
      address - address to read from
      Returns:
      the data
      Throws:
      MemoryAccessException
    • getMemoryBytes

      public byte[] getMemoryBytes(long address, int size)
      Read bytes from the specified address
      Parameters:
      address - address to read from
      size - number of bytes to read
      Returns:
      the data
    • getMemoryRanges

      public Iterator getMemoryRanges()
      Get the memory ranges for this address space
    • getPointerAt

      public long getPointerAt(long address) throws MemoryAccessException
      Read a pointer at the specified address
      Parameters:
      address - address to read from
      Returns:
      the data
      Throws:
      MemoryAccessException
    • getShortAt

      public short getShortAt(long address) throws MemoryAccessException
      Read a short from the specified address
      Parameters:
      address - address to read from
      Returns:
      the data
      Throws:
      MemoryAccessException
    • isExecutable

      public boolean isExecutable(long address) throws MemoryAccessException
      Flag for executable memory
      Returns:
      true if it is executable
      Throws:
      MemoryAccessException
    • isReadOnly

      public boolean isReadOnly(long address) throws MemoryAccessException
      Flag to indicate if the memory is read only
      Returns:
      true if it is read only
      Throws:
      MemoryAccessException
    • isShared

      public boolean isShared(long address) throws MemoryAccessException
      Flag to indicate if the memory is shared
      Returns:
      true if it is shared
      Throws:
      MemoryAccessException