Class ProgramMemoryComparator

java.lang.Object
ghidra.program.util.ProgramMemoryComparator

public class ProgramMemoryComparator extends Object
ProgramMemoryComparator is a class for comparing two programs and determining the address differences between them.
  • Constructor Details Link icon

    • ProgramMemoryComparator Link icon

      public ProgramMemoryComparator(Program program1, Program program2) throws ProgramConflictException
      ProgramMemoryComparator is used to determine the memory address differences between two programs.
      Parameters:
      program1 - the first program
      program2 - the second program
      Throws:
      ProgramConflictException - if the two programs can't be compared.
  • Method Details Link icon

    • compareAddressTypes Link icon

      public static void compareAddressTypes(Program program1, Program program2) throws ProgramConflictException
      Check each program to see if the memory blocks have the same address types.
      Parameters:
      program1 - the first program
      program2 - the second program
      Throws:
      ProgramConflictException - if the address types for the two programs do not match.
    • similarPrograms Link icon

      public static boolean similarPrograms(Program p1, Program p2)
      Return whether or not the two specified programs are alike (their language name or address spaces are the same).
      Parameters:
      p1 - the first program
      p2 - the second program
      Returns:
      true if the programs are alike (their language name or address spaces are the same).
    • getProgramOne Link icon

      public Program getProgramOne()
      Gets the first program being compared by the ProgramMemoryComparator.
      Returns:
      program1.
    • getProgramTwo Link icon

      public Program getProgramTwo()
      Gets the second program being compared by the ProgramMemoryComparator.
      Returns:
      program2.
    • getCombinedAddresses Link icon

      public static AddressSet getCombinedAddresses(Program program1, Program program2)
      Returns the addresses from combining the address sets in program1 and program2. Addresses in the returned address set are derived from program1.
      Returns:
      the addresses for both program1 and program2.
    • getAddressRanges Link icon

      public AddressRangeIterator getAddressRanges()
      Returns an iterator for the address ranges in the set containing the combined addresses in program1 and program2. Address ranges from this iterator are derived using program1.
      Returns:
      the addresses for both program1 and program2.
    • getAddressesInCommon Link icon

      public AddressSet getAddressesInCommon()
      Returns the addresses in common between program1 and program2. The returned address set is derived using program1.
      Returns:
      the addresses in common between program1 and program2.
    • getInitializedAddressesInCommon Link icon

      public AddressSet getInitializedAddressesInCommon()
      Returns the addresses of initialized memory in common between program1 and program2. This includes bit memory and live memory. The returned address set is derived using program1.
      Returns:
      the addresses in common between program1 and program2.
    • getSameMemTypeAddressesInCommon Link icon

      public AddressSet getSameMemTypeAddressesInCommon()
      Returns the addresses with the same memory types in common between program1 and program2. The returned address set is derived using program1.
      Returns:
      the addresses in common between program1 and program2.
    • getAddressesOnlyInOne Link icon

      public AddressSet getAddressesOnlyInOne()
      Returns the addresses that are in program1, but not in program2 The returned address set is derived using program1.
      Returns:
      the addresses that are in program1, but not in program2.
    • getAddressesOnlyInTwo Link icon

      public AddressSet getAddressesOnlyInTwo()
      Returns the addresses that are in program2, but not in program1 The returned address set is derived using program2.
      Returns:
      the addresses that are in program2, but not in program1.
    • getCompatibleAddressesOnlyInTwo Link icon

      public AddressSet getCompatibleAddressesOnlyInTwo()
      Returns the set of addresses that are in program2, but not in program1 and that are compatible with program1. The returned address set is derived using program1.
      Returns:
      the addresses that are in program2, but not in program1.
    • hasMemoryDifferences Link icon

      public boolean hasMemoryDifferences()
      Return whether or not the memory addresses for the two Programs are different.
    • sameProgramContextRegisterNames Link icon

      public static boolean sameProgramContextRegisterNames(Program program1, Program program2)
      Returns true if the register names are the same in both programs.
      Parameters:
      program1 - the first program
      program2 - the second program
      Returns:
      true if the register names are the same