Traces callers, callees, call graph edges, and string references using Ghidra SQL. Useful for reverse engineering and binary analysis.
Ships in ghidrasql. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
Use this skill when the user asks about:
Route to:
decompiler once a specific function becomes interestinganalysis for broader graph rankingre-source for recursive bottom-up annotation that consumes call-graph edges| Surface | Predicate | Pushdown? | Notes |
|---|---|---|---|
xrefs | WHERE from_addr = X or to_addr = X | Yes | Bounded outgoing/incoming address lookup; IN (...) drives repeated point lookups |
xref_index | WHERE src_func_addr = X | Yes, for references | Reads only that function's body references, plus the function catalog for destination attribution. xref_index is a TABLE, not a view. |
xref_index | WHERE dst_func_addr = X | No (post-filter scan) | Destination-function attribution alone still scans all references |
callgraph_edges | WHERE src_func_addr = X, dst_func_addr = X, dst_addr = X, or call_site = X; call_site IN (...) | Yes | Function predicates use one bounded call-edge RPC; raw destinations use incoming references; each exact site resolves and reads only its containing function |
callers, callees | WHERE func_addr = X | Yes | Both UNION ALL arms are bounded, including raw/unresolved destinations |
string_refs | WHERE func_addr = X | Yes, for references | Native table: reads that function's body references, the string catalog, and one function record |
string_refs | WHERE string_value LIKE ... alone | No (post-filter scan) | Pattern search across the program's string references |
leaf_funcs | unscoped or size/name filters | Native listing | Finds functions with no outgoing call references, without decompilation; still enumerates the program |
For function-scoped questions, prefer the entry points callgraph_edges, callers, callees, and the native string_refs table over rebuilding joins on raw xrefs. Exact source- or destination-function call-edge reads return both function identities in the same bounded RPC. Exact call_site reads resolve the containing function and filter only its edges; SQLite drives call_site IN (...) as one exact lookup per value. Keep the predicate visible to SQLite; forcing the view through a materialized CTE defeats pushdown and scans the full graph.
callers and callees include resolved function edges and raw/unresolved
destinations. callers bounds its resolved arm by dst_func_addr and its
unresolved arm by dst_addr; callees bounds both arms by src_func_addr.
Use callgraph_edges WHERE dst_addr = X to inspect calls to a known raw target
such as an import slot. disasm_calls is another call-site view, rather than
the only way to retain unresolved targets.
For a cheap target check, query one known function in either direction:
SELECT * FROM callgraph_edges WHERE src_func_addr = 0x401000;
SELECT * FROM callgraph_edges WHERE dst_func_addr = 0x401000;
SELECT * FROM callgraph_edges WHERE call_site IN (0x401120, 0x401188);
Whole-surface counts are diagnostic scans, not pre-flight requirements. Run them only when the task genuinely requires global graph statistics.
Raw references at one source or destination address:
SELECT * FROM xrefs WHERE from_addr = 0x401030;
SELECT * FROM xrefs WHERE to_addr = 0x401030;
Incoming calls to a known raw target:
SELECT * FROM callgraph_edges WHERE dst_addr = 0x401030;
All outgoing references in one function body (not just references at its entry):
SELECT from_addr, to_addr, kind, dst_func_addr
FROM xref_index
WHERE src_func_addr = 0x401030
ORDER BY from_addr, to_addr;
String references from one function:
SELECT string_addr, string_value
FROM string_refs
WHERE func_addr = 0x401030
ORDER BY string_addr;
Callers of a function. The view exposes caller_name (the source's
function name) and caller_func_addr (the source function's start
addr), keyed by func_addr (the callee):
SELECT caller_name, printf('0x%X', caller_func_addr) AS addr
FROM callers
WHERE func_addr = 0x401000
ORDER BY caller_name;
Callees from a function:
SELECT callee_name, printf('0x%X', callee_addr) AS addr
FROM callees
WHERE func_addr = 0x401000
ORDER BY callee_name;
Functions referencing a string:
SELECT func_name, printf('0x%X', func_addr) AS addr, string_value
FROM string_refs
WHERE string_value LIKE '%password%'
ORDER BY func_addr;
Recursive callers of a function:
WITH RECURSIVE callers_cte(func_addr, depth, path) AS (
SELECT caller_func_addr, 1, printf('%lld', caller_func_addr)
FROM callers
WHERE func_addr = 0x401060
UNION ALL
SELECT c.caller_func_addr,
callers_cte.depth + 1,
callers_cte.path || '>' || printf('%lld', c.caller_func_addr)
FROM callers c
JOIN callers_cte ON c.func_addr = callers_cte.func_addr
WHERE callers_cte.depth < 5
AND instr(callers_cte.path, printf('%lld', c.caller_func_addr)) = 0
)
SELECT printf('0x%X', func_addr) AS caller,
MIN(depth) AS distance
FROM callers_cte
GROUP BY func_addr
ORDER BY distance, caller;
Path between function A and B:
WITH RECURSIVE path(root_func, current_func, depth, path) AS (
SELECT src_func_addr,
dst_func_addr,
1,
printf('%lld>%lld', src_func_addr, dst_func_addr)
FROM callgraph_edges
WHERE src_func_addr = 0x401030
UNION ALL
SELECT path.root_func,
c.dst_func_addr,
path.depth + 1,
path.path || '>' || printf('%lld', c.dst_func_addr)
FROM path
JOIN callgraph_edges c ON c.src_func_addr = path.current_func
WHERE path.depth < 6
AND instr(path.path, printf('%lld', c.dst_func_addr)) = 0
)
SELECT printf('0x%X', current_func) AS func_addr,
depth,
path
FROM path
WHERE current_func = 0x401060
ORDER BY depth;
Raw xref neighborhood around a function:
The source arm is bounded; the destination-function arm deliberately performs
a bulk reference scan. For an incoming point lookup, use xrefs.to_addr instead.
WITH neighborhood AS (
SELECT *
FROM xref_index
WHERE src_func_addr = 0x401030
UNION
SELECT *
FROM xref_index
WHERE dst_func_addr = 0x401030
)
SELECT printf('0x%X', from_addr) AS from_addr,
printf('0x%X', to_addr) AS to_addr,
kind,
printf('0x%X', src_func_addr) AS src_func_addr,
printf('0x%X', dst_func_addr) AS dst_func_addr
FROM neighborhood
ORDER BY from_addr, to_addr;
callgraph_edges, callers, callees, and string_refs over rebuilding joins by hand.dst_addr = X on callgraph_edges for bounded incoming calls to raw/unresolved targets; callers and callees also retain these edges.src_func_addr = X, dst_func_addr = X, or call_site = X predicates for bounded call-graph reads. call_site IN (...) remains bounded. Do not hide these predicates in forced materialized CTEs.xref_index when the query needs raw edges plus src_func_addr or dst_func_addr.xrefs/xref_index; aggregate once in a CTE and join back.funcs; use callgraph_edges, callers, callees, or xref_index first.pseudocode, decomp_lvars, and decomp_tokens must be filtered before joining graph results into them. Use func_addr; exact func_name is also pushed down for pseudocode and decomp_lvars.decompiler or annotations.What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
ghidra, reverse-engineering, call-graph, xrefs, binary-analysis
12 skills in this plugin
/dataQuery strings, bytes, data items, memory blocks, and relocations through ghidrasql./ghidrasql:xrefsfrom ghidrasql
npx claudepluginhub 0xeb/ghidrasql-skills --plugin ghidrasqlOther plugins' skills for the same job