Package ghidra.app.merge.listing
Class ExternalsAddressTranslator
- java.lang.Object
-
- ghidra.app.merge.listing.ExternalsAddressTranslator
-
- All Implemented Interfaces:
AddressTranslator
public class ExternalsAddressTranslator extends java.lang.Object implements AddressTranslator
ExternalsAddressTranslator is a translator that can be used for merging external functions and labels.
Important: Before using this with ProgramMerge you must add all the address pairs that will translate the external address space address from the source program to the address in the destination program.
-
-
Field Summary
Fields Modifier and Type Field Description protected Program
destinationProgram
protected Program
sourceProgram
-
Constructor Summary
Constructors Constructor Description ExternalsAddressTranslator(Program destinationProgram, Program sourceProgram)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Address
getAddress(Address sourceAddress)
Converts the given source address to the returned destination address.AddressRange
getAddressRange(AddressRange sourceAddressRange)
Converts the given source address range to the returned destination address range.AddressSet
getAddressSet(AddressSetView sourceAddressSet)
Converts the given source address set to the returned destination address set.Program
getDestinationProgram()
Gets the destination program for addresses that have been translated.Program
getSourceProgram()
Gets the source program for obtaining the addresses that need to be translated.boolean
isOneForOneTranslator()
This method should return true if it can translate an address set from the source program to an address set for the destination program and there is a one to one correspondence between the two programs addresses.void
setPair(Address destinationAddress, Address sourceAddress)
-
-
-
Method Detail
-
getDestinationProgram
public Program getDestinationProgram()
Description copied from interface:AddressTranslator
Gets the destination program for addresses that have been translated.- Specified by:
getDestinationProgram
in interfaceAddressTranslator
- Returns:
- program1.
-
getSourceProgram
public Program getSourceProgram()
Description copied from interface:AddressTranslator
Gets the source program for obtaining the addresses that need to be translated.- Specified by:
getSourceProgram
in interfaceAddressTranslator
- Returns:
- program2.
-
getAddress
public Address getAddress(Address sourceAddress)
Description copied from interface:AddressTranslator
Converts the given source address to the returned destination address. This interface is intended to translate an address from the source program to an address in the destination program.- Specified by:
getAddress
in interfaceAddressTranslator
- Parameters:
sourceAddress
- the source address to be converted.- Returns:
- the destination address that is equivalent in some way to the source address. How the address is equivalent depends upon the particular translator. throws AddressTranslationException if the address can't be translated to an equivalent address in the other program.
-
isOneForOneTranslator
public boolean isOneForOneTranslator()
Description copied from interface:AddressTranslator
This method should return true if it can translate an address set from the source program to an address set for the destination program and there is a one to one correspondence between the two programs addresses. In other words two addresses that make up the start and end of an address range would be at the same distance and relative location from each other as the equivalent two individual translated addresses are from each other. Otherwise this should return false.- Specified by:
isOneForOneTranslator
in interfaceAddressTranslator
-
getAddressSet
public AddressSet getAddressSet(AddressSetView sourceAddressSet)
Description copied from interface:AddressTranslator
Converts the given source address set to the returned destination address set. This interface is intended to translate an address set from the source program to an address set in the destination program.
This method should be implemented if isOneForOneTranslator() returns true.- Specified by:
getAddressSet
in interfaceAddressTranslator
- Parameters:
sourceAddressSet
- the source address set to be converted.- Returns:
- the destination address set that is equivalent in some way to the source address set. How the address set is equivalent depends upon the particular translator. throws AddressTranslationException if the address set can't be translated to an equivalent address set in the other program.
-
getAddressRange
public AddressRange getAddressRange(AddressRange sourceAddressRange) throws AddressTranslationException
Description copied from interface:AddressTranslator
Converts the given source address range to the returned destination address range. This interface is intended to translate an address range from the source program to an address range in the destination program.
This method should be implemented if isOneForOneTranslator() returns true.- Specified by:
getAddressRange
in interfaceAddressTranslator
- Returns:
- the destination address range that is equivalent in some way to the source address range. How the address range is equivalent depends upon the particular translator. throws AddressTranslationException if the address set can't be translated to an equivalent address range in the other program.
- Throws:
AddressTranslationException
-
-