GP-5742 Cleanup preferred CommentType enum use. Changed SARIF data component comment JSON serialization from int to String.

This commit is contained in:
ghidra1 2025-06-06 17:58:07 -04:00
parent 4a65e9af3b
commit 8c441250f5
211 changed files with 4627 additions and 4860 deletions

View file

@ -26,7 +26,7 @@ import ghidra.app.services.DebuggerTraceManagerService;
import ghidra.program.model.address.*;
import ghidra.program.model.data.PointerDataType;
import ghidra.program.model.lang.*;
import ghidra.program.model.listing.CodeUnit;
import ghidra.program.model.listing.CommentType;
import ghidra.program.model.listing.Instruction;
import ghidra.program.model.symbol.SourceType;
import ghidra.program.model.util.CodeUnitInsertionException;
@ -236,8 +236,7 @@ public class PopulateDemoTrace extends GhidraScript {
return;
}
TraceCodeSpace code =
thread.getTrace().getCodeManager().getCodeRegisterSpace(thread, true);
TraceCodeSpace code = thread.getTrace().getCodeManager().getCodeRegisterSpace(thread, true);
code.definedUnits().clear(Lifespan.nowOn(tick), reg, TaskMonitor.DUMMY);
code.definedData().create(Lifespan.nowOn(tick), reg, PointerDataType.dataType);
}
@ -344,20 +343,16 @@ public class PopulateDemoTrace extends GhidraScript {
*/
mainLabel = trace.getSymbolManager()
.labels()
.create(snap, null, addr(0x00400000),
"main", global, SourceType.USER_DEFINED);
.create(snap, null, addr(0x00400000), "main", global, SourceType.USER_DEFINED);
cloneLabel = trace.getSymbolManager()
.labels()
.create(snap, null, addr(0x00400060),
"clone", global, SourceType.USER_DEFINED);
.create(snap, null, addr(0x00400060), "clone", global, SourceType.USER_DEFINED);
childLabel = trace.getSymbolManager()
.labels()
.create(snap, null, addr(0x00400034),
"child", global, SourceType.USER_DEFINED);
.create(snap, null, addr(0x00400034), "child", global, SourceType.USER_DEFINED);
exitLabel = trace.getSymbolManager()
.labels()
.create(snap, null, addr(0x00400061),
"exit", global, SourceType.USER_DEFINED);
.create(snap, null, addr(0x00400061), "exit", global, SourceType.USER_DEFINED);
/**
* Note the use of getProgramView as a means of using components intended for Program
@ -409,8 +404,7 @@ public class PopulateDemoTrace extends GhidraScript {
trace.getCodeManager()
.codeUnits()
.getAt(0, cloneLabel.getAddress())
.setComment(
CodeUnit.EOL_COMMENT, "Pretend this is a syscall");
.setComment(CommentType.EOL, "Pretend this is a syscall");
/**
* Stub out "exit"
@ -419,8 +413,7 @@ public class PopulateDemoTrace extends GhidraScript {
trace.getCodeManager()
.codeUnits()
.getAt(0, exitLabel.getAddress())
.setComment(
CodeUnit.EOL_COMMENT, "Pretend this is a syscall");
.setComment(CommentType.EOL, "Pretend this is a syscall");
/**
* "Launch" the program by initializing RIP and RSP of the main thread
@ -504,10 +497,10 @@ public class PopulateDemoTrace extends GhidraScript {
regs2.putBytes(snap, reg("RSP"),
buf.clear().putLong(STACK2_BOTTOM + stack2offset).flip());
regs2.putBytes(snap, reg("RAX"), buf.clear().putLong(1).flip());
memory.putBytes(snap, addr(STACK2_BOTTOM + stack2offset), buf.clear()
.putLong(
mainInstructions.get(pc2 = pc1).getAddress().getOffset())
.flip());
memory.putBytes(snap, addr(STACK2_BOTTOM + stack2offset),
buf.clear()
.putLong(mainInstructions.get(pc2 = pc1).getAddress().getOffset())
.flip());
placeRegUnits(snap, thread1);
placeRegUnits(snap, thread2);