Compare commits
3
Commits
5b316bbd64
...
116aa5f303
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
116aa5f303
|
||
|
|
2d9837219c
|
||
|
|
fabf7745ee
|
Binary file not shown.
BIN
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,15 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<PROJECT>
|
||||
<PROJECT_DATA_XML_NAME NAME="DISPLAY_DATA">
|
||||
<SAVE_STATE>
|
||||
<ARRAY NAME="EXPANDED_PATHS" TYPE="string">
|
||||
<A VALUE="2026-04-18T17-48-31_sum0_base-fail-c:" />
|
||||
</ARRAY>
|
||||
<STATE NAME="SHOW_TABLE" TYPE="boolean" VALUE="false" />
|
||||
</SAVE_STATE>
|
||||
</PROJECT_DATA_XML_NAME>
|
||||
<TOOL_MANAGER ACTIVE_WORKSPACE="Workspace">
|
||||
<WORKSPACE NAME="Workspace" ACTIVE="true" />
|
||||
</TOOL_MANAGER>
|
||||
</PROJECT>
|
||||
|
||||
Binary file not shown.
BIN
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
ghidra/projects/2026-04-18T17-48-31_sum1_repl_naive_late-fail-aot.rep/idata/00/~00000000.db/db.1.gbf
LFS
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
LFS
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
ghidra/projects/2026-04-18T17-48-31_sum2_repl_cored_late-fail-aot.rep/idata/00/~00000000.db/db.1.gbf
LFS
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
LFS
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
@@ -0,0 +1,15 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<PROJECT>
|
||||
<PROJECT_DATA_XML_NAME NAME="DISPLAY_DATA">
|
||||
<SAVE_STATE>
|
||||
<ARRAY NAME="EXPANDED_PATHS" TYPE="string">
|
||||
<A VALUE="2026-04-18T17-48-31_sum2_repl_cored_late-fail-interp:" />
|
||||
</ARRAY>
|
||||
<STATE NAME="SHOW_TABLE" TYPE="boolean" VALUE="false" />
|
||||
</SAVE_STATE>
|
||||
</PROJECT_DATA_XML_NAME>
|
||||
<TOOL_MANAGER ACTIVE_WORKSPACE="Workspace">
|
||||
<WORKSPACE NAME="Workspace" ACTIVE="true" />
|
||||
</TOOL_MANAGER>
|
||||
</PROJECT>
|
||||
|
||||
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
@@ -1,8 +1,3 @@
|
||||
// CSV format per line:
|
||||
// 0x401000,<count>
|
||||
//
|
||||
// Creates NOTE bookmarks in category: FAIL_MARKER
|
||||
|
||||
import ghidra.app.script.GhidraScript;
|
||||
import ghidra.program.model.address.Address;
|
||||
import ghidra.program.model.listing.BookmarkManager;
|
||||
@@ -12,46 +7,63 @@ import java.io.FileReader;
|
||||
|
||||
public class ImportMarkersAsBookmarks extends GhidraScript {
|
||||
|
||||
private static final String BOOKMARK_TYPE = "NOTE";
|
||||
private static final String BOOKMARK_CATEGORY = "FAIL_MARKER";
|
||||
|
||||
@Override
|
||||
public void run() throws Exception {
|
||||
File input = askFile("Select CSV file", "Import");
|
||||
// Can't do this in headless mode
|
||||
// File input = askFile("Select CSV file", "Import");
|
||||
|
||||
String[] args = getScriptArgs();
|
||||
if (args.length < 1) {
|
||||
throw new IllegalArgumentException(
|
||||
"Missing CSV file path.\nUsage: ImportMarkersAsBookmarks <markers.csv>");
|
||||
}
|
||||
|
||||
File input = new File(args[0]);
|
||||
if (!input.isFile()) {
|
||||
throw new IllegalArgumentException(
|
||||
"CSV file does not exist or is not a regular file: " + input.getAbsolutePath());
|
||||
}
|
||||
|
||||
println("Importing bookmarks from: " + input.getAbsolutePath());
|
||||
|
||||
// https://ghidra.re/ghidra_docs/api/ghidra/program/model/listing/BookmarkManager.html
|
||||
BookmarkManager bm = currentProgram.getBookmarkManager();
|
||||
|
||||
int imported = 0;
|
||||
int skipped = 0;
|
||||
int lineNo = 0;
|
||||
|
||||
// CSV columns: (benchmark, resulttype, faults, fault_address)
|
||||
// Example: (ip , OK_MARKER , 4311 , 0x10001B )
|
||||
try (BufferedReader br = new BufferedReader(new FileReader(input))) {
|
||||
String line;
|
||||
while ((line = br.readLine()) != null) {
|
||||
lineNo++;
|
||||
|
||||
if (monitor.isCancelled()) {
|
||||
println("Cancelled.");
|
||||
break;
|
||||
}
|
||||
|
||||
line = line.trim();
|
||||
if (line.isEmpty() || line.startsWith("#")) {
|
||||
if (line.isEmpty() || line.startsWith("#") || line.startsWith("benchmark")) {
|
||||
continue;
|
||||
}
|
||||
|
||||
String[] parts = splitCsvLine(line);
|
||||
if (parts.length < 1) {
|
||||
// Make sure to always use "," delimiter and never quotations
|
||||
String[] parts = line.split(",");
|
||||
if (parts.length != 4) {
|
||||
skipped++;
|
||||
printerr("Line " + lineNo + ": missing address");
|
||||
printerr("Line " + lineNo + ": malformed");
|
||||
continue;
|
||||
}
|
||||
|
||||
String addrText = parts[0].trim();
|
||||
String description = parts.length >= 2 ? parts[1].trim() : "";
|
||||
String benchText = parts[0].trim();
|
||||
String typeText = parts[1].trim();
|
||||
String countText = parts[2].trim();
|
||||
String addrText = parts[3].trim();
|
||||
|
||||
if (addrText.isEmpty()) {
|
||||
if (benchText.isEmpty()
|
||||
|| typeText.isEmpty()
|
||||
|| countText.isEmpty()
|
||||
|| addrText.isEmpty()) {
|
||||
skipped++;
|
||||
printerr("Line " + lineNo + ": empty address");
|
||||
printerr("Line " + lineNo + ": malformed");
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -62,8 +74,21 @@ public class ImportMarkersAsBookmarks extends GhidraScript {
|
||||
continue;
|
||||
}
|
||||
|
||||
println("Adding bookmark at " + addr + " with description " + description);
|
||||
bm.setBookmark(addr, BOOKMARK_TYPE, BOOKMARK_CATEGORY, description);
|
||||
println(
|
||||
"Adding bookmark at "
|
||||
+ addr
|
||||
+ " with type "
|
||||
+ benchText
|
||||
+ " with category "
|
||||
+ benchText // ip, mem or regs
|
||||
+ " - "
|
||||
+ typeText
|
||||
+ " description "
|
||||
+ countText
|
||||
+ "x");
|
||||
|
||||
// TYPE CATEGORY DESCRIPTION
|
||||
bm.setBookmark(addr, benchText, benchText + " - " + typeText, countText + "x");
|
||||
imported++;
|
||||
}
|
||||
}
|
||||
@@ -77,10 +102,6 @@ public class ImportMarkersAsBookmarks extends GhidraScript {
|
||||
public Address parseAddress(String text) {
|
||||
text = text.trim();
|
||||
|
||||
if (text.startsWith("\"") && text.endsWith("\"") && text.length() >= 2) {
|
||||
text = text.substring(1, text.length() - 1).trim();
|
||||
}
|
||||
|
||||
if (text.startsWith("0x") || text.startsWith("0X")) {
|
||||
text = text.substring(2);
|
||||
}
|
||||
@@ -91,31 +112,4 @@ public class ImportMarkersAsBookmarks extends GhidraScript {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
private String[] splitCsvLine(String line) {
|
||||
java.util.ArrayList<String> fields = new java.util.ArrayList<>();
|
||||
StringBuilder current = new StringBuilder();
|
||||
boolean inQuotes = false;
|
||||
|
||||
for (int i = 0; i < line.length(); i++) {
|
||||
char c = line.charAt(i);
|
||||
|
||||
if (c == '"') {
|
||||
if (inQuotes && i + 1 < line.length() && line.charAt(i + 1) == '"') {
|
||||
current.append('"');
|
||||
i++;
|
||||
} else {
|
||||
inQuotes = !inQuotes;
|
||||
}
|
||||
} else if (c == ',' && !inQuotes) {
|
||||
fields.add(current.toString());
|
||||
current.setLength(0);
|
||||
} else {
|
||||
current.append(c);
|
||||
}
|
||||
}
|
||||
|
||||
fields.add(current.toString());
|
||||
return fields.toArray(new String[0]);
|
||||
}
|
||||
}
|
||||
|
||||
Binary file not shown.
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user