Interface AddressableByteSource

All Known Implementing Classes:
EmptyByteSource, ProgramByteSource

public interface AddressableByteSource
Interface for reading bytes from a program. This provides a level of indirection for reading the bytes of a program so that the provider of the bytes can possibly do more than just reading the bytes from the static program. For example, a debugger would have the opportunity to refresh the bytes first.

This interface also provides methods for determining what regions of memory can be queried and what addresses sets are associated with those regions. This would allow client to present choices about what areas of memory they are interested in AND are valid to be examined.

  • Method Details

    • getBytes

      int getBytes(Address address, byte[] bytes, int length)
      Retrieves the byte values for an address range.
      Parameters:
      address - The address of the first byte in the range
      bytes - the byte array to store the retrieved byte values
      length - the number of bytes to retrieve
      Returns:
      the number of bytes actually retrieved
    • getSearchableRegions

      List<SearchRegion> getSearchableRegions()
      Returns a list of memory regions where each region has an associated address set of valid addresses that can be read.
      Returns:
      a list of readable regions
    • invalidate

      void invalidate()
      Invalidates any caching of byte values. This intended to provide a hint in debugging scenario that we are about to issue a sequence of byte value requests where we are re-acquiring previous requested byte values to look for changes.
    • getCanonicalLocation

      ProgramLocation getCanonicalLocation(Address address)
      Convert byte source address to the canonical (static) location
      Parameters:
      address - address to be converted
      Returns:
      canonical location
    • rebaseFromCanonical

      Address rebaseFromCanonical(ProgramLocation location)
      Rebase a canonical location in the current byte source
      Parameters:
      location - location to be rebased
      Returns:
      address for new byte source
    • generateProgramLocation

      static ProgramLocation generateProgramLocation(Program pgm, Address address)