Package ghidra.program.model.reloc
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
Modifier and TypeFieldDescriptionstatic final String
Name of the relocatable property in the program information property list. -
Method Summary
Modifier and TypeMethodDescriptionadd
(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 underlyingFileBytes
.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.getRelocations
(Address addr) 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
getSize()
Returns the number of relocation in this table.boolean
hasRelocation
(Address addr) 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
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 requiredstatus
- relocation status (useRelocation.Status.UNKNOWN
if not known).type
- the type of relocation to performvalues
- 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 (seeadd(Address, Status, int, long[], int, String)
. If null is specified andRelocation.Status.hasBytes()
is true a default number of original bytes will be assumed and obtained from the underlying memoryFileBytes
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 underlyingFileBytes
.- Parameters:
addr
- the memory address where the relocation is requiredstatus
- relocation status (useRelocation.Status.UNKNOWN
if not known).type
- the type of relocation to performvalues
- 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 ofRelocation.Status.UNKNOWN
,Relocation.Status.APPLIED
orRelocation.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
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
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
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
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
-