diff --git a/Ghidra/Features/Base/src/main/help/help/topics/MemoryMapPlugin/Memory_Map.htm b/Ghidra/Features/Base/src/main/help/help/topics/MemoryMapPlugin/Memory_Map.htm
index af5d704f95..d51ab19d50 100644
--- a/Ghidra/Features/Base/src/main/help/help/topics/MemoryMapPlugin/Memory_Map.htm
+++ b/Ghidra/Features/Base/src/main/help/help/topics/MemoryMapPlugin/Memory_Map.htm
@@ -134,10 +134,10 @@
this property applies to Default and Overlay blocks.
Byte Source - Provides information about the source of the bytes in this
- block. If the bytes were originally imported from a file, then this will indicate which file
- and the offset into that file. If the bytes are mapped to another region of memory, it will
- provide the address for the mapping. Blocks may consist of regions that have different
- sources. In that case, source information about the first several regions will be
+ block. A block is made up of one or more sub-blocks. Each sub-block is listed by its type,
+ size, and other type-specific information. For example, if the bytes were originally imported
+ from a file, then the file name and the offset into that file is displayed. If the bytes are
+ mapped to another region of memory, then the start address for the mapping will be
displayed.
Source - Description of block origination.
diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/memory/MemoryMapModel.java b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/memory/MemoryMapModel.java
index 4190477859..8dc4c77cc3 100644
--- a/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/memory/MemoryMapModel.java
+++ b/Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/memory/MemoryMapModel.java
@@ -467,7 +467,7 @@ class MemoryMapModel extends AbstractSortedTableModel implements Pr
String description = limited
.stream()
.map(info -> info.getDescription())
- .collect(Collectors.joining(", "));
+ .collect(Collectors.joining(" | "));
//@formatter:on
if (limited != sourceInfos) {
description += "...";
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 083c4c87b5..2506204254 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
@@ -209,7 +209,7 @@ public class MemoryBlockUtils {
* @param w the write permission for the new block.
* @param x the execute permission for the new block.
* @param log a {@link MessageLog} for appending error messages
- * @return the new created block
+ * @return the newly created block or null if the operation failed
* @throws AddressOverflowException if the address
*/
public static MemoryBlock createInitializedBlock(Program program, boolean isOverlay,
@@ -262,7 +262,7 @@ public class MemoryBlockUtils {
* @param x the execute permission for the new block.
* @param log a {@link MessageLog} for appending error messages
* @param monitor the monitor for canceling this potentially long running operation.
- * @return the new created block
+ * @return the newly created block or null if the operation failed
* @throws AddressOverflowException if the address
*/
public static MemoryBlock createInitializedBlock(Program program, boolean isOverlay,
diff --git a/Ghidra/Features/Base/src/main/java/ghidra/app/util/opinion/PeLoader.java b/Ghidra/Features/Base/src/main/java/ghidra/app/util/opinion/PeLoader.java
index 5643e80aa8..3e78175f41 100644
--- a/Ghidra/Features/Base/src/main/java/ghidra/app/util/opinion/PeLoader.java
+++ b/Ghidra/Features/Base/src/main/java/ghidra/app/util/opinion/PeLoader.java
@@ -46,6 +46,7 @@ import ghidra.program.model.address.*;
import ghidra.program.model.data.*;
import ghidra.program.model.listing.*;
import ghidra.program.model.mem.MemoryAccessException;
+import ghidra.program.model.mem.MemoryBlock;
import ghidra.program.model.reloc.Relocation.Status;
import ghidra.program.model.reloc.RelocationTable;
import ghidra.program.model.symbol.*;
@@ -671,6 +672,7 @@ public class PeLoader extends AbstractPeDebugLoader {
int rawDataSize = sections[i].getSizeOfRawData();
int rawDataPtr = sections[i].getPointerToRawData();
virtualSize = sections[i].getVirtualSize();
+ MemoryBlock block = null;
if (rawDataSize != 0 && rawDataPtr != 0) {
int dataSize =
((rawDataSize > virtualSize && virtualSize > 0) || rawDataSize < 0)
@@ -682,8 +684,8 @@ public class PeLoader extends AbstractPeDebugLoader {
Msg.warn(this, "OptionalHeader.SizeOfImage < size of " +
sections[i].getName() + " section");
}
- MemoryBlockUtils.createInitializedBlock(prog, false, sectionName, address,
- fileBytes, rawDataPtr, dataSize, "", "", r, w, x, log);
+ block = MemoryBlockUtils.createInitializedBlock(prog, false, sectionName,
+ address, fileBytes, rawDataPtr, dataSize, "", "", r, w, x, log);
sectionToAddress.put(sections[i], address);
}
if (rawDataSize == virtualSize) {
@@ -711,9 +713,24 @@ public class PeLoader extends AbstractPeDebugLoader {
else {
int dataSize = (virtualSize > 0 || rawDataSize < 0) ? virtualSize : 0;
if (dataSize > 0) {
- MemoryBlockUtils.createUninitializedBlock(prog, false, sectionName, address,
- dataSize, "", "", r, w, x, log);
- sectionToAddress.putIfAbsent(sections[i], address);
+ if (block != null) {
+ MemoryBlock paddingBlock =
+ MemoryBlockUtils.createInitializedBlock(prog, false, sectionName,
+ address, dataSize, "", "", r, w, x, log);
+ if (paddingBlock != null) {
+ try {
+ prog.getMemory().join(block, paddingBlock);
+ }
+ catch (Exception e) {
+ log.appendMsg(e.getMessage());
+ }
+ }
+ }
+ else {
+ MemoryBlockUtils.createUninitializedBlock(prog, false, sectionName,
+ address, dataSize, "", "", r, w, x, log);
+ sectionToAddress.putIfAbsent(sections[i], address);
+ }
}
}
diff --git a/Ghidra/Framework/SoftwareModeling/src/main/java/ghidra/program/database/mem/BitMappedSubMemoryBlock.java b/Ghidra/Framework/SoftwareModeling/src/main/java/ghidra/program/database/mem/BitMappedSubMemoryBlock.java
index dfa7eea60a..a1dd0b97b6 100644
--- a/Ghidra/Framework/SoftwareModeling/src/main/java/ghidra/program/database/mem/BitMappedSubMemoryBlock.java
+++ b/Ghidra/Framework/SoftwareModeling/src/main/java/ghidra/program/database/mem/BitMappedSubMemoryBlock.java
@@ -179,7 +179,7 @@ class BitMappedSubMemoryBlock extends SubMemoryBlock {
@Override
protected String getDescription() {
- return "Bit Mapped: " + mappedAddress;
+ return "bitmap[0x%x, 0x%x, %s]".formatted(subBlockOffset, subBlockLength, mappedAddress);
}
}
diff --git a/Ghidra/Framework/SoftwareModeling/src/main/java/ghidra/program/database/mem/BufferSubMemoryBlock.java b/Ghidra/Framework/SoftwareModeling/src/main/java/ghidra/program/database/mem/BufferSubMemoryBlock.java
index 323afbc166..565978723e 100644
--- a/Ghidra/Framework/SoftwareModeling/src/main/java/ghidra/program/database/mem/BufferSubMemoryBlock.java
+++ b/Ghidra/Framework/SoftwareModeling/src/main/java/ghidra/program/database/mem/BufferSubMemoryBlock.java
@@ -117,6 +117,6 @@ class BufferSubMemoryBlock extends SubMemoryBlock {
@Override
protected String getDescription() {
- return "";
+ return "init[0x%x]".formatted(subBlockLength);
}
}
diff --git a/Ghidra/Framework/SoftwareModeling/src/main/java/ghidra/program/database/mem/ByteMappedSubMemoryBlock.java b/Ghidra/Framework/SoftwareModeling/src/main/java/ghidra/program/database/mem/ByteMappedSubMemoryBlock.java
index 2541ae8715..23c055ccaf 100644
--- a/Ghidra/Framework/SoftwareModeling/src/main/java/ghidra/program/database/mem/ByteMappedSubMemoryBlock.java
+++ b/Ghidra/Framework/SoftwareModeling/src/main/java/ghidra/program/database/mem/ByteMappedSubMemoryBlock.java
@@ -199,7 +199,7 @@ class ByteMappedSubMemoryBlock extends SubMemoryBlock {
@Override
protected String getDescription() {
- return "Byte Mapped: " + mappedAddress + ", " + byteMappingScheme;
+ return "bytemap[0x%x, 0x%x, %s]".formatted(subBlockOffset, subBlockLength, mappedAddress);
}
}
diff --git a/Ghidra/Framework/SoftwareModeling/src/main/java/ghidra/program/database/mem/FileBytesSubMemoryBlock.java b/Ghidra/Framework/SoftwareModeling/src/main/java/ghidra/program/database/mem/FileBytesSubMemoryBlock.java
index 58c7e875d8..e01c790023 100644
--- a/Ghidra/Framework/SoftwareModeling/src/main/java/ghidra/program/database/mem/FileBytesSubMemoryBlock.java
+++ b/Ghidra/Framework/SoftwareModeling/src/main/java/ghidra/program/database/mem/FileBytesSubMemoryBlock.java
@@ -112,10 +112,8 @@ class FileBytesSubMemoryBlock extends SubMemoryBlock {
@Override
protected String getDescription() {
- String fileName = fileBytes.getFilename();
-
- String hexString = Long.toHexString(fileBytesOffset + fileBytes.getFileOffset());
- return "File: " + fileName + ": 0x" + hexString;
+ return "%s[0x%x, 0x%x]".formatted(fileBytes.getFilename(),
+ fileBytesOffset + fileBytes.getFileOffset(), subBlockLength);
}
@Override
diff --git a/Ghidra/Framework/SoftwareModeling/src/main/java/ghidra/program/database/mem/UninitializedSubMemoryBlock.java b/Ghidra/Framework/SoftwareModeling/src/main/java/ghidra/program/database/mem/UninitializedSubMemoryBlock.java
index 1b89c52c22..f1002be562 100644
--- a/Ghidra/Framework/SoftwareModeling/src/main/java/ghidra/program/database/mem/UninitializedSubMemoryBlock.java
+++ b/Ghidra/Framework/SoftwareModeling/src/main/java/ghidra/program/database/mem/UninitializedSubMemoryBlock.java
@@ -86,7 +86,6 @@ class UninitializedSubMemoryBlock extends SubMemoryBlock {
@Override
protected String getDescription() {
- return "";
+ return "uninit[0x%x]".formatted(subBlockLength);
}
-
}