Loading...
Loading...
Decompile and analyze IDA functions. Use when asked for pseudocode, ctree AST analysis, local variables, labels, or decompiler-driven cleanup.
npx skill4agent add allthingsida/idasql-skills decompilerannotationstypesdisassembly-- 1) Capability/profile probe
SELECT * FROM pragma_table_list WHERE name IN ('pseudocode', 'ctree', 'ctree_lvars');
-- 2) Pick one concrete function target
SELECT name, printf('0x%X', address) AS addr, size
FROM funcs
ORDER BY size DESC
LIMIT 10;
-- 3) View decompiled text via primary read surface
SELECT decompile(0x401000);decompile(addr)pseudocodectree*WHERE func_addr = 0x...disassemblyxrefsfunc_addrdecompile(addr, 1)decompilertypesdecompilerannotationsdecompilerdisassemblyfunc_addrpseudocodedecompile(addr)| Column | Type | Writable | Description |
|---|---|---|---|
| INT | No | Function address |
| INT | No | Line number |
| TEXT | No | Pseudocode text |
| INT | No | Corresponding assembly address (from COLOR_ADDR anchor) |
| TEXT | Yes | Decompiler comment at this ea |
| TEXT | Yes | Comment placement: |
WHERE func_addr = XWHERE ea = XWHERE line_num = Nsemi;block1block2curly1curly2coloncaseelsedo-- VIEWING: Use decompile() function, NOT the pseudocode table
SELECT decompile(0x401000);
-- COMMENTING: Use pseudocode table to add/edit/delete comments
UPDATE pseudocode SET comment_placement = 'semi',
comment = 'buffer overflow here'
WHERE func_addr = 0x401000 AND ea = 0x401020;
-- Add block comment (appears on own line above the statement)
UPDATE pseudocode SET comment_placement = 'block1', comment = 'vulnerable call'
WHERE func_addr = 0x401000 AND ea = 0x401020;
-- Delete comments at a resolved unique anchor
UPDATE pseudocode SET comment = NULL
WHERE func_addr = 0x401000 AND ea = 0x401020;pseudocodeUPDATE funcs SET comment = ... WHERE address = ...UPDATE funcs SET rpt_comment = ... WHERE address = ...| Column | Type | Writable | Description |
|---|---|---|---|
| INT | No | Function address |
| TEXT | No | Current function name for triage |
| INT | No | Stored orphan comment EA |
| TEXT | No | Stored |
| TEXT | Delete-only | Stored orphan comment text |
UPDATE ... SET orphan_comment = NULL''func_addrfunc_nameorphan_countorphan_comments_jsonea == func_addrea = 0ea{}funcs.commentfuncs.rpt_commentpseudocode-- Resolve the first attachable non-brace row near function start
SELECT line_num, ea, line
FROM pseudocode
WHERE func_addr = 0x401000
AND ea != 0
AND TRIM(line) NOT IN ('{', '}')
AND ea IN (
SELECT ea
FROM pseudocode
WHERE func_addr = 0x401000 AND ea != 0
GROUP BY ea
HAVING COUNT(*) = 1
)
ORDER BY line_num
LIMIT 1;
-- Write a heading-style summary using the resolved ea
UPDATE pseudocode
SET comment_placement = 'block1',
comment = 'One-paragraph summary of the function.'
WHERE func_addr = 0x401000
AND ea = (
SELECT ea
FROM pseudocode
WHERE func_addr = 0x401000
AND ea != 0
AND TRIM(line) NOT IN ('{', '}')
AND ea IN (
SELECT ea
FROM pseudocode
WHERE func_addr = 0x401000 AND ea != 0
GROUP BY ea
HAVING COUNT(*) = 1
)
ORDER BY line_num
LIMIT 1
);| Column | Type | Description |
|---|---|---|
| INT | Function address |
| INT | Unique node ID |
| INT | 1=expression, 0=statement |
| TEXT | Node type ( |
| INT | Address in binary |
| INT | Parent node ID |
| INT | Tree depth |
| INT | Child node IDs |
| INT | Local variable index |
| TEXT | Variable name |
| INT | Target address |
| TEXT | Symbol name |
| INT | Numeric literal |
| INT | Label number when node defines a label |
| INT | Target label number for |
| TEXT | String literal |
| Column | Type | Description |
|---|---|---|
| INT | Function address |
| INT | Variable index |
| TEXT | Variable name |
| TEXT | Type string |
| TEXT | Local-variable comment shown next to declaration |
| INT | Size in bytes |
| INT | 1=function argument |
| INT | 1=stack variable |
| INT | Stack offset |
idxcommentlv.cmtdecompile(...)namecfunc_t| Column | Type | RW | Description |
|---|---|---|---|
| INT | R | Function address |
| INT | R | Label number ( |
| TEXT | RW | Current label name |
| INT | R | Backing ctree item id for this label |
| INT | R | Address of label-bearing ctree item |
| INT | R | 1 if name differs from default |
| Column | Type | Description |
|---|---|---|
| INT | Function address |
| INT | Call node ID |
| INT | Call-site EA |
| TEXT | Callee object name |
| TEXT | Callee helper name |
| INT | Argument index (0-based) |
| INT | Argument expression item ID |
| TEXT | Argument type |
| TEXT | Variable name if applicable |
| INT | Numeric value |
| TEXT | String value |
func_addr| View | Purpose |
|---|---|
| Function calls with callee info |
| Indirect/dynamic call sites for call-site typing |
| Grouped orphan comment triage |
| for/while/do loops |
| if statements |
| Comparisons with operands |
| Assignments with operands |
| Pointer dereferences |
| Return statements with value details |
| Calls inside loops (recursive) |
| Calls inside if branches (recursive) |
| Functions with no outgoing calls |
| Call chain paths up to depth 10 |
typestypes_memberstypes_enum_valuestypes_func_argstypesdecompile()pseudocodeSELECT decompile(addr)[lv:N]UPDATE ctree_lvars ... WHERE func_addr = ... AND idx = NSELECT decompile(addr, 1)pseudocode| Function | Description |
|---|---|
| PREFERRED -- Full pseudocode with line prefixes |
| Same output but forces re-decompilation |
| Apply a prototype to one call site |
| Read explicit call-site prototype when present |
| Read persisted argument-loader addresses as JSON |
| Set/clear union selection path at EA |
| Set/clear union selection path by |
| PREFERRED call-arg targeting helper |
| Resolve call-arg coordinate to explicit |
| Resolve generic expression coordinate to explicit |
| Set/clear union selection via generic expression coordinate |
| Read union selection path JSON at EA |
| Read union selection path JSON by |
| Read union selection JSON via call-arg coordinate |
| Read union selection JSON via generic expression coordinate |
| Set/clear numform directly by EA + operand index |
| Read numform JSON directly by EA + operand index |
| Set/clear numform by explicit ctree item id |
| Read numform JSON by explicit ctree item id |
| Set/clear numform via call-arg coordinate |
| Read numform JSON via call-arg coordinate |
| Set/clear numform via generic expression coordinate |
| Read numform JSON via generic expression coordinate |
*_ea_argctree_item_at(..., op_name, nth)*_ea_exprtype_at()set_type()parse_decls()namesfuncstypesUPDATE funcs SET name = '...', prototype = '...', comment = '...', rpt_comment = '...' WHERE address = ...prototypetype_at/set_typecommentrpt_commentget_func_cmt()set_func_cmt()| Table | Architecture | Key Constraint | Notes |
|---|---|---|---|
| Cached | | Lazy per-function cache, freed after query |
| Cached | | Query-scoped orphan rows; writable delete-only |
| Cached | | Query-scoped grouped orphan triage; start broad with |
| Generator | | Lazy streaming, never materializes full result, respects LIMIT |
| Cached | | Lazy per-function cache, freed after query |
| Generator | | Lazy streaming, respects LIMIT |
func_addrctreectree_call_argsctree_v_callsctree_v_indirect_callsctree_v_loopsfunc_addrdecompile(addr)decompile(addr, 1)decompile(addr) -> ~50-200ms first call, ~0ms cached
decompile(addr, 1) -> ~50-200ms always (forces re-decompile)
ctree WHERE func_addr=X -> one decompilation + streaming rows
ctree (no constraint) -> one decompilation per row in funcs