Package ghidra.util.table.field
Class AddressBasedLocation
- java.lang.Object
-
- ghidra.util.table.field.AddressBasedLocation
-
- All Implemented Interfaces:
java.lang.Comparable<AddressBasedLocation>
public class AddressBasedLocation extends java.lang.Object implements java.lang.Comparable<AddressBasedLocation>
AddressBasedLocationprovides 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 Summary
Constructors Modifier Constructor Description AddressBasedLocation()Construct a null location which generally corresponds to a unknown/bad addressprotectedAddressBasedLocation(Address address, java.lang.String representation)Construct a location with a specific address and representationAddressBasedLocation(Program program, Address address)Construction a location.AddressBasedLocation(Program program, Reference reference, CodeUnitFormatOptions.ShowBlockName showBlockName)Construct a location which corresponds to a reference TO address.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description intcompareTo(AddressBasedLocation otherLocation)booleanequals(java.lang.Object obj)AddressgetAddress()inthashCode()booleanisMemoryLocation()booleanisOffsetAddress()Determine if location corresponds to a shifted memory reference destinationbooleanisReferenceDestination()Determine if location corresponds to a reference destinationbooleanisShiftedAddress()Determine if location corresponds to a shifted memory reference destinationjava.lang.StringtoString()
-
-
-
Constructor Detail
-
AddressBasedLocation
public AddressBasedLocation()
Construct a null location which generally corresponds to a unknown/bad address
-
AddressBasedLocation
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 belongsaddress- address object (VARIABLE addresses should be avoided)
-
AddressBasedLocation
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 belongsreference- program reference (e.g., memory, stack, register, external)showBlockName- ShowBlockName option for controlling inclusion of memory block name with address rendering
-
AddressBasedLocation
protected AddressBasedLocation(Address address, java.lang.String representation)
Construct a location with a specific address and representation- Parameters:
address- address objectrepresentation- address/location string representation
-
-
Method Detail
-
getAddress
public Address getAddress()
-
isMemoryLocation
public boolean isMemoryLocation()
- Returns:
- true if location corresponds to memory address
-
isReferenceDestination
public boolean isReferenceDestination()
Determine if location corresponds to a reference destination- Returns:
- true if location corresponds to a reference destination
-
isShiftedAddress
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
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
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equalsin classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
compareTo
public int compareTo(AddressBasedLocation otherLocation)
- Specified by:
compareToin interfacejava.lang.Comparable<AddressBasedLocation>
-
-