Package ghidra.program.model.address

# Interface AddressFactory

All Known Implementing Classes:
  `DefaultAddressFactory`, `ProgramAddressFactory`, `TraceAddressFactory`

public interface AddressFactory

- ## Method Summary

  Modifier and Type
  Method
  Description
  `boolean`
  `equals(Object o)`
  `Address`
  `getAddress(int spaceID, long offset)`
  Get an address using the addressSpace with the given id and having the given offset.
  `Address`
  `getAddress(String addrString)`
  Create an address from String.
  `AddressSet`
  `getAddressSet()`
  Returns an addressSet containing all possible "real" addresses for this address factory.
  `AddressSet`
  `getAddressSet(Address min, Address max)`
  Computes an address set from a start and end address that may span address spaces.
  `AddressSpace`
  `getAddressSpace(int spaceID)`
  Returns the space with the given spaceID or null if none exists
  `AddressSpace`
  `getAddressSpace(String name)`
  Returns the space with the given name or null if no space exists with that name.
  `AddressSpace[]`
  `getAddressSpaces()`
  Get the array of all "physical" AddressSpaces.
  `Address[]`
  `getAllAddresses(String addrString)`
  Generates all reasonable addresses that can be interpreted from the given string.
  `Address[]`
  `getAllAddresses(String addrString, boolean caseSensitive)`
  Generates all reasonable addresses that can be interpreted from the given string.
  `AddressSpace[]`
  `getAllAddressSpaces()`
  Returns an array of all address spaces, including analysis spaces.
  `Address`
  `getConstantAddress(long offset)`
  Returns an address in "constant" space with the given offset.
  `AddressSpace`
  `getConstantSpace()`
  Returns the "constant" address space.
  `AddressSpace`
  `getDefaultAddressSpace()`
  Returns the default AddressSpace
  `long`
  `getIndex(Address addr)`
  Returns the index (old encoding) for the given address.
  `int`
  `getNumAddressSpaces()`
  Returns the number of physical AddressSpaces.
  `AddressSpace`
  `getPhysicalSpace(AddressSpace space)`
  Gets the physical address space associated with the given address space.
  `AddressSpace[]`
  `getPhysicalSpaces()`
  Returns an array of all the physical address spaces.
  `AddressSpace`
  `getRegisterSpace()`
  Returns the "register" address space.
  `AddressSpace`
  `getStackSpace()`
  Returns the "stack" address space.
  `AddressSpace`
  `getUniqueSpace()`
  Returns the "unique" address space.
  `boolean`
  `hasMultipleMemorySpaces()`
  Returns true if there is more than one memory address space
  `default boolean`
  `hasStaleOverlayCondition()`
  Determine if this address factory contains a stale overlay address space whose name was recently changed.
  `boolean`
  `isValidAddress(Address addr)`
  Tests if the given address is valid for at least one of the Address Spaces in this factory
  `Address`
  `oldGetAddressFromLong(long value)`
  Returns the address using the old encoding format.

