Skip to content

Ghidra is a software reverse engineering (SRE) framework

Merge remote-tracking branch 'origin/GP-3753_ryanmkurtz_dyld-workflow--SQUASHED' (Closes #5023)

Ryan Kurtz0574064ce7da
diff --cc Ghidra/Features/Base/src/main/java/ghidra/app/util/opinion/MachoProgramBuilder.java
index 91c7b9bce5,ccebcf8d93..fee24e8a81
--- a/Ghidra/Features/Base/src/main/java/ghidra/app/util/opinion/MachoProgramBuilder.java
+++ b/Ghidra/Features/Base/src/main/java/ghidra/app/util/opinion/MachoProgramBuilder.java
@@@ -331,11 -337,20 +331,16 @@@ public class MachoProgramBuilder
/**
* Fixes up the Program Tree to better visualize the memory blocks that were split into sections
*
+ * @param suffix An optional suffix that will get appended to tree segment and segment nodes
* @throws Exception if there was a problem fixing up the Program Tree
*/
- protected void fixupProgramTree() throws Exception {
+ protected void fixupProgramTree(String suffix)
+ throws Exception {
+ if (suffix == null) {
+ suffix = "";
+ }
ProgramModule rootModule = listing.getDefaultRootModule();
- ListIterator<SegmentCommand> it = machoHeader.getAllSegments().listIterator();
- while (it.hasNext()) {
- int i = it.nextIndex();
- SegmentCommand segment = it.next();
-
+ for (SegmentCommand segment : machoHeader.getAllSegments()) {
if (segment.getVMsize() == 0) {
continue;
}
@@@ -351,7 -366,10 +356,7 @@@
// section fragments, it will represent the parts of the segment that weren't in any
// section.
String segmentName = segment.getSegmentName();
- String noSectionsName = segmentName + " <no section>";
- if (segmentName.isBlank()) {
- segmentName = "SEGMENT." + i;
- }
+ String noSectionsName = segmentName + " <no section>" + suffix;
ProgramFragment segmentFragment = null;
for (Group group : rootModule.getChildren()) {
if (group instanceof ProgramFragment fragment &&