diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/util/MemoryBlockUtils.java b/Ghidra/Features/Base/src/main/java/ghidra/app/util/MemoryBlockUtils.java index 09916a64cd..54115d3abf 100644 --- a/Ghidra/Features/Base/src/main/java/ghidra/app/util/MemoryBlockUtils.java +++ b/Ghidra/Features/Base/src/main/java/ghidra/app/util/MemoryBlockUtils.java @@ -108,8 +108,6 @@ public class MemoryBlockUtils { return null; } - - /** * Creates a new bit mapped memory block. (A bit mapped block is a block where each byte value * is either 1 or 0 and the value is taken from a bit in a byte at some other address in memory) @@ -279,12 +277,12 @@ public class MemoryBlockUtils { MemoryBlock block; try { try { - block = memory.createInitializedBlock(name, start, dataInput, dataLength, - monitor, isOverlay); + block = memory.createInitializedBlock(name, start, dataInput, dataLength, monitor, + isOverlay); } catch (MemoryConflictException e) { - block = memory.createInitializedBlock(name, start, dataInput, dataLength, - monitor, true); + block = memory.createInitializedBlock(name, start, dataInput, dataLength, monitor, + true); } } catch (LockException | DuplicateNameException | MemoryConflictException e) { @@ -325,11 +323,12 @@ public class MemoryBlockUtils { * @param program the program in which to create a new FileBytes object * @param provider the ByteProvider from which to get the bytes. * @return the newly created FileBytes object. + * @param monitor the monitor for canceling this potentially long running operation. * @throws IOException if an IOException occurred. */ - public static FileBytes createFileBytes(Program program, ByteProvider provider) - throws IOException { - return createFileBytes(program, provider, 0, provider.length()); + public static FileBytes createFileBytes(Program program, ByteProvider provider, + TaskMonitor monitor) throws IOException, CancelledException { + return createFileBytes(program, provider, 0, provider.length(), monitor); } /** @@ -338,14 +337,16 @@ public class MemoryBlockUtils { * @param provider the ByteProvider from which to get the bytes. * @param offset the offset into the ByteProvider from which to start loading bytes. * @param length the number of bytes to load + * @param monitor the monitor for canceling this potentially long running operation. * @return the newly created FileBytes object. * @throws IOException if an IOException occurred. + * @throws CancelledException if the user cancelled the operation */ public static FileBytes createFileBytes(Program program, ByteProvider provider, long offset, - long length) throws IOException { + long length, TaskMonitor monitor) throws IOException, CancelledException { Memory memory = program.getMemory(); try (InputStream fis = provider.getInputStream(offset)) { - return memory.createFileBytes(provider.getName(), offset, length, fis); + return memory.createFileBytes(provider.getName(), offset, length, fis, monitor); } } diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/util/opinion/BinaryLoader.java b/Ghidra/Features/Base/src/main/java/ghidra/app/util/opinion/BinaryLoader.java index 44ce058877..289cb21234 100644 --- a/Ghidra/Features/Base/src/main/java/ghidra/app/util/opinion/BinaryLoader.java +++ b/Ghidra/Features/Base/src/main/java/ghidra/app/util/opinion/BinaryLoader.java @@ -298,7 +298,7 @@ public class BinaryLoader extends AbstractProgramLoader { @Override protected boolean loadProgramInto(ByteProvider provider, LoadSpec loadSpec, List