Inspects binary code structure via GhidraSQL tables for functions, instructions, blocks, CFG, loops, switches, dominators, and tail calls.
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 when higher-level reconstruction is neededxrefs for cross-function tracinganalysis for ranking and triage| Surface | Predicate | Pushdown? | Note |
|---|---|---|---|
funcs | any | Indexed by addr | Cheap |
blocks | WHERE func_addr = X | Yes | Per-function CFG build |
cfg_edges | WHERE func_addr = X | Yes | Per-function CFG build |
instructions | exact WHERE addr = X, bounded addr range, or WHERE func_addr = X | Yes | Address points/ranges and containing-function predicates issue bounded source reads. A mnemonic-only predicate still scans the full instruction surface. |
instruction_operands | exact WHERE addr = X or WHERE func_addr = X | Yes | One-instruction or one-function bounded source read. |
loops, switch_tables, dominators, post_dominators, tail_calls, function_chunks | WHERE func_addr = X | Per-table | Most are per-function — verify via PRAGMA table_xinfo |
For function-scoped questions, filter instructions directly by func_addr, or use the disasm_blocks and disasm_calls views (which also resolve callee names from funcs/names).
Pick the function and inspect its shape:
SELECT name, printf('0x%X', addr) AS addr, size
FROM funcs
ORDER BY size DESC
LIMIT 10;
Per-function block layout (cheap, pushed):
SELECT printf('0x%X', start_addr) AS start, printf('0x%X', end_addr) AS end, in_degree, out_degree
FROM blocks
WHERE func_addr = 0x401000
ORDER BY start_addr;
Per-function call sites (cheap, pushed via the view):
SELECT printf('0x%X', addr) AS site, callee_name, printf('0x%X', callee_addr) AS callee
FROM disasm_calls
WHERE func_addr = 0x401000
ORDER BY addr;
Instruction spot-check by tight range (source-pushed):
SELECT printf('0x%X', addr) AS addr, mnemonic, operands
FROM instructions
WHERE addr BETWEEN 0x401020 AND 0x401060
ORDER BY addr;
For a function-scoped instruction slice, filter by func_addr (indexed, pushed down):
SELECT printf('0x%X', addr) AS addr, mnemonic, operands
FROM instructions
WHERE func_addr = 0x401000
ORDER BY addr;
Decoded per-operand rows come from instruction_operands (getDefaultOperand Representation / getOperandType / getOperandRefType). Filter by addr (one
instruction) or func_addr (whole function) — both push down:
SELECT operand_index, text, type_name, ref_type
FROM instruction_operands
WHERE addr = 0x401000
ORDER BY operand_index;
instructions exposes an indexed func_addr column (containing-function start) — scope a function's instructions with WHERE func_addr = X, exact addr = X, or a bounded address range; all three push down. A mnemonic-only predicate remains a full scan.blocks and cfg_edges also take func_addr and push it down — use them for control-flow questions.disasm_calls over scanning instructions for CALL opcodes — disasm_calls resolves callee names from funcs/names.decompiler once instruction-level evidence is enough.Kernel images live at or above 0x8000000000000000 (0xFFFFF800...,
0xFFFFFFFF8...), which SQL holds as negative INTEGERs: ORDER BY addr
lists them first, and a function or block that straddles 2^63 is found by every
addr / func_addr filter. Write the addresses as hex literals or the negative
decimal (never a decimal >= 2^63: a REAL, which matches nothing), and scope the
high half with BETWEEN <high hex> AND -1:
-- Kernel-half functions, in address order
SELECT printf('0x%X', addr) AS addr, name, size
FROM funcs
WHERE addr BETWEEN 0xFFFFF80000000000 AND -1
ORDER BY addr;
segments / memory_blocks bounds are unsigned: end_addr is exclusive and
modulo 2^64 (0 maps through 0xFFFFFFFFFFFFFFFF), must lie above start_addr in
unsigned terms, and a block may straddle 2^63.
-- Edges (edge_type values come from Ghidra: CONDITIONAL_JUMP, FALL_THROUGH, CALL, UNCONDITIONAL_JUMP, ...)
SELECT printf('0x%X', from_addr) AS src,
printf('0x%X', to_addr) AS dst,
edge_type
FROM cfg_edges
WHERE func_addr = 0x401000
ORDER BY from_addr, to_addr;
-- Discover the live edge_type enum on this binary (don't hard-code — values come from libghidra)
SELECT DISTINCT edge_type FROM cfg_edges WHERE func_addr = 0x401000;
-- Loops: header_addr, latch_addr, range, depth, kind, block_count
SELECT printf('0x%X', header_addr) AS header, loop_kind, depth, block_count
FROM loops
WHERE func_addr = 0x401000;
-- Switch tables (jump tables recovered by the decompiler)
SELECT printf('0x%X', instr_addr) AS site,
printf('0x%X', table_addr) AS jump_table, -- note: `table` is a reserved word; alias it
min_case, max_case, case_count,
printf('0x%X', default_addr) AS default_target
FROM switch_tables
WHERE func_addr = 0x401000;
-- Per-function dominator tree (depth-tagged)
SELECT printf('0x%X', node_addr) AS node,
printf('0x%X', idom_addr) AS idom,
depth, is_entry
FROM dominators
WHERE func_addr = 0x401000
ORDER BY depth, node_addr;
-- Post-dominators (mirrored shape)
SELECT printf('0x%X', node_addr) AS node,
printf('0x%X', ipdom_addr) AS ipdom,
depth, is_exit
FROM post_dominators
WHERE func_addr = 0x401000;
-- Tail calls: jumps treated as calls because they leave the function
SELECT printf('0x%X', call_site) AS site,
printf('0x%X', dst_addr) AS dst,
printf('0x%X', dst_func_addr) AS dst_func,
tail_kind
FROM tail_calls
WHERE src_func_addr = 0x401000;
-- Function chunks: discontiguous body fragments belonging to one function
SELECT chunk_id,
printf('0x%X', start_addr) AS start,
printf('0x%X', end_addr) AS end,
chunk_kind, is_primary
FROM function_chunks
WHERE func_addr = 0x401000
ORDER BY start_addr;
| View | What it adds |
|---|---|
disasm_calls | Every call site with attributed callee (func_addr, addr, callee_addr, callee_name, kind) — prefer over instructions scans |
disasm_blocks | Block layout with computed size |
disasm_v_leaf_funcs | Alias over native leaf_funcs (addr, name), identical to ctree_v_leaf_funcs; no decompilation |
disasm_v_call_chains | Recursive call-chain projection from disasm_calls |
cfg_edges_detailed | cfg_edges enriched with attributes |
loop_summary | One row per loop with kind/depth/block_count |
switch_summary | One row per switch with case range |
dominator_tree, post_dominator_tree | Hierarchical dominator projections |
function_chunks_detailed | Chunks with computed metadata |
function_frame_layout, stack_var_layout, register_var_summary | Frame/stack/register layouts |
instructions with only a mnemonic predicate or no address scope. Switch to WHERE func_addr = X, exact/bounded addr, disasm_blocks, or disasm_calls. If the HTTP query is already running, send curl -X POST -d '' http://127.0.0.1:<sql-port>/cancel.edge_type value is unfamiliar. It comes verbatim from libghidra's RefType taxonomy (CONDITIONAL_JUMP, FALL_THROUGH, CALL, UNCONDITIONAL_JUMP, COMPUTED_JUMP, INDIRECTION, etc.). Run SELECT DISTINCT edge_type FROM cfg_edges WHERE func_addr = X to enumerate what's present.switch_tables is empty. Either the function has no switch, or the decompiler didn't recover one. Cross-check via decomp_tokens for case keywords.What SKILL.md sets; muted values are Claude Code's defaults
12 skills in this plugin
/dataQuery strings, bytes, data items, memory blocks, and relocations through ghidrasql./ghidrasql:disassemblyfrom ghidrasql
npx claudepluginhub 0xeb/ghidrasql-skills --plugin ghidrasqlOther plugins' skills for the same job