Ghidra is a software reverse engineering (SRE) framework
GP-5480 Corrected Merge tool rendering of external locations within multi-listing.
ghidra1905b4d78bdd7
diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/merge/ProgramMultiUserMergeManager.java b/Ghidra/Features/Base/src/main/java/ghidra/app/merge/ProgramMultiUserMergeManager.javaindex 3dc78f7f0d..26c30fe2e5 100644--- a/Ghidra/Features/Base/src/main/java/ghidra/app/merge/ProgramMultiUserMergeManager.java+++ b/Ghidra/Features/Base/src/main/java/ghidra/app/merge/ProgramMultiUserMergeManager.java@@ -4,9 +4,9 @@* Licensed under the Apache License, Version 2.0 (the "License");* you may not use this file except in compliance with the License.* You may obtain a copy of the License at- *+ ** http://www.apache.org/licenses/LICENSE-2.0- *+ ** Unless required by applicable law or agreed to in writing, software* distributed under the License is distributed on an "AS IS" BASIS,* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.@@ -106,7 +106,6 @@ public class ProgramMultiUserMergeManager extends MergeManager {ListingMergeManager listingMergeManager =new ListingMergeManager(this, resultProgram, originalProgram, latestProgram, myProgram,(ProgramChangeSet) latestChangeSet, (ProgramChangeSet) myChangeSet);- listingMergeManager.setShowListingPanel(showListingPanels);mergeResolvers[idx++] = listingMergeManager;mergeResolvers[idx++] =@@ -406,6 +405,15 @@ public class ProgramMultiUserMergeManager extends MergeManager {return isShowingListingMergePanel;}+ /**+ * Determine if the listing panels should be rendered.+ * NOTE: This is provided for testing performance reasons only.+ * @return true if listing panels should be rendered+ */+ public boolean isShowListingPanel() {+ return showListingPanels;+ }+}class MergeNavigatable implements Navigatable {diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/merge/listing/ListingMergeManager.java b/Ghidra/Features/Base/src/main/java/ghidra/app/merge/listing/ListingMergeManager.javaindex e309e77518..8c4fefc47c 100644--- a/Ghidra/Features/Base/src/main/java/ghidra/app/merge/listing/ListingMergeManager.java+++ b/Ghidra/Features/Base/src/main/java/ghidra/app/merge/listing/ListingMergeManager.java@@ -4,9 +4,9 @@* Licensed under the Apache License, Version 2.0 (the "License");* you may not use this file except in compliance with the License.* You may obtain a copy of the License at- *+ ** http://www.apache.org/licenses/LICENSE-2.0- *+ ** Unless required by applicable law or agreed to in writing, software* distributed under the License is distributed on an "AS IS" BASIS,* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.@@ -130,7 +130,6 @@ public class ListingMergeManager implements MergeResolver, ListingMergeConstantsprivate int totalConflictsInPhase; // Total number of conflicts for current phase of listing.private int conflictNum; // Current conflict number being resolved.- private boolean showListingPanel = true;/*** Manages listing changes and conflicts between the latest versioned@@ -160,14 +159,6 @@ public class ListingMergeManager implements MergeResolver, ListingMergeConstantsreturn functionTagMerger;}- /**- * True signals to show the listing panel (default); false signals to show an empty listing (faster)- * @param showListingPanel- */- public void setShowListingPanel(boolean showListingPanel) {- this.showListingPanel = showListingPanel;- }-/* (non-Javadoc)* @see ghidra.app.merge.MergeResolver#apply()*/@@ -512,7 +503,8 @@ public class ListingMergeManager implements MergeResolver, ListingMergeConstants* determine conflicts. The conflicts are handled later by calling manualMerge().*/private void initializeMergers() {- externalFunctionMerger = new ExternalFunctionMerger(this, showListingPanel);+ externalFunctionMerger =+ new ExternalFunctionMerger(this, mergeManager.isShowListingPanel());cuMerge = new CodeUnitMerger(this);functionMerger = new FunctionMerger(this);symbolMerger = new SymbolMerger(this);@@ -632,8 +624,8 @@ public class ListingMergeManager implements MergeResolver, ListingMergeConstants*/public AddressSet getMergedCodeUnits() {if (mergeManager != null) {- return (AddressSet) mergeManager.getResolveInformation(- MergeConstants.RESOLVED_CODE_UNITS);+ return (AddressSet) mergeManager+ .getResolveInformation(MergeConstants.RESOLVED_CODE_UNITS);}return new AddressSet();}diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/util/viewer/field/LabelFieldFactory.java b/Ghidra/Features/Base/src/main/java/ghidra/app/util/viewer/field/LabelFieldFactory.javaindex 60ba02be99..8b54022f1d 100644--- a/Ghidra/Features/Base/src/main/java/ghidra/app/util/viewer/field/LabelFieldFactory.java+++ b/Ghidra/Features/Base/src/main/java/ghidra/app/util/viewer/field/LabelFieldFactory.java@@ -156,7 +156,6 @@ public class LabelFieldFactory extends FieldFactory {// check to see if there is an offcut reference to this code unit// if there is, then create a "OFF" label- //List<Address> offcuts = getOffcutReferenceAddress(cu);boolean hasOffcuts = offcuts.size() > 0;@@ -269,11 +268,16 @@ public class LabelFieldFactory extends FieldFactory {private List<Address> getOffcutReferenceAddress(CodeUnit cu) {+ Address startAddr = cu.getMinAddress();+ if (!startAddr.isMemoryAddress()) {+ return Collections.emptyList();+ }+Program prog = cu.getProgram();if (cu.getLength() == 1) {return Collections.emptyList();}- Address nextAddr = cu.getMinAddress().next();+ Address nextAddr = startAddr.next();if (nextAddr == null) {return Collections.emptyList();}diff --git a/Ghidra/Framework/SoftwareModeling/src/main/java/ghidra/program/util/SimpleDiffUtility.java b/Ghidra/Framework/SoftwareModeling/src/main/java/ghidra/program/util/SimpleDiffUtility.javaindex ad8062f6e5..94487815bb 100644--- a/Ghidra/Framework/SoftwareModeling/src/main/java/ghidra/program/util/SimpleDiffUtility.java+++ b/Ghidra/Framework/SoftwareModeling/src/main/java/ghidra/program/util/SimpleDiffUtility.java@@ -4,9 +4,9 @@* Licensed under the Apache License, Version 2.0 (the "License");* you may not use this file except in compliance with the License.* You may obtain a copy of the License at- *+ ** http://www.apache.org/licenses/LICENSE-2.0- *+ ** Unless required by applicable law or agreed to in writing, software* distributed under the License is distributed on an "AS IS" BASIS,* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.@@ -250,7 +250,7 @@ public class SimpleDiffUtility {else if (addr.isExternalAddress()) {Symbol s = program.getSymbolTable().getPrimarySymbol(addr);if (s != null && s.isExternal()) {- s = getSymbol(s, otherProgram);+ s = getMatchingExternalSymbol(program, s, otherProgram, null);if (s != null) {return s.getAddress();}