- ## Method Details

  - ### getAddress

    Address getAddress(String addrString)
    Create an address from String. Attempts to use the "default" address space first. Otherwise loops through each addressSpace, returning the first valid address that any addressSpace creates from the string. Returns an Address if the string is valid, otherwise null.

  - ### getAllAddresses

    Address[] getAllAddresses(String addrString)
    Generates all reasonable addresses that can be interpreted from the given string. Each Address Space is given a change to parse the string and all the valid results are return in the array.
    Parameters:
      `addrString` - the address string to parse.
    Returns:
      Address[] The list of addresses generated from the string.

  - ### getAllAddresses

    Address[] getAllAddresses(String addrString, boolean caseSensitive)
    Generates all reasonable addresses that can be interpreted from the given string. Each Address Space is given a change to parse the string and all the valid results are return in the array.
    Parameters:
      `addrString` - the address string to parse.
      `caseSensitive` - determines if addressSpace names must be case sensitive to match.
    Returns:
      Address[] The list of addresses generated from the string.

  - ### getDefaultAddressSpace

    AddressSpace getDefaultAddressSpace()
    Returns the default AddressSpace

  - ### getAddressSpaces

    AddressSpace[] getAddressSpaces()
    Get the array of all "physical" AddressSpaces.

  - ### getAllAddressSpaces

    AddressSpace[] getAllAddressSpaces()
    Returns an array of all address spaces, including analysis spaces.
    Returns:
      an array of all the address spaces.

  - ### getAddressSpace

    AddressSpace getAddressSpace(String name)
    Returns the space with the given name or null if no space exists with that name.

  - ### getAddressSpace

    AddressSpace getAddressSpace(int spaceID)
    Returns the space with the given spaceID or null if none exists

  - ### getNumAddressSpaces

    int getNumAddressSpaces()
    Returns the number of physical AddressSpaces.

  - ### isValidAddress

    boolean isValidAddress(Address addr)
    Tests if the given address is valid for at least one of the Address Spaces in this factory
    Parameters:
      `addr` - The address to test
    Returns:
      boolean true if the address valid, false otherwise

  - ### equals

    boolean equals(Object o)
    Overrides:
      `equals` in class `Object`
    See Also:
      - `Object.equals(Object)`

  - ### getIndex

    long getIndex(Address addr)
    Returns the index (old encoding) for the given address.
    Parameters:
      `addr` - the address to encode.

  - ### getPhysicalSpace

    AddressSpace getPhysicalSpace(AddressSpace space)
    Gets the physical address space associated with the given address space. If the given space is physical, then it will be returned.
    Parameters:
      `space` - the addressSpace for which the physical space is requested.
    Returns:
      the physical address space associated with the given address space.

  - ### getPhysicalSpaces

    AddressSpace[] getPhysicalSpaces()
    Returns an array of all the physical address spaces.
    Returns:
      an array of all the physical address spaces.

  - ### getAddress

    Address getAddress(int spaceID, long offset)
    Get an address using the addressSpace with the given id and having the given offset.
    Parameters:
      `spaceID` - the id of the address space to use to create the new address.
      `offset` - the offset of the new address to be created.
    Returns:
      the new address.

  - ### getConstantSpace

    AddressSpace getConstantSpace()
    Returns the "constant" address space.

  - ### getUniqueSpace

    AddressSpace getUniqueSpace()
    Returns the "unique" address space.

  - ### getStackSpace

    AddressSpace getStackSpace()
    Returns the "stack" address space.

  - ### getRegisterSpace

    AddressSpace getRegisterSpace()
    Returns the "register" address space.

  - ### getConstantAddress

    Address getConstantAddress(long offset)
    Returns an address in "constant" space with the given offset.
    Parameters:
      `offset` - the offset in "constant" space for the new address.
    Returns:
      a new address in the "constant" space with the given offset.

  - ### getAddressSet

    AddressSet getAddressSet(Address min, Address max)
    Computes an address set from a start and end address that may span address spaces. Although in general, it is not meaningful to compare addresses from multiple spaces, but since there is an absolute ordering of address spaces it can be useful for iterating over all addresses in a program with multiple address spaces.
    Parameters:
      `min` - the start address
      `max` - the end address.
    Returns:
      an addressSet containing ranges that don't span address spaces.

  - ### getAddressSet

    AddressSet getAddressSet()
    Returns an addressSet containing all possible "real" addresses for this address factory.

  - ### oldGetAddressFromLong

    Address oldGetAddressFromLong(long value)
    Returns the address using the old encoding format.
    Parameters:
      `value` - to decode into an address.

  - ### hasMultipleMemorySpaces

    boolean hasMultipleMemorySpaces()
    Returns true if there is more than one memory address space

  - ### hasStaleOverlayCondition

    default boolean hasStaleOverlayCondition()
    Determine if this address factory contains a stale overlay address space whose name was recently changed. When this condition occurs, issues may arise when comparing `Address` and `AddressSpace`-related objects when overlay address spaces are involved. A common case for this is a Diff type operation.
    Returns:
      true if this factory contains one or more stale overlay address space instances.