diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/util/MemoryBlockUtil.java b/Ghidra/Features/Base/src/main/java/ghidra/app/util/MemoryBlockUtil.java index dd349e6be9..e7349386d9 100644 --- a/Ghidra/Features/Base/src/main/java/ghidra/app/util/MemoryBlockUtil.java +++ b/Ghidra/Features/Base/src/main/java/ghidra/app/util/MemoryBlockUtil.java @@ -19,7 +19,6 @@ import java.io.*; import java.util.ArrayList; import java.util.List; -import ghidra.app.util.importer.MemoryConflictHandler; import ghidra.framework.store.LockException; import ghidra.program.model.address.*; import ghidra.program.model.listing.*; @@ -47,19 +46,16 @@ public class MemoryBlockUtil { private Listing listing; private Memory memory; private SymbolTable symbolTable; - private MemoryConflictHandler handler; private StringBuffer messages; /** * Constructs a new memory block utility. * @param program the program having memory blocks created - * @param handler the memory conflict handler */ - public MemoryBlockUtil(Program program, MemoryConflictHandler handler) { + public MemoryBlockUtil(Program program) { this.listing = program.getListing(); this.memory = program.getMemory(); this.symbolTable = program.getSymbolTable(); - this.handler = handler; this.messages = new StringBuffer(); } @@ -78,7 +74,6 @@ public class MemoryBlockUtil { public void dispose() { listing = null; memory = null; - handler = null; } /** @@ -317,7 +312,7 @@ public class MemoryBlockUtil { boolean shouldOverwriteBlock = true; if (existingBlocks.length > 0) { - shouldOverwriteBlock = handler.allowOverwrite(start, end); + shouldOverwriteBlock = /*handler.allowOverwrite(start, end);*/ true; } //TODO: collect all user references in (start,end) diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/util/importer/AutoImporter.java b/Ghidra/Features/Base/src/main/java/ghidra/app/util/importer/AutoImporter.java index c2587dacd3..bf20623e82 100644 --- a/Ghidra/Features/Base/src/main/java/ghidra/app/util/importer/AutoImporter.java +++ b/Ghidra/Features/Base/src/main/java/ghidra/app/util/importer/AutoImporter.java @@ -272,8 +272,7 @@ public final class AutoImporter { public static boolean importAddToProgram(File file, Program program, MessageLog messageLog, TaskMonitor monitor, Predicate loaderFilter, LoadSpecChooser loadSpecChooser, - OptionChooser optionChooser, MemoryConflictHandler memoryConflictHandler) - throws IOException, CancelledException { + OptionChooser optionChooser) throws IOException, CancelledException { if (file == null) { return false; } @@ -347,7 +346,7 @@ public final class AutoImporter { try (RandomAccessByteProvider provider = new RandomAccessByteProvider(file)) { return loadSpec.getLoader().loadInto(provider, loadSpec, options, messageLog, program, - monitor, memoryConflictHandler); + monitor); } } } diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/util/importer/MemoryConflictHandler.java b/Ghidra/Features/Base/src/main/java/ghidra/app/util/importer/MemoryConflictHandler.java deleted file mode 100644 index ce2a702c6d..0000000000 --- a/Ghidra/Features/Base/src/main/java/ghidra/app/util/importer/MemoryConflictHandler.java +++ /dev/null @@ -1,53 +0,0 @@ -/* ### - * IP: GHIDRA - * REVIEWED: YES - * - * 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. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package ghidra.app.util.importer; - -import ghidra.program.model.address.Address; - -/** - * An interface for handling memory block conflicts - * that are encountered during an import. - * - */ -public interface MemoryConflictHandler { - /** - * An implementation that always overwrites conflicts. - */ - public final static MemoryConflictHandler ALWAYS_OVERWRITE = new MemoryConflictHandler() { - public boolean allowOverwrite(Address start, Address end) { - return true; - } - }; - /** - * An implementation that never overwrites conflicts. - */ - public final static MemoryConflictHandler NEVER_OVERWRITE = new MemoryConflictHandler() { - public boolean allowOverwrite(Address start, Address end) { - return false; - } - }; - /** - * This method is invoked when a memory block conflict - * is detected. The start and end addresses of the conflict - * are passed into the method. To overwrite the conflict, return true. - * Otherwise return false to NOT overwrite the conflict. - * @param start the start address of the conflict - * @param end the end address of the conflict - * @return true to overwrite the conflict - */ - public boolean allowOverwrite(Address start, Address end); -} diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/util/opinion/AbstractLibrarySupportLoader.java b/Ghidra/Features/Base/src/main/java/ghidra/app/util/opinion/AbstractLibrarySupportLoader.java index b4c3124459..69cc915f9a 100644 --- a/Ghidra/Features/Base/src/main/java/ghidra/app/util/opinion/AbstractLibrarySupportLoader.java +++ b/Ghidra/Features/Base/src/main/java/ghidra/app/util/opinion/AbstractLibrarySupportLoader.java @@ -25,7 +25,8 @@ import org.apache.commons.io.FilenameUtils; import ghidra.app.util.Option; import ghidra.app.util.bin.ByteProvider; import ghidra.app.util.bin.RandomAccessByteProvider; -import ghidra.app.util.importer.*; +import ghidra.app.util.importer.LibrarySearchPathManager; +import ghidra.app.util.importer.MessageLog; import ghidra.formats.gfilesystem.FSRL; import ghidra.framework.model.*; import ghidra.framework.options.Options; @@ -59,14 +60,13 @@ public abstract class AbstractLibrarySupportLoader extends AbstractProgramLoader * @param loadSpec The {@link LoadSpec} to use during load. * @param options The load options. * @param program The {@link Program} to load into. - * @param handler How to handle memory conflicts that occur during the load. * @param monitor A cancelable task monitor. * @param log The message log. * @throws IOException if there was an IO-related problem loading. * @throws CancelledException if the user cancelled the load. */ protected abstract void load(ByteProvider provider, LoadSpec loadSpec, List