Initial public source release
Split reusable rendering and format support into vectorail-core and vectorail-gc.
This commit is contained in:
@@ -0,0 +1,45 @@
|
||||
// GhidraScript: FindSymbolRefs.java
|
||||
// Usage:
|
||||
// analyzeHeadless <projDir> <projName> -process <progName> -noanalysis -readOnly \
|
||||
// -scriptPath <path> -postScript FindSymbolRefs.java D3DXMatrixLookAtLH ...
|
||||
|
||||
import ghidra.app.script.GhidraScript;
|
||||
import ghidra.program.model.address.Address;
|
||||
import ghidra.program.model.listing.Function;
|
||||
import ghidra.program.model.symbol.Reference;
|
||||
import ghidra.program.model.symbol.Symbol;
|
||||
import ghidra.program.model.symbol.SymbolIterator;
|
||||
|
||||
public class FindSymbolRefs extends GhidraScript {
|
||||
@Override
|
||||
public void run() throws Exception {
|
||||
String[] args = getScriptArgs();
|
||||
if (args == null || args.length == 0) {
|
||||
printerr("FindSymbolRefs: needs symbol names");
|
||||
return;
|
||||
}
|
||||
|
||||
for (String needle : args) {
|
||||
println("================================================================================");
|
||||
println("symbol needle: " + needle);
|
||||
boolean any = false;
|
||||
SymbolIterator it = currentProgram.getSymbolTable().getAllSymbols(true);
|
||||
while (it.hasNext() && !monitor.isCancelled()) {
|
||||
Symbol s = it.next();
|
||||
if (!s.getName(true).contains(needle)) continue;
|
||||
any = true;
|
||||
Address addr = s.getAddress();
|
||||
println("symbol: " + s.getName(true) + " @ " + addr);
|
||||
Reference[] refs = getReferencesTo(addr);
|
||||
println("refs: " + refs.length);
|
||||
for (Reference r : refs) {
|
||||
Address from = r.getFromAddress();
|
||||
Function f = getFunctionContaining(from);
|
||||
String fn = f == null ? "(no function)" : f.getName() + " @ " + f.getEntryPoint();
|
||||
println(" " + from + " -> " + fn + " type=" + r.getReferenceType());
|
||||
}
|
||||
}
|
||||
if (!any) println("(no symbol hits)");
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user