forked from tsuki/openroller
Initial public source release
Split reusable rendering and format support into vectorail-core and vectorail-gc.
This commit is contained in:
@@ -0,0 +1,38 @@
|
||||
// GhidraScript: print instructions around one or more addresses.
|
||||
// Usage: DumpInstructions.java 0x001b184c 0x001b1870
|
||||
|
||||
import ghidra.app.script.GhidraScript;
|
||||
import ghidra.program.model.listing.Function;
|
||||
import ghidra.program.model.listing.Instruction;
|
||||
|
||||
public class DumpInstructions extends GhidraScript {
|
||||
@Override
|
||||
public void run() throws Exception {
|
||||
String[] args = getScriptArgs();
|
||||
if (args == null || args.length == 0) {
|
||||
printerr("DumpInstructions: needs one or more addresses");
|
||||
return;
|
||||
}
|
||||
for (String arg : args) {
|
||||
Instruction center = getInstructionContaining(toAddr(Long.decode(arg)));
|
||||
println("=== " + arg + " ===");
|
||||
if (center == null) {
|
||||
println("(no instruction)");
|
||||
continue;
|
||||
}
|
||||
Instruction cursor = center;
|
||||
for (int i = 0; i < 18; ++i) {
|
||||
Instruction previous = cursor.getPrevious();
|
||||
if (previous == null) break;
|
||||
cursor = previous;
|
||||
}
|
||||
for (int i = 0; i < 40 && cursor != null; ++i) {
|
||||
Function function = getFunctionContaining(cursor.getAddress());
|
||||
String marker = cursor.getAddress().equals(center.getAddress()) ? "=>" : " ";
|
||||
println(marker + " " + cursor.getAddress() + " " +
|
||||
(function == null ? "" : function.getName() + " ") + cursor);
|
||||
cursor = cursor.getNext();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user