Interface RelocationTable

All Known Implementing Classes:
RelocationManager

public interface RelocationTable
An interface for storing the relocations defined in a program. Table must preserve the order in which relocations are added such that the iterators return them in the same order.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final String
    Name of the relocatable property in the program information property list.
  • Method Summary

    Modifier and Type
    Method
    Description
    add(Address addr, Relocation.Status status, int type, long[] values, byte[] bytes, String symbolName)
    Adds a new relocation entry when the original bytes being replaced are to be specified.
    add(Address addr, Relocation.Status status, int type, long[] values, int byteLength, String symbolName)
    Adds a new relocation entry when the original bytes being replaced should be determined from the underlying FileBytes.
    Returns the next relocation address which follows the specified address.
    Returns an iterator over all defined relocations (in ascending address order) located within the program.
    Returns the ordered list of relocations which have been defined for the specified address.
    Returns an iterator over all defined relocations (in ascending address order) located within the program over the specified address set.
    int
    Returns the number of relocation in this table.
    boolean
    Determine if the specified address has a relocation defined.
    boolean
    Returns true if this relocation table contains relocations for a relocatable binary.
  • Field Details

    • RELOCATABLE_PROP_NAME

      static final String RELOCATABLE_PROP_NAME
      Name of the relocatable property in the program information property list.
      See Also:
  • Method Details

    • add

      Relocation add(Address addr, Relocation.Status status, int type, long[] values, byte[] bytes, String symbolName)
      Adds a new relocation entry when the original bytes being replaced are to be specified.
      Parameters:
      addr - the memory address where the relocation is required
      status - relocation status (use Relocation.Status.UNKNOWN if not known).
      type - the type of relocation to perform
      values - relocation-specific values which may be useful in diagnosing relocation; may be null.
      bytes - original memory bytes affected by relocation. A null value may be passed but this case is deprecated (see add(Address, Status, int, long[], int, String). If null is specified and Relocation.Status.hasBytes() is true a default number of original bytes will be assumed and obtained from the underlying memory FileBytes if possible.
      symbolName - the name of the symbol being relocated; may be null
      Returns:
      the newly added relocation object
    • add

      Relocation add(Address addr, Relocation.Status status, int type, long[] values, int byteLength, String symbolName)
      Adds a new relocation entry when the original bytes being replaced should be determined from the underlying FileBytes.
      Parameters:
      addr - the memory address where the relocation is required
      status - relocation status (use Relocation.Status.UNKNOWN if not known).
      type - the type of relocation to perform
      values - relocation-specific values which may be useful in diagnosing relocation; may be null.
      byteLength - the number of bytes affected by this relocation. This value is only used with a status of Relocation.Status.UNKNOWN, Relocation.Status.APPLIED or Relocation.Status.APPLIED_OTHER. Valid range is 1..8 bytes.
      symbolName - the name of the symbol being relocated; may be null
      Returns:
      the newly added relocation object
    • getRelocations

      List<Relocation> getRelocations(Address addr)
      Returns the ordered list of relocations which have been defined for the specified address. In most cases there will be one or none, but in some cases multiple relocations may be applied to a single address.
      Parameters:
      addr - the address where the relocation(s) are defined
      Returns:
      the ordered list of relocations which have been defined for the specified address.
    • hasRelocation

      boolean hasRelocation(Address addr)
      Determine if the specified address has a relocation defined.
      Parameters:
      addr - memory address within program
      Returns:
      true if relocation defined, otherwise false
    • getRelocations

      Iterator<Relocation> getRelocations()
      Returns an iterator over all defined relocations (in ascending address order) located within the program.
      Returns:
      ordered relocation iterator
    • getRelocations

      Iterator<Relocation> getRelocations(AddressSetView set)
      Returns an iterator over all defined relocations (in ascending address order) located within the program over the specified address set.
      Parameters:
      set - address set
      Returns:
      ordered relocation iterator
    • getRelocationAddressAfter

      Address getRelocationAddressAfter(Address addr)
      Returns the next relocation address which follows the specified address.
      Parameters:
      addr - starting point
      Returns:
      next relocation address after addr or null if none
    • getSize

      int getSize()
      Returns the number of relocation in this table.
      Returns:
      the number of relocation in this table
    • isRelocatable

      boolean isRelocatable()
      Returns true if this relocation table contains relocations for a relocatable binary. Some binaries may contain relocations, but not actually be relocatable. For example, ELF executables.
      Returns:
      true if this relocation table contains relocations for a relocatable binary