Command Palette

Search for a command to run...

Back to skills
skill № 33195

disassembly

Query radare2 code and control flow via r2xsql — functions, blocks, CFGs, frames, instructions/operands, low IR, sections, segments, live IO maps, calling…

FreeNo executable scripts
radareorgby radareorg★ 23 GitHub stars

Install disassembly in Claude Code & Claude Desktop

Sign up to install this skill

Create a free account to reveal the install command and save the skill to your library.

  • Reveal the one-line install command
  • Save skills to your synced library
  • Get notified when skills update
Sign up freeI already have an account

About this skill

When to use

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.

Tables

table / views source scope
funcs, locals aflj, afvj (or the C API directly on the in-process build) functions plus writable locals/arguments
calling_conventions afclj static per-(arch,bits) ABI reference — what a funcs.calltype name actually means
registers arpj static per-(arch,bits) register PROFILE — names/sizes/roles, not live values
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).

Performance: blocks, cfg_edges, switch_tables, dominators, post_dominators, and loops all read the same underlying block list, and the in-process build reads it straight from radare2's analysis state instead of running afbj and parsing its JSON — a full scan goes from one command per function to none. switch_tables.table_addr stays NULL either way: radare2 has the jump table's own address internally, but no command exposes it, so the column would otherwise read differently on the two build flavors. locals gets the same treatment: the in-process build reads a function's variables/arguments straight from radare2's analysis state instead of running afvj per function. sections/segments also read straight from radare2's binary-header state (RBinSection) on the in-process build instead of running iSj/iSSj — both commands already share ONE underlying vector (opposite filters on the same section list), and unlike the function-scoped tables above, neither needs an analysis pass at all: they read the loaded binary's own headers.

instructions has a second, independent way in: WHERE start_addr = X AND count = N (both required together) disassembles N instructions starting at an arbitrary address, not a function's own entry — useful for data-adjacent code, gaps, or a jump target that doesn't happen to be a function boundary. It is not a substitute for func_addr: it walks linearly and cannot reach a block that sits below its own function's entry (non-contiguous functions are real), and it doesn't know which function (if any) owns what it walks, so func_addr reads 0 on these rows.

instructions is also projection-gated on the in-process build, on all three of its shapes (unfiltered scan, func_addr, start_addr/count): disasm and mnemonic are rendered text (radare2's own disassembly renderer — no exported C API for it), so a query selecting either always runs the full command path; a query selecting neither reads the remaining columns (addr, size, bytes, func_addr, esil, op_type, family) straight from radare2's analysis state instead — measured 4-9x faster. Drop disasm/mnemonic from the SELECT list on a wide scan that only needs the classification columns, and add them back whenever you actually need the rendered text.

Common queries

-- 20 largest functions by code size
SELECT addr, name, size, cc, nbbs
FROM funcs
ORDER BY size DESC
LIMIT 20;

-- function shape without reading a single instruction
SELECT name, ninstrs, stackframe, cost, end_addr - addr AS extent
FROM funcs ORDER BY ninstrs DESC LIMIT 20;

-- self-recursive, never-returning, or pure helpers
SELECT name, is_recursive, is_noreturn, is_pure
FROM funcs WHERE is_recursive = 1 OR is_noreturn = 1 OR is_pure = 1;

-- floating-point / vector / privileged code, without matching mnemonic text
SELECT family, COUNT(*) FROM instructions GROUP BY family ORDER BY 2 DESC;
SELECT addr, disasm FROM instructions WHERE family = 'priv';

-- 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, ca
Full SKILL.md on GitHub

Allowed tools

Tools this skill is permitted to call.

  1. 01Bash
  2. 02Read

FAQ

What does the disassembly skill do?

Query radare2 code and control flow via r2xsql — functions, blocks, CFGs, frames, instructions/operands, low IR, sections, segments, live IO maps, calling conventions, and the register profile.

How do I install the disassembly skill?

Copy the skill folder into ~/.claude/skills (the Claude Code tab above does this in one command), or install it as a plugin.

Does the disassembly skill run scripts?

No, this skill is instructions only (SKILL.md) with no executable scripts.

Related skills

Compare disassembly with