Class ExternalsAddressTranslator

java.lang.Object
ghidra.app.merge.listing.ExternalsAddressTranslator
All Implemented Interfaces:
AddressTranslator

public class ExternalsAddressTranslator extends 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 Details

    • destinationProgram

      protected Program destinationProgram
    • sourceProgram

      protected Program sourceProgram
  • Constructor Details

    • ExternalsAddressTranslator

      public ExternalsAddressTranslator(Program destinationProgram, Program sourceProgram)
  • Method Details

    • getDestinationProgram

      public Program getDestinationProgram()
      Description copied from interface: AddressTranslator
      Gets the destination program for addresses that have been translated.
      Specified by:
      getDestinationProgram in interface AddressTranslator
      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 interface AddressTranslator
      Returns:
      program2.
    • setPair

      public void setPair(Address destinationAddress, Address sourceAddress)
    • 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 interface AddressTranslator
      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 interface AddressTranslator
    • 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 interface AddressTranslator
      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 interface AddressTranslator
      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