Loading...
Loading...
Complete idasql SQL function reference catalog. Use when looking up function signatures, parameters, or usage examples.
npx skill4agent add allthingsida/idasql-skills functions| Function | Description |
|---|---|
| Canonical listing line for containing head (works for code/data) |
| Canonical listing line with +/- |
| Single disassembly line at address |
| Next N instructions from address (count-based, not boundary-aware) |
| All disassembly lines in address range [start, end) |
| Full disassembly of function containing address |
| Create instruction at address (returns 1 if already code or created) |
| Create instructions in [start, end), returns number created |
SELECT disasm_at(0x401000);
SELECT disasm_at(0x401000, 2);
SELECT disasm_func(address) FROM funcs WHERE name = '_main';
SELECT disasm_range(0x401000, 0x401100);
SELECT disasm(0x401000);
SELECT disasm(0x401000, 5);
SELECT make_code(0x401000);
SELECT make_code_range(0x401000, 0x401100);INSERT INTO funcs (address) VALUES (0x401000);| Function | Description |
|---|---|
| Read |
| Read |
| Load bytes from a host file into IDB memory/file image |
| Patch one byte at |
| Patch 2 bytes at |
| Patch 4 bytes at |
| Patch 8 bytes at |
| Revert one patched byte to original |
| Read original (pre-patch) byte |
SELECT bytes(0x401000, 16);
SELECT patch_byte(0x401000, 0x90) AS ok;
SELECT bytes(0x401000, 1) AS current, get_original_byte(0x401000) AS original;
SELECT revert_byte(0x401000) AS reverted;load_file_bytes(...)10bytesSELECT ea, value FROM bytes WHERE ea >= :start AND ea < :end ORDER BY eaheadsbyte_search| Column | Description |
|---|---|
| Match address |
| Matched bytes rendered as hex text |
| Matched bytes as a BLOB |
| Match size in bytes |
| Hidden required input: IDA byte pattern |
| Hidden optional inclusive lower bound |
| Hidden optional exclusive upper bound |
| Hidden optional generator cap |
"48 8B 05""48 ? 05""48 ?? 05"?"(01 02 03)"SELECT address, matched_hex, size
FROM byte_search
WHERE pattern = '48 8B ? 00'
LIMIT 10;
SELECT printf('0x%llX', address) AS addr
FROM byte_search
WHERE pattern = 'CC CC CC'
ORDER BY address
LIMIT 1;-- Count unique functions containing RDTSC (opcode: 0F 31)
SELECT COUNT(DISTINCT f.address) as count
FROM byte_search b
JOIN funcs f ON b.address >= f.address AND b.address < f.end_ea
WHERE b.pattern = '0F 31';| Pattern | Description |
|---|---|
| Name at address |
| Function containing address |
| Start of containing function |
| End of containing function |
SELECT COUNT(*) AS function_count FROM funcs;
SELECT address FROM funcs WHERE rowid = 0;SELECT from_ea, to_ea, type, is_code, from_func
FROM xrefs
WHERE to_ea = 0x401000;
SELECT from_ea, to_ea, type, is_code, from_func
FROM xrefs
WHERE from_ea = 0x401000;
SELECT from_ea, to_ea, type, is_code, from_func
FROM xrefs
WHERE from_func = 0x401000;headsORDER BY addressORDER BY address DESCSELECT address
FROM heads
WHERE address > 0x401000
ORDER BY address
LIMIT 1;
SELECT address
FROM heads
WHERE address < 0x401000
ORDER BY address DESC
LIMIT 1;
SELECT printf('0x%llx', address) AS address_hex
FROM heads
LIMIT 10;SELECT name
FROM segments
WHERE 0x401000 >= start_ea
AND 0x401000 < end_ea
LIMIT 1;commentsSELECT COALESCE(NULLIF(comment, ''), NULLIF(rpt_comment, '')) AS comment
FROM comments
WHERE address = 0x401000
LIMIT 1;INSERT INTO comments(address, comment) VALUES (0x401000, 'regular comment');
INSERT INTO comments(address, rpt_comment) VALUES (0x401000, 'repeatable comment');| Function | Description |
|---|---|
| Read type declaration applied at address |
| Apply C declaration/type at address (empty decl clears type; |
| Import C declarations (struct/union/enum/typedef) into local types |
UPDATE funcs SET name = '...', prototype = '...' WHERE address = ...INSERT INTO names(address, name) VALUES (..., '...')UPDATE names SET name = '...' WHERE address = ...prototypetype_at/set_typeapply_callee_type(call_ea, decl)| Function | Description |
|---|---|
| Execute Python snippet and return captured output text |
| Execute Python file and return captured output text |
PRAGMA idasql.enable_idapython = 1;SELECT idapython_snippet('print("hello from idapython")');
SELECT idapython_file('C:/temp/script.py');
SELECT idapython_snippet('counter = globals().get("counter", 0) + 1; print(counter)', 'alpha');| Function | Description |
|---|---|
| Return current UI/widget/context JSON for context-aware prompts (plugin-only) |
SELECT get_ui_context_json();headsSELECT address, size, type, flags, disasm
FROM heads
WHERE address = 0x401000;instructionsinstruction_operandsinstruction_operandsSELECT address, itype, mnemonic
FROM instructions
WHERE func_addr = 0x401000
LIMIT 10;
SELECT opnum, text, type_code, type_name, value
FROM instruction_operands
WHERE address = 0x401000
ORDER BY opnum;
SELECT i.address, i.itype, i.mnemonic, i.size, o.opnum, o.text, o.type_name, o.value
FROM instructions i
LEFT JOIN instruction_operands o
ON o.address = i.address AND o.address = 0x401000
WHERE i.address = 0x401000
ORDER BY o.opnum;| Function | Description |
|---|---|
| PREFERRED — Full pseudocode with line prefixes |
| Force re-decompilation (use after writes/renames) |
| Apply a prototype to one indirect/dynamic call site |
| Read explicit call-site prototype when present |
| JSON array of persisted argument-loader instruction EAs |
| 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 |
| Set/clear union selection via 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 expression coordinate |
| Set/clear numform by EA + operand index |
| Read numform JSON by EA + operand index |
| Set/clear numform by ctree item id |
| Read numform JSON by ctree item id |
| Set/clear numform via call-arg coordinate |
| Read numform JSON via call-arg coordinate |
| Set/clear numform via expression coordinate |
| Read numform JSON via expression coordinate |
SELECT idx, name, type, comment, size, is_arg, is_result, stkoff, mreg FROM ctree_lvars WHERE func_addr = ... ORDER BY idxUPDATE ctree_lvars SET name = ...comment = ...func_addridxUPDATE ctree_labels SET name = ... WHERE func_addr = ... AND label_num = ...| Function | Description |
|---|---|
| Generate a full-database listing file (LST) |
SELECT gen_listing('C:/tmp/full.lst');| Function | Description |
|---|---|
| Generate CFG as DOT graph string |
| Write CFG DOT to file |
| Generate database schema as DOT |
SELECT gen_cfg_dot(0x401000);
SELECT gen_schema_dot();../grep/SKILL.md| Surface | Description |
|---|---|
| Structured rows for composable SQL search |
SELECT name, kind, address FROM grep WHERE pattern = 'sub%' LIMIT 10;
SELECT name, kind, address FROM grep WHERE pattern = 'init' LIMIT 50 OFFSET 0;| Function | Description |
|---|---|
| Rebuild with ASCII + UTF-16, minlen 5 (default) |
| Rebuild with custom minimum length |
| Rebuild with custom length and type mask |
12437COUNT(*) FROM stringsSELECT COUNT(*) AS strings FROM strings;
SELECT rebuild_strings();
SELECT rebuild_strings(4);
SELECT rebuild_strings(5, 7);