mirror of
https://github.com/NationalSecurityAgency/ghidra.git
synced 2025-10-04 18:29:37 +02:00
GP-5480 Corrected Merge tool rendering of external locations within
multi-listing.
This commit is contained in:
parent
7b9183b2db
commit
905b4d78bd
4 changed files with 26 additions and 22 deletions
|
@ -4,9 +4,9 @@
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
* You may obtain a copy of the License at
|
* You may obtain a copy of the License at
|
||||||
*
|
*
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
*
|
*
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
@ -106,7 +106,6 @@ public class ProgramMultiUserMergeManager extends MergeManager {
|
||||||
ListingMergeManager listingMergeManager =
|
ListingMergeManager listingMergeManager =
|
||||||
new ListingMergeManager(this, resultProgram, originalProgram, latestProgram, myProgram,
|
new ListingMergeManager(this, resultProgram, originalProgram, latestProgram, myProgram,
|
||||||
(ProgramChangeSet) latestChangeSet, (ProgramChangeSet) myChangeSet);
|
(ProgramChangeSet) latestChangeSet, (ProgramChangeSet) myChangeSet);
|
||||||
listingMergeManager.setShowListingPanel(showListingPanels);
|
|
||||||
mergeResolvers[idx++] = listingMergeManager;
|
mergeResolvers[idx++] = listingMergeManager;
|
||||||
|
|
||||||
mergeResolvers[idx++] =
|
mergeResolvers[idx++] =
|
||||||
|
@ -406,6 +405,15 @@ public class ProgramMultiUserMergeManager extends MergeManager {
|
||||||
return isShowingListingMergePanel;
|
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 {
|
class MergeNavigatable implements Navigatable {
|
||||||
|
|
|
@ -4,9 +4,9 @@
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
* You may obtain a copy of the License at
|
* You may obtain a copy of the License at
|
||||||
*
|
*
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
*
|
*
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
@ -130,7 +130,6 @@ public class ListingMergeManager implements MergeResolver, ListingMergeConstants
|
||||||
|
|
||||||
private int totalConflictsInPhase; // Total number of conflicts for current phase of listing.
|
private int totalConflictsInPhase; // Total number of conflicts for current phase of listing.
|
||||||
private int conflictNum; // Current conflict number being resolved.
|
private int conflictNum; // Current conflict number being resolved.
|
||||||
private boolean showListingPanel = true;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Manages listing changes and conflicts between the latest versioned
|
* Manages listing changes and conflicts between the latest versioned
|
||||||
|
@ -160,14 +159,6 @@ public class ListingMergeManager implements MergeResolver, ListingMergeConstants
|
||||||
return functionTagMerger;
|
return 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)
|
/* (non-Javadoc)
|
||||||
* @see ghidra.app.merge.MergeResolver#apply()
|
* @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().
|
* determine conflicts. The conflicts are handled later by calling manualMerge().
|
||||||
*/
|
*/
|
||||||
private void initializeMergers() {
|
private void initializeMergers() {
|
||||||
externalFunctionMerger = new ExternalFunctionMerger(this, showListingPanel);
|
externalFunctionMerger =
|
||||||
|
new ExternalFunctionMerger(this, mergeManager.isShowListingPanel());
|
||||||
cuMerge = new CodeUnitMerger(this);
|
cuMerge = new CodeUnitMerger(this);
|
||||||
functionMerger = new FunctionMerger(this);
|
functionMerger = new FunctionMerger(this);
|
||||||
symbolMerger = new SymbolMerger(this);
|
symbolMerger = new SymbolMerger(this);
|
||||||
|
@ -632,8 +624,8 @@ public class ListingMergeManager implements MergeResolver, ListingMergeConstants
|
||||||
*/
|
*/
|
||||||
public AddressSet getMergedCodeUnits() {
|
public AddressSet getMergedCodeUnits() {
|
||||||
if (mergeManager != null) {
|
if (mergeManager != null) {
|
||||||
return (AddressSet) mergeManager.getResolveInformation(
|
return (AddressSet) mergeManager
|
||||||
MergeConstants.RESOLVED_CODE_UNITS);
|
.getResolveInformation(MergeConstants.RESOLVED_CODE_UNITS);
|
||||||
}
|
}
|
||||||
return new AddressSet();
|
return new AddressSet();
|
||||||
}
|
}
|
||||||
|
|
|
@ -156,7 +156,6 @@ public class LabelFieldFactory extends FieldFactory {
|
||||||
|
|
||||||
// check to see if there is an offcut reference to this code unit
|
// check to see if there is an offcut reference to this code unit
|
||||||
// if there is, then create a "OFF" label
|
// if there is, then create a "OFF" label
|
||||||
//
|
|
||||||
List<Address> offcuts = getOffcutReferenceAddress(cu);
|
List<Address> offcuts = getOffcutReferenceAddress(cu);
|
||||||
boolean hasOffcuts = offcuts.size() > 0;
|
boolean hasOffcuts = offcuts.size() > 0;
|
||||||
|
|
||||||
|
@ -269,11 +268,16 @@ public class LabelFieldFactory extends FieldFactory {
|
||||||
|
|
||||||
private List<Address> getOffcutReferenceAddress(CodeUnit cu) {
|
private List<Address> getOffcutReferenceAddress(CodeUnit cu) {
|
||||||
|
|
||||||
|
Address startAddr = cu.getMinAddress();
|
||||||
|
if (!startAddr.isMemoryAddress()) {
|
||||||
|
return Collections.emptyList();
|
||||||
|
}
|
||||||
|
|
||||||
Program prog = cu.getProgram();
|
Program prog = cu.getProgram();
|
||||||
if (cu.getLength() == 1) {
|
if (cu.getLength() == 1) {
|
||||||
return Collections.emptyList();
|
return Collections.emptyList();
|
||||||
}
|
}
|
||||||
Address nextAddr = cu.getMinAddress().next();
|
Address nextAddr = startAddr.next();
|
||||||
if (nextAddr == null) {
|
if (nextAddr == null) {
|
||||||
return Collections.emptyList();
|
return Collections.emptyList();
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,9 +4,9 @@
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
* You may obtain a copy of the License at
|
* You may obtain a copy of the License at
|
||||||
*
|
*
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
*
|
*
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
@ -250,7 +250,7 @@ public class SimpleDiffUtility {
|
||||||
else if (addr.isExternalAddress()) {
|
else if (addr.isExternalAddress()) {
|
||||||
Symbol s = program.getSymbolTable().getPrimarySymbol(addr);
|
Symbol s = program.getSymbolTable().getPrimarySymbol(addr);
|
||||||
if (s != null && s.isExternal()) {
|
if (s != null && s.isExternal()) {
|
||||||
s = getSymbol(s, otherProgram);
|
s = getMatchingExternalSymbol(program, s, otherProgram, null);
|
||||||
if (s != null) {
|
if (s != null) {
|
||||||
return s.getAddress();
|
return s.getAddress();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue