Class MemoryDiff

java.lang.Object
ghidra.program.util.MemoryDiff

public class MemoryDiff extends Object
MemoryDiff determines where the memory differs between two programs as well as the types of differences.
  • Constructor Details

    • MemoryDiff

      public MemoryDiff(Program p1, Program p2) throws ProgramConflictException
      Constructs an object for determining memory differences between two programs.
      Parameters:
      p1 - the first program
      p2 - the second program
      Throws:
      ProgramConflictException - if the program memory can't be compared because the programs are based on different languages.
  • Method Details

    • getProgram1

      public Program getProgram1()
      Gets the first program that is part of this MemoryDiff.
      Returns:
      the first program
    • getProgram2

      public Program getProgram2()
      Gets the second program that is part of this MemoryDiff.
      Returns:
      the second program
    • getNumRanges

      public int getNumRanges()
      Gets the number of address ranges that the two programs memories are broken into for comparing the programs.
      Returns:
      the number of address ranges.
    • getRange

      public AddressRange getRange(int index)
      Gets the address range as indicated by index. The index is zero based. Address ranges are in order from the minimum address to the maximum address range.
      Parameters:
      index - the index of the address range to get.
      Returns:
      the address range.
    • getDifferenceInfo

      public MemoryBlockDiff getDifferenceInfo(int index)
      Gets the memory difference flags for the address range as indicated by index.
      Parameters:
      index - the index of the address range to get the difference flags for.
      Returns:
      the difference flags for the indicated address range.
    • getDifferences

      public String getDifferences(Address p1Address)
      Gets a string representation of the types of memory differences that exist for the memory block that contains the indicated address.
      Parameters:
      p1Address - address that is obtained via the first program.
      Returns:
      a string indicating the types of memory differences.
    • getDifferentAddressRanges

      public AddressRange[] getDifferentAddressRanges()
      Returns an array of address ranges where there are memory differences.
      Returns:
      address ranges with differences.
    • merge

      public boolean merge(int row, int mergeFields, TaskMonitor monitor)