Class AddressBasedLocation

java.lang.Object
ghidra.util.table.field.AddressBasedLocation
All Implemented Interfaces:
Comparable<AddressBasedLocation>

public class AddressBasedLocation extends Object implements Comparable<AddressBasedLocation>
AddressBasedLocation provides the ability to render and compare addresses (e.g., location table column). This may be necessary when working a mixture of address types (e.g., memory, stack, register, variable, external) with the need to render in a meaningful way. Generally, only memory addresses are meaningful to a user when rendered as a simple address (e.g., ram:00123456). While most address types are handled, VARIABLE addresses will only render as "<VARIABLE>". As such, this implementation should be extended if VARIABLE addresses will be encountered.
  • Constructor Details Link icon

    • AddressBasedLocation Link icon

      public AddressBasedLocation()
      Construct a null location which generally corresponds to a unknown/bad address
    • AddressBasedLocation Link icon

      public AddressBasedLocation(Program program, Address address)
      Construction a location. The memory block name will never be included in string representation.
      Parameters:
      program - program to which address belongs
      address - address object (VARIABLE addresses should be avoided)
    • AddressBasedLocation Link icon

      public AddressBasedLocation(Program program, Reference reference, CodeUnitFormatOptions.ShowBlockName showBlockName)
      Construct a location which corresponds to a reference TO address. String representation includes support for Offset References and allows control over inclusion of memory block name with memory addresses.
      Parameters:
      program - program to which address belongs
      reference - program reference (e.g., memory, stack, register, external)
      showBlockName - ShowBlockName option for controlling inclusion of memory block name with address rendering
    • AddressBasedLocation Link icon

      protected AddressBasedLocation(Address address, String representation)
      Construct a location with a specific address and representation
      Parameters:
      address - address object
      representation - address/location string representation
  • Method Details Link icon

    • getAddress Link icon

      public Address getAddress()
    • isMemoryLocation Link icon

      public boolean isMemoryLocation()
      Returns:
      true if location corresponds to memory address
    • isReferenceDestination Link icon

      public boolean isReferenceDestination()
      Determine if location corresponds to a reference destination
      Returns:
      true if location corresponds to a reference destination
    • isShiftedAddress Link icon

      public boolean isShiftedAddress()
      Determine if location corresponds to a shifted memory reference destination
      Returns:
      true if location corresponds to a shifted memory reference destination
    • isOffsetAddress Link icon

      public boolean isOffsetAddress()
      Determine if location corresponds to a shifted memory reference destination
      Returns:
      true if location corresponds to a shifted memory reference destination
    • toString Link icon

      public String toString()
      Overrides:
      toString in class Object
    • equals Link icon

      public boolean equals(Object obj)
      Overrides:
      equals in class Object
    • hashCode Link icon

      public int hashCode()
      Overrides:
      hashCode in class Object
    • compareTo Link icon

      public int compareTo(AddressBasedLocation otherLocation)
      Specified by:
      compareTo in interface Comparable<AddressBasedLocation>