Module openj9.dtfj

Class CorruptImagePointer

java.lang.Object
com.ibm.dtfj.image.j9.corrupt.CorruptImagePointer
All Implemented Interfaces:
ImagePointer

public class CorruptImagePointer extends Object implements ImagePointer
Class to represent a corrupt pointer and can be used to populate a corrupt data exception. It will throw exceptions if an attempt is made to read data using it.
  • Constructor Details

    • CorruptImagePointer

      public CorruptImagePointer(long address, ImageAddressSpace memory)
  • Method Details

    • add

      public ImagePointer add(long offset)
      Description copied from interface: ImagePointer
      Build a new image pointer offset from this one by the given amount.
      Specified by:
      add in interface ImagePointer
      Parameters:
      offset - Offset in bytes.
      Returns:
      a new ImagePointer based at getAddress() + offset
    • getAddress

      public long getAddress()
      Description copied from interface: ImagePointer

      Get the unwrapped address, represented as a Java long.

      Use caution when comparing addresses, as some addresses may be negative.

      Note that, on segmented memory architectures, it may not be possible to represent all addresses accurately as integers.

      Specified by:
      getAddress in interface ImagePointer
      Returns:
      the unwrapped address, represented as a 64-bit integer.
    • getAddressSpace

      public ImageAddressSpace getAddressSpace()
      Description copied from interface: ImagePointer
      Get the address space to which this pointer belongs.
      Specified by:
      getAddressSpace in interface ImagePointer
      Returns:
      the address space to which this pointer belongs.
    • getByteAt

      public byte getByteAt(long index) throws MemoryAccessException, CorruptDataException
      Description copied from interface: ImagePointer
      Get the value at the given offset from this pointer.
      Specified by:
      getByteAt in interface ImagePointer
      Parameters:
      index - an offset (in bytes) from the current position
      Returns:
      the 8-bit byte stored at getAddress() + index
      Throws:
      MemoryAccessException - if the memory cannot be read
      CorruptDataException - if the memory should be in the image, but is missing or corrupted
    • getDoubleAt

      public double getDoubleAt(long index) throws MemoryAccessException, CorruptDataException
      Description copied from interface: ImagePointer
      Get the value at the given offset from this pointer.
      Specified by:
      getDoubleAt in interface ImagePointer
      Parameters:
      index - an offset (in bytes) from the current position
      Returns:
      the 64-bit double stored at getAddress() + index
      Throws:
      MemoryAccessException - if the memory cannot be read
      CorruptDataException - if the memory should be in the image, but is missing or corrupted
    • getFloatAt

      public float getFloatAt(long index) throws MemoryAccessException, CorruptDataException
      Description copied from interface: ImagePointer
      Get the value at the given offset from this pointer.
      Specified by:
      getFloatAt in interface ImagePointer
      Parameters:
      index - an offset (in bytes) from the current position
      Returns:
      the 32-bit float stored at getAddress() + index
      Throws:
      MemoryAccessException - if the memory cannot be read
      CorruptDataException - if the memory should be in the image, but is missing or corrupted
    • getIntAt

      public int getIntAt(long index) throws MemoryAccessException, CorruptDataException
      Description copied from interface: ImagePointer
      Get the value at the given offset from this pointer.
      Specified by:
      getIntAt in interface ImagePointer
      Parameters:
      index - an offset (in bytes) from the current position
      Returns:
      the 32-bit int stored at getAddress() + index
      Throws:
      MemoryAccessException - if the memory cannot be read
      CorruptDataException - if the memory should be in the image, but is missing or corrupted
    • getLongAt

      public long getLongAt(long index) throws MemoryAccessException, CorruptDataException
      Description copied from interface: ImagePointer
      Get the value at the given offset from this pointer.
      Specified by:
      getLongAt in interface ImagePointer
      Parameters:
      index - an offset (in bytes) from the current position
      Returns:
      the 64-bit long stored at getAddress() + index
      Throws:
      MemoryAccessException - if the memory cannot be read
      CorruptDataException - if the memory should be in the image, but is missing or corrupted
    • getPointerAt

      public ImagePointer getPointerAt(long index) throws MemoryAccessException, CorruptDataException
      Description copied from interface: ImagePointer
      Get the value at the given offset from this pointer. To determine the number of bytes to skip after this call to read the next value, use ImageProcess.getPointerSize(). Note: to create an ImagePointer using an absolute address use com.ibm.dtfj.image.ImageAddressSpace.getPointer()
      Specified by:
      getPointerAt in interface ImagePointer
      Parameters:
      index - an offset (in bytes) from the current position
      Returns:
      the 32 or 64-bit pointer stored at getAddress() + index
      Throws:
      MemoryAccessException - if the memory cannot be read
      CorruptDataException - if the memory should be in the image, but is missing or corrupted
      See Also:
    • getShortAt

      public short getShortAt(long index) throws MemoryAccessException, CorruptDataException
      Description copied from interface: ImagePointer
      Get the value at the given offset from this pointer.
      Specified by:
      getShortAt in interface ImagePointer
      Parameters:
      index - an offset (in bytes) from the current position
      Returns:
      the 16-bit short stored at getAddress() + index
      Throws:
      MemoryAccessException - if the memory cannot be read
      CorruptDataException - if the memory should be in the image, but is missing or corrupted
    • isExecutable

      public boolean isExecutable() throws DataUnavailable
      Description copied from interface: ImagePointer
      Tests memory execute permission.
      Specified by:
      isExecutable in interface ImagePointer
      Returns:
      true if this memory address is within an executable page.
      Throws:
      DataUnavailable
    • isReadOnly

      public boolean isReadOnly() throws DataUnavailable
      Description copied from interface: ImagePointer
      Tests memory read/write permission.
      Specified by:
      isReadOnly in interface ImagePointer
      Returns:
      true if this memory address is read-only. False otherwise.
      Throws:
      DataUnavailable
    • isShared

      public boolean isShared() throws DataUnavailable
      Description copied from interface: ImagePointer
      Tests memory shared permission.
      Specified by:
      isShared in interface ImagePointer
      Returns:
      true if this memory address is shared between processes.
      Throws:
      DataUnavailable
    • getProperties

      public Properties getProperties()
      Description copied from interface: ImagePointer
      Get the OS-specific properties for this address
      Specified by:
      getProperties in interface ImagePointer
      Returns:
      a table of OS-specific properties for this address. Values which are commonly available include
      • "readable" -- whether the memory address can be read from
      • "writable" -- whether the memory address can be written to
      • "executable" -- whether data in the memory address can be executed