mirror of
https://github.com/NationalSecurityAgency/ghidra.git
synced 2024-11-21 19:42:14 +00:00
Merge remote-tracking branch 'origin/ghidra5_GT-2706' into Ghidra_9.0.2
This commit is contained in:
commit
21f5528df5
@ -193,11 +193,11 @@ public class DiffUtility extends SimpleDiffUtility {
|
||||
return otherProgram.getSymbolTable().createExternalLibrary(namespace.getName(), source);
|
||||
}
|
||||
else if (namespace instanceof GhidraClass) {
|
||||
return otherProgram.getSymbolTable().createClass(otherParentNamespace,
|
||||
namespace.getName(), source);
|
||||
return otherProgram.getSymbolTable()
|
||||
.createClass(otherParentNamespace, namespace.getName(), source);
|
||||
}
|
||||
return otherProgram.getSymbolTable().createNameSpace(otherParentNamespace,
|
||||
namespace.getName(), source);
|
||||
return otherProgram.getSymbolTable()
|
||||
.createNameSpace(otherParentNamespace, namespace.getName(), source);
|
||||
}
|
||||
|
||||
// /**
|
||||
@ -329,11 +329,11 @@ public class DiffUtility extends SimpleDiffUtility {
|
||||
if (toAddr == null) {
|
||||
return null;
|
||||
}
|
||||
return otherProgram.getReferenceManager().getReference(fromAddr, toAddr,
|
||||
ref.getOperandIndex());
|
||||
return otherProgram.getReferenceManager()
|
||||
.getReference(fromAddr, toAddr, ref.getOperandIndex());
|
||||
}
|
||||
Reference otherRef = otherProgram.getReferenceManager().getPrimaryReferenceFrom(fromAddr,
|
||||
ref.getOperandIndex());
|
||||
Reference otherRef = otherProgram.getReferenceManager()
|
||||
.getPrimaryReferenceFrom(fromAddr, ref.getOperandIndex());
|
||||
if (otherRef != null && ref.getToAddress().hasSameAddressSpace(otherRef.getToAddress())) {
|
||||
return otherRef;
|
||||
}
|
||||
@ -357,11 +357,11 @@ public class DiffUtility extends SimpleDiffUtility {
|
||||
if (toAddr1 == null) {
|
||||
return null;
|
||||
}
|
||||
return program.getReferenceManager().getReference(fromAddr1, toAddr1,
|
||||
p2Ref.getOperandIndex());
|
||||
return program.getReferenceManager()
|
||||
.getReference(fromAddr1, toAddr1, p2Ref.getOperandIndex());
|
||||
}
|
||||
Reference p1Ref = program.getReferenceManager().getPrimaryReferenceFrom(fromAddr1,
|
||||
p2Ref.getOperandIndex());
|
||||
Reference p1Ref = program.getReferenceManager()
|
||||
.getPrimaryReferenceFrom(fromAddr1, p2Ref.getOperandIndex());
|
||||
if (p1Ref != null && p1Ref.getToAddress().hasSameAddressSpace(p2Ref.getToAddress())) {
|
||||
return p1Ref;
|
||||
}
|
||||
@ -385,8 +385,9 @@ public class DiffUtility extends SimpleDiffUtility {
|
||||
otherAddr = getCompatibleAddress(program, addr, otherProgram);
|
||||
}
|
||||
// FIXME Should this be passing the Namespace?
|
||||
return otherProgram.getExternalManager().addExtLocation(extLoc.getLibraryName(),
|
||||
extLoc.getLabel(), otherAddr, extLoc.getSource());
|
||||
return otherProgram.getExternalManager()
|
||||
.addExtLocation(extLoc.getLibraryName(), extLoc.getLabel(), otherAddr,
|
||||
extLoc.getSource());
|
||||
}
|
||||
|
||||
/**
|
||||
@ -707,6 +708,9 @@ public class DiffUtility extends SimpleDiffUtility {
|
||||
Address refAddress = getCompatibleAddress(program, location.refAddr, otherProgram);
|
||||
|
||||
if (address != null) {
|
||||
if (byteAddress == null) {
|
||||
byteAddress = address; // Make sure the byte address isn't null.
|
||||
}
|
||||
ProgramLocation otherLocation = new ProgramLocation(otherProgram, address, byteAddress,
|
||||
location.getComponentPath(), refAddress, 0, 0, 0);
|
||||
return otherLocation;
|
||||
|
@ -2555,7 +2555,7 @@ public class ProgramDiffDetails {
|
||||
}
|
||||
|
||||
private void addColorAddress(StyledDocument doc, Address addr) {
|
||||
String text = addr.toString();
|
||||
String text = (addr != null) ? addr.toString() : "no matching address";
|
||||
color(ADDRESS_COLOR);
|
||||
try {
|
||||
doc.insertString(doc.getLength(), text, textAttrSet);
|
||||
|
@ -441,6 +441,9 @@ public class ProgramDiffPlugin extends ProgramPlugin
|
||||
|
||||
Address primaryByteAddr = SimpleDiffUtility.getCompatibleAddress(secondaryDiffProgram,
|
||||
byteAddr, primaryProgram);
|
||||
if (primaryByteAddr == null) {
|
||||
primaryByteAddr = primaryAddr; // Make sure the byte address isn't null.
|
||||
}
|
||||
Address primaryRefAddr = SimpleDiffUtility.getCompatibleAddress(secondaryDiffProgram,
|
||||
refAddr, primaryProgram);
|
||||
ProgramLocation newP1Location = new ProgramLocation(primaryProgram, primaryAddr,
|
||||
@ -463,7 +466,9 @@ public class ProgramDiffPlugin extends ProgramPlugin
|
||||
}
|
||||
ProgramLocation previousP1LocationAsP2 = DiffUtility
|
||||
.getCompatibleProgramLocation(primaryProgram, location, secondaryDiffProgram);
|
||||
diffListingPanel.setCursorPosition(previousP1LocationAsP2);
|
||||
if (previousP1LocationAsP2 != null) {
|
||||
diffListingPanel.setCursorPosition(previousP1LocationAsP2);
|
||||
}
|
||||
if (diffDetailsProvider != null && diffDetails != null) {
|
||||
diffDetailsProvider.locationChanged(previousP1Location);
|
||||
}
|
||||
@ -749,7 +754,7 @@ public class ProgramDiffPlugin extends ProgramPlugin
|
||||
runSwing(() -> {
|
||||
MarkerSet selectionMarkers = getSelectionMarkers();
|
||||
selectionMarkers.clearAll();
|
||||
selectionMarkers.add(p2SelectionAsP1);
|
||||
selectionMarkers.add(p2Selection);
|
||||
});
|
||||
|
||||
diffListingPanel.setSelection(p2SelectionAsP1);
|
||||
@ -798,9 +803,9 @@ public class ProgramDiffPlugin extends ProgramPlugin
|
||||
// Limit the apply to the selection in the view.
|
||||
AddressSet p2SelectionAsP1 =
|
||||
DiffUtility.getCompatibleAddressSet(p2Selection, primaryProgram);
|
||||
AddressSet p1ApplySet =
|
||||
p2SelectionAsP1.intersect(p1ViewAddrSet).subtract(addressesOnlyInP1).subtract(
|
||||
compatibleOnlyInP2);
|
||||
AddressSet p1ApplySet = p2SelectionAsP1.intersect(p1ViewAddrSet)
|
||||
.subtract(addressesOnlyInP1)
|
||||
.subtract(compatibleOnlyInP2);
|
||||
if (p1ApplySet.isEmpty()) {
|
||||
Msg.showInfo(getClass(), tool.getToolFrame(), "Apply Differences",
|
||||
(p2Selection.isEmpty()) ? "No diff selection in the current view."
|
||||
@ -860,7 +865,7 @@ public class ProgramDiffPlugin extends ProgramPlugin
|
||||
// Right side markers need p1 addresses since they use p1 indexMap.
|
||||
MarkerSet diffMarkers = getDiffMarkers(); // Get right side markers for program 2.
|
||||
diffMarkers.clearAll();
|
||||
diffMarkers.add(p2DiffSetAsP1);
|
||||
diffMarkers.add(p2DiffSet);
|
||||
|
||||
MarkerSet codeViewerDiffMarkers = getCodeViewerMarkers(); // Get left side markers for program 1.
|
||||
codeViewerDiffMarkers.clearAll();
|
||||
@ -884,7 +889,7 @@ public class ProgramDiffPlugin extends ProgramPlugin
|
||||
AddressSet p1DiffHighlightSet =
|
||||
DiffUtility.getCompatibleAddressSet(p2Highlight, primaryProgram);
|
||||
p2DiffHighlight = p2Highlight;
|
||||
diffMarkers.add(p1DiffHighlightSet);
|
||||
diffMarkers.add(p2Highlight);
|
||||
codeViewerDiffMarkers.add(p1DiffHighlightSet);
|
||||
}
|
||||
|
||||
@ -1603,7 +1608,14 @@ public class ProgramDiffPlugin extends ProgramPlugin
|
||||
diffListingPanel.goTo(currentLocation);
|
||||
|
||||
MarkerSet cursorMarkers = getCursorMarkers();
|
||||
cursorMarkers.setAddressSet(new AddressSet(currentLocation.getAddress()));
|
||||
Address currentP2Address = currentLocation.getAddress();
|
||||
if (currentLocation.getProgram() != secondaryDiffProgram) { // Make sure address is from P2.
|
||||
currentP2Address = SimpleDiffUtility.getCompatibleAddress(currentLocation.getProgram(),
|
||||
currentLocation.getAddress(), secondaryDiffProgram);
|
||||
}
|
||||
if (currentP2Address != null) {
|
||||
cursorMarkers.setAddressSet(new AddressSet(currentP2Address));
|
||||
}
|
||||
|
||||
updatePgm2Enablement();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user