Package ghidra.program.util
Class ProgramMemoryComparator
java.lang.Object
ghidra.program.util.ProgramMemoryComparator
ProgramMemoryComparator
is a class for comparing two programs and
determining the address differences between them.-
Constructor Summary
ConstructorDescriptionProgramMemoryComparator
(Program program1, Program program2) ProgramMemoryComparator
is used to determine the memory address differences between two programs. -
Method Summary
Modifier and TypeMethodDescriptionstatic void
compareAddressTypes
(Program program1, Program program2) Check each program to see if the memory blocks have the same address types.Returns the addresses in common between program1 and program2.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 program2, but not in program1 The returned address set is derived using program2.Returns an iterator for the address ranges in the set containing the combined addresses in program1 and program2.static AddressSet
getCombinedAddresses
(Program program1, Program program2) Returns the addresses from combining the address sets in program1 and program2.Returns the set of addresses that are in program2, but not in program1 and that are compatible with program1.Returns the addresses of initialized memory in common between program1 and program2.Gets the first program being compared by the ProgramMemoryComparator.Gets the second program being compared by the ProgramMemoryComparator.Returns the addresses with the same memory types in common between program1 and program2.boolean
Return whether or not the memory addresses for the two Programs are different.static boolean
sameProgramContextRegisterNames
(Program program1, Program program2) Returns true if the register names are the same in both programs.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).
-
Constructor Details
-
ProgramMemoryComparator
ProgramMemoryComparator
is used to determine the memory address differences between two programs.- Parameters:
program1
- the first programprogram2
- the second program- Throws:
ProgramConflictException
- if the two programs can't be compared.
-
-
Method Details
-
compareAddressTypes
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 programprogram2
- the second program- Throws:
ProgramConflictException
- if the address types for the two programs do not match.
-
similarPrograms
Return whether or not the two specified programs are alike (their language name or address spaces are the same).- Parameters:
p1
- the first programp2
- the second program- Returns:
- true if the programs are alike (their language name or address spaces are the same).
-
getProgramOne
Gets the first program being compared by the ProgramMemoryComparator.- Returns:
- program1.
-
getProgramTwo
Gets the second program being compared by the ProgramMemoryComparator.- Returns:
- program2.
-
getCombinedAddresses
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
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
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
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
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
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
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
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
public boolean hasMemoryDifferences()Return whether or not the memory addresses for the two Programs are different. -
sameProgramContextRegisterNames
Returns true if the register names are the same in both programs.- Parameters:
program1
- the first programprogram2
- the second program- Returns:
- true if the register names are the same
-