// Print function/instruction counts and the reset-vector listing. import ghidra.app.script.GhidraScript; import ghidra.program.model.listing.*; import ghidra.program.model.address.*; public class Stats extends GhidraScript { @Override public void run() throws Exception { Listing l = currentProgram.getListing(); println("functions=" + currentProgram.getFunctionManager().getFunctionCount() + " instructions=" + l.getNumInstructions()); for (MemoryBlockLike b : new MemoryBlockLike[0]) {} for (var b : currentProgram.getMemory().getBlocks()) println("block " + b.getName() + " " + b.getStart() + "-" + b.getEnd()); Address a = toAddr("808028"); for (int i = 0; i < 12; i++) { Instruction ins = l.getInstructionAt(a); if (ins == null) { println(a + " "); break; } println(a + " " + ins); a = ins.getMaxAddress().next(); } } interface MemoryBlockLike {} }