Merge remote-tracking branch 'origin/GP-5457_dev747368_fix_gnunote_conflict'

This commit is contained in:
Ryan Kurtz
2025-03-07 05:54:49 -05:00
@@ -26,7 +26,7 @@ import ghidra.program.model.address.Address;
import ghidra.program.model.address.AddressOutOfBoundsException; import ghidra.program.model.address.AddressOutOfBoundsException;
import ghidra.program.model.data.*; import ghidra.program.model.data.*;
import ghidra.program.model.data.DataUtilities.ClearDataMode; import ghidra.program.model.data.DataUtilities.ClearDataMode;
import ghidra.program.model.listing.CodeUnit; import ghidra.program.model.listing.CommentType;
import ghidra.program.model.listing.Program; import ghidra.program.model.listing.Program;
import ghidra.program.model.mem.Memory; import ghidra.program.model.mem.Memory;
import ghidra.program.model.mem.MemoryBlock; import ghidra.program.model.mem.MemoryBlock;
@@ -133,16 +133,19 @@ public class StandardElfInfoProducer implements ElfInfoProducer {
br.align(4); // fix any notes with non-aligned size payloads br.align(4); // fix any notes with non-aligned size payloads
long noteLength = br.getPointerIndex() - start; long noteLength = br.getPointerIndex() - start;
try { if (DataUtilities.isUndefinedData(program, noteAddr)) {
StructureDataType struct = note.toStructure(program.getDataTypeManager()); try {
DataUtilities.createData(program, noteAddr, struct, -1, false, StructureDataType struct = note.toStructure(program.getDataTypeManager());
ClearDataMode.CLEAR_ALL_UNDEFINED_CONFLICT_DATA); DataUtilities.createData(program, noteAddr, struct, -1, false,
String comment = ClearDataMode.CLEAR_ALL_UNDEFINED_CONFLICT_DATA);
"ELF Note \"%s\", %xh".formatted(note.getName(), note.getVendorType()); String comment =
program.getListing().setComment(noteAddr, CodeUnit.EOL_COMMENT, comment); "ELF Note \"%s\", %xh".formatted(note.getName(), note.getVendorType());
} program.getListing().setComment(noteAddr, CommentType.EOL, comment);
catch (CodeUnitInsertionException e) { }
elfLoadHelper.log("Failed to markup ELF Note at " + noteAddr + ": data conflict"); catch (CodeUnitInsertionException e) {
elfLoadHelper
.log("Failed to markup ELF Note at " + noteAddr + ": data conflict");
}
} }
noteAddr = noteAddr.add(noteLength); noteAddr = noteAddr.add(noteLength);