functions
Reference ghidrasql SQL functions and choose the right helper for a task.
Codex または Claude でインストール この Prompt をコピーして Codex、Claude、または他のアシスタントに貼り付けると、Skill ページを確認してインストールできます。
メニュー
Reference ghidrasql SQL functions and choose the right helper for a task.
Codex または Claude でインストール この Prompt をコピーして Codex、Claude、または他のアシスタントに貼り付けると、Skill ページを確認してインストールできます。
SOC 職業分類に基づく
Analyze binaries with ghidrasql using safe, high-signal query patterns.
Apply persistent ghidrasql annotations such as names, comments, signatures, and local-variable edits.
Connect to ghidrasql sources, verify live access, and route to the right analysis skill.
Query strings, bytes, data items, memory blocks, and relocations through ghidrasql.
Manage breakpoints and patch bytes through ghidrasql — the breakpoints table and bytes single-byte UPDATE.
Decompile functions with ghidrasql and work with pseudocode, locals, parameters, and ctree pattern views safely.
| name | functions |
| description | Reference ghidrasql SQL functions and choose the right helper for a task. |
| allowed-tools | ["Bash","Read","Glob","Grep"] |
Use this skill when the user asks:
Route to:
decompiler for pseudocode and decompiler-table workflowstypes for parse_decls() and signature-related workannotations for full mutation loopsgrep for full-text search functions (search_*)ghidrasql registers 21 distinct names, 22 entries (search_snippet registers at arity 2 and 3). 18 are general-purpose helpers; 3 are cache-control helpers.
There is no shutdown(...) function — set the exit policy at launch via --shutdown and trigger the stop with POST /shutdown. There is no decompile SQL helper; use SELECT text FROM pseudocode WHERE func_addr = ... and cache_invalidate('pseudocode') or refresh_database() to drop stale state.
SELECT text FROM pseudocode WHERE func_addr = 0x401000; -- full pseudocode text
SELECT rename_local(0x401000, '<local_id>', 'buffer'); -- == UPDATE decomp_lvars SET name
SELECT set_local_type(0x401000, '<local_id>', 'char *'); -- == UPDATE decomp_lvars SET type
SELECT parse_decls('typedef struct { int x; int y; } Point;');
-- (haystack, query) are the two text arguments; these examples use literals so
-- they run as-is — swap in a column (e.g. a `strings.value`) for real searches.
SELECT normalize_text('SomeMixed_Case'); -- canonical form
SELECT search_match('the quick brown fox', 'quick fox'); -- 0/1 — every term matches
SELECT search_score('the quick brown fox', 'quick fox'); -- relevance score
SELECT search_snippet('the quick brown fox', 'fox'); -- snippet, default radius
SELECT search_snippet('the quick brown fox', 'fox', 10); -- snippet, custom radius
SELECT search_rank('strings', 'the quick brown fox', 'fox'); -- domain-weighted rank
SELECT type_family('struct foo { int x; }'); -- aggregate|enum|alias|...
SELECT type_is_pointer('char *'); -- 0/1
SELECT type_strip_cv('const volatile int *'); -- strips const/volatile
SELECT hex(0x401000); -- '0x401000'
SELECT program_revision(); -- Ghidra native modification number
SELECT string_count(); -- live string-table size
SELECT rebuild_strings(); -- refresh string table
SELECT save_database(); -- commit pending mutations
SELECT discard_changes(); -- roll back pending mutations
SELECT refresh_database(); -- invalidate caches, reload
Materialisation is freshness-token scoped for libghidra live sources: repeated /query calls can reuse table rows while program_id, Ghidra's modification number, program path, and available file metadata are unchanged. External Ghidra UI/API edits or active-program switches refresh on the next query. Cache helpers matter mainly inside a batched script (-f, multi-statement REPL input) or when forcing a surface to rebuild:
SELECT cache_stats(); -- JSON: invalidations_total, revision, cacheable tables
SELECT cache_invalidate('pseudocode'); -- drop one table's cache; useful inside a batch after a write
SELECT cache_invalidate_all(); -- drop every cached table
rename_local() / set_local_type() when a function-shaped
call is clearer than UPDATE decomp_lvars.parse_decls() for any C declaration import — it goes through
Ghidra's CParser and avoids per-row INSERTs.save_database() explicitly after a mutation batch.pseudocode, decomp_lvars, decomp_tokens) even when you went
through a helper function. Use func_addr; exact func_name is also
pushed down for pseudocode and decomp_lvars reads.