From 18b1d9e6c6fefae0bd69fe046bf469b1d7b56757 Mon Sep 17 00:00:00 2001 From: James <49045138+ghidracadabra@users.noreply.github.com> Date: Tue, 17 Dec 2024 17:52:27 +0000 Subject: [PATCH] GP-0 corrected additional diff apply failures --- .../core/diff/DiffApplySettingsOptionManager.java | 10 ++++++++-- .../app/plugin/core/diff/DiffApplyTestAdapter.java | 3 +++ .../app/plugin/core/diff/DiffSaveSettingsTest.java | 9 +++++++-- 3 files changed, 18 insertions(+), 4 deletions(-) diff --git a/Ghidra/Features/ProgramDiff/src/main/java/ghidra/app/plugin/core/diff/DiffApplySettingsOptionManager.java b/Ghidra/Features/ProgramDiff/src/main/java/ghidra/app/plugin/core/diff/DiffApplySettingsOptionManager.java index 0f0d1231a8..9bcbe4ff68 100644 --- a/Ghidra/Features/ProgramDiff/src/main/java/ghidra/app/plugin/core/diff/DiffApplySettingsOptionManager.java +++ b/Ghidra/Features/ProgramDiff/src/main/java/ghidra/app/plugin/core/diff/DiffApplySettingsOptionManager.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. @@ -20,6 +20,7 @@ import ghidra.framework.plugintool.Plugin; import ghidra.framework.plugintool.PluginTool; import ghidra.program.util.ProgramMergeFilter; import ghidra.util.HelpLocation; +import ghidra.util.Msg; /** * Manages the options for the Diff apply settings. @@ -396,6 +397,8 @@ class DiffApplySettingsOptionManager { return ProgramMergeFilter.SYMBOLS; case FUNCTION_TAGS: return ProgramMergeFilter.FUNCTION_TAGS; + case SOURCE_MAP: + return ProgramMergeFilter.SOURCE_MAP; default: return 0; } @@ -436,6 +439,8 @@ class DiffApplySettingsOptionManager { return OPTION_SYMBOLS; case FUNCTION_TAGS: return OPTION_FUNCTION_TAGS; + case SOURCE_MAP: + return OPTION_SOURCE_MAP; default: return null; } @@ -520,6 +525,7 @@ class DiffApplySettingsOptionManager { private REPLACE_CHOICE convertTypeToReplaceEnum(ProgramMergeFilter defaultApplyFilter, int type) { int filter = defaultApplyFilter.getFilter(type); + Msg.info(this, "type: " + Integer.toHexString(filter) + " filter: " + filter); return REPLACE_CHOICE.values()[filter]; } diff --git a/Ghidra/Features/ProgramDiff/src/test.slow/java/ghidra/app/plugin/core/diff/DiffApplyTestAdapter.java b/Ghidra/Features/ProgramDiff/src/test.slow/java/ghidra/app/plugin/core/diff/DiffApplyTestAdapter.java index ba6d813de1..3c254d2410 100644 --- a/Ghidra/Features/ProgramDiff/src/test.slow/java/ghidra/app/plugin/core/diff/DiffApplyTestAdapter.java +++ b/Ghidra/Features/ProgramDiff/src/test.slow/java/ghidra/app/plugin/core/diff/DiffApplyTestAdapter.java @@ -48,6 +48,7 @@ public class DiffApplyTestAdapter extends DiffTestAdapter { JComboBox bookmarkApplyCB; JComboBox propertiesApplyCB; JComboBox functionTagApplyCB; + JComboBox sourceMapApplyCB; public DiffApplyTestAdapter() { super(); @@ -222,6 +223,8 @@ public class DiffApplyTestAdapter extends DiffTestAdapter { (JComboBox) findComponentByName(settingsPanel, "Properties Diff Apply CB"); functionTagApplyCB = (JComboBox) findComponentByName(settingsPanel, "Function Tags Diff Apply CB"); + sourceMapApplyCB = + (JComboBox) findComponentByName(settingsPanel, "Source Map Diff Apply CB"); } void checkDiffSelection(AddressSetView addrSet) { diff --git a/Ghidra/Features/ProgramDiff/src/test.slow/java/ghidra/app/plugin/core/diff/DiffSaveSettingsTest.java b/Ghidra/Features/ProgramDiff/src/test.slow/java/ghidra/app/plugin/core/diff/DiffSaveSettingsTest.java index 2aabab143a..c8bff0cb5f 100644 --- a/Ghidra/Features/ProgramDiff/src/test.slow/java/ghidra/app/plugin/core/diff/DiffSaveSettingsTest.java +++ b/Ghidra/Features/ProgramDiff/src/test.slow/java/ghidra/app/plugin/core/diff/DiffSaveSettingsTest.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. @@ -136,6 +136,7 @@ public class DiffSaveSettingsTest extends DiffApplyTestAdapter { isReplace(functionApplyCB); isReplace(bookmarkApplyCB); isReplace(propertiesApplyCB); + isIgnore(sourceMapApplyCB); // Change the apply settings. ignore(programContextApplyCB); @@ -151,6 +152,7 @@ public class DiffSaveSettingsTest extends DiffApplyTestAdapter { ignore(functionApplyCB); ignore(bookmarkApplyCB); ignore(propertiesApplyCB); + replace(sourceMapApplyCB); // Save the settings. DockingActionIf saveApplySettingsAction = @@ -172,6 +174,7 @@ public class DiffSaveSettingsTest extends DiffApplyTestAdapter { isIgnore(functionApplyCB); isIgnore(bookmarkApplyCB); isIgnore(propertiesApplyCB); + isReplace(sourceMapApplyCB); ProgramManagerPlugin pm = getPlugin(tool, ProgramManagerPlugin.class); DockingActionIf closeAllProgramAction = getAction(pm, "Close All"); @@ -197,6 +200,7 @@ public class DiffSaveSettingsTest extends DiffApplyTestAdapter { isIgnore(functionApplyCB); isIgnore(bookmarkApplyCB); isIgnore(propertiesApplyCB); + isReplace(sourceMapApplyCB); DockingActionIf closeToolAction = getToolAction(tool, "Close Tool"); performAction(closeToolAction, false); @@ -226,6 +230,7 @@ public class DiffSaveSettingsTest extends DiffApplyTestAdapter { isIgnore(functionApplyCB); isIgnore(bookmarkApplyCB); isIgnore(propertiesApplyCB); + isReplace(sourceMapApplyCB); closeOurTool(); }