/r2sql:disassemblyfrom r2sql
Query radare2 code and control flow via r2sql — functions, blocks, CFGs, frames, instructions/operands, low IR, sections, segments, and live IO maps.
Ships in r2sql. 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.
None: SKILL.md is the whole skill.
Pick this skill any time the question is about code structure —
function lists, basic blocks, individual instructions, or how the
binary is laid out in memory. For string/import/export lookups use the
data skill; for cross-references use xrefs; for pseudocode use
decompiler.
| table / views | source | scope |
|---|---|---|
funcs, locals | aflj, afvj | functions plus writable locals/arguments |
blocks, cfg_edges, switch_tables | afbj @ <fn> | block layout and all successors |
function_frames | afij @ <fn> | stack-frame summary |
dominators, post_dominators, loops | derived from afbj | graph structure |
instructions, instruction_operands | pdfj, aoj | instructions and exact decoded operands |
esil_ops, esil_operands, ir_* | instruction ESIL | partial canonical low-IR |
sections, segments, io_maps | iSj, iSSj, omj | binary layout and live editable mappings |
The function-scoped graph, instruction, and operand tables scope themselves
when you filter by func_addr — WHERE func_addr = 0x401000 issues
bounded afbj / pdfj / aoj commands instead of enumerating every
function in the binary. Always include that filter for non-trivial
binaries, otherwise the query is O(funcs).
-- 20 largest functions by code size
SELECT addr, name, size, cc, nbbs
FROM funcs
ORDER BY size DESC
LIMIT 20;
-- a single function's disassembly
SELECT addr, mnemonic, disasm
FROM instructions
WHERE func_addr = 0x401000
ORDER BY addr;
-- ESIL (radare2's stack IL) per instruction, e.g. mov -> "rbx,0x8,rsp,+,=[8]"
SELECT addr, mnemonic, esil
FROM instructions
WHERE func_addr = 0x401000 AND esil <> ''
ORDER BY addr;
-- semantic op classification: radare2 op_type + cross-tool canonical op
SELECT seq, addr, op_type, canonical_op
FROM instructions
WHERE func_addr = 0x401000
ORDER BY seq;
-- functions with abnormally high cyclomatic complexity
SELECT addr, name, cc FROM funcs WHERE cc > 30 ORDER BY cc DESC;
-- executable sections + their virtual sizes
SELECT name, perm, vsize, start_addr
FROM sections
WHERE perm LIKE '%x%';
-- count basic blocks per function (top 10)
SELECT f.name, f.nbbs
FROM funcs f
ORDER BY f.nbbs DESC LIMIT 10;
-- every CALL instruction in a given function, with destination name
SELECT i.addr, i.disasm, t.name AS target
FROM instructions i
LEFT JOIN funcs t ON t.addr = (
-- extract the call target from the disasm column
CAST(SUBSTR(i.disasm, INSTR(i.disasm,'0x')) AS INTEGER)
)
WHERE i.func_addr = 0x401000 AND i.mnemonic = 'call';
For caller/callee analysis use the xrefs skill; it pulls resolved
targets from r2's per-function refs (afxj) instead of regex-parsing
disasm.
Beyond mnemonic/disasm/bytes/esil, each instructions row carries a
per-function ordinal and a two-level semantic op classification:
| column | meaning |
|---|---|
seq | 0-based ordinal within the function (in addr order) |
op_type | radare2 semantic op type (add, call, cjmp, …) |
canonical_op | cross-tool canonical P-code-style op (INT_ADD, CALL, CBRANCH, …); empty when there is no clean canonical |
The esil_ops / esil_operands tables tokenize radare2's ESIL (postfix stack IL)
into a finer canonical op stream (multiple ops per instruction) + 5-kind value operands.
The ir_ops / ir_v_* / ir_operands / ir_maturities views project from them (a
fidelity upgrade over the coarse one-op-per-instruction path) and share the same
names/columns as the other family tools, so op-stream queries are portable. r2 is the
lowest-fidelity / partial leg — no SSA, single esil rung. Always filter by func_addr.
esil_ops(func_addr, seq, addr, op, native_op) — op canonical, native_op the ESIL
operator token (or the control-flow type; CALL/BRANCH/RETURN come from op.type since
ESIL models control flow as a rip assignment).esil_operands(func_addr, op_seq, operand_index, role, kind, text) — 5-kind operands
(op_seq joins esil_ops.seq).ir_ops(func_addr, seq, addr, op, native_op, is_ssa, maturity, stage) — over esil_ops;
is_ssa=0, maturity=esil, stage=final.ir_v_* — each (func_addr, seq, addr, op), classifying the op stream by category.ir_operands projects esil_operands; ir_maturities = the single esil rung.-- canonical low-IR op stream for a function (the tokenized ESIL ops)
SELECT seq, addr, op, native_op
FROM ir_ops
WHERE func_addr = 0x401000
ORDER BY seq;
-- each op with its operands
SELECT o.seq, o.op, p.role, p.kind, p.text
FROM ir_ops o JOIN ir_operands p ON p.func_addr = o.func_addr AND p.op_seq = o.seq
WHERE o.func_addr = 0x401000
ORDER BY o.seq, p.operand_index;
funcs.addr is the function entry; if r2 hasn't analyzed the binary
yet, the table is empty. Run with the default aaa analysis (omit
--no-analyze) or open a saved project (--project NAME).funcs.size = 0 for thunks and externs; filter
with size > 0 if you only want analyzed bodies.instructions.bytes is the hex-encoded raw bytes (e.g. 4889e5) —
decode with unhex() if you need the raw bytes.What SKILL.md sets; muted values are Claude Code's defaults
npx claudepluginhub 0xeb/r2sql-skills --plugin r2sql11 skills in this plugin
/analysisTriage and audit radare2 binaries via r2sql — find suspicious behavior, surface crypto/network/persistence APIs, hunt high-complexity functions, and run multi-table queries that combine code, data, and xrefs./annotationsEdit radare2 annotations — comments, flag/function names, local variables, bookmarks — via r2sql. Use when asked to add comments, rename functions/flags, rename or retype locals, or persist analysis state./connectConnect to radare2 sessions via r2sql and bootstrap analysis. Use when starting a new SQL session, routing to other skills, or setting up CLI/HTTP/MCP connections.Other plugins' skills for the same job