Package ghidra.app.merge.listing
Class ExternalsAddressTranslator
java.lang.Object
ghidra.app.merge.listing.ExternalsAddressTranslator
- All Implemented Interfaces:
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.
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
-
Constructor Summary
ConstructorDescriptionExternalsAddressTranslator
(Program destinationProgram, Program sourceProgram) -
Method Summary
Modifier and TypeMethodDescriptiongetAddress
(Address sourceAddress) Converts the given source address to the returned destination address.getAddressRange
(AddressRange sourceAddressRange) Converts the given source address range to the returned destination address range.getAddressSet
(AddressSetView sourceAddressSet) Converts the given source address set to the returned destination address set.Gets the destination program for addresses that have been translated.Gets the source program for obtaining the addresses that need to be translated.boolean
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
-
Field Details
-
destinationProgram
-
sourceProgram
-
-
Constructor Details
-
ExternalsAddressTranslator
-
-
Method Details
-
getDestinationProgram
Description copied from interface:AddressTranslator
Gets the destination program for addresses that have been translated.- Specified by:
getDestinationProgram
in interfaceAddressTranslator
- Returns:
- program1.
-
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.
-
setPair
-
getAddress
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
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
- Parameters:
sourceAddressRange
- the source address range to be converted.- 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
-