Skip to content

decomp_query ​

Tool tools/triage/decomp_query.py (program, Triage). Answer questions about a Ghidra export (scripts/ghidra-export.sh) without reading it whole.

Run it with ./gameframe run decomp_query ARGS or python3 tools/triage/decomp_query.py. Source on GitHub.

Its own help ​

This is the help text in the tool itself, as ./gameframe tool decomp_query prints it.

text
Answer questions about a Ghidra export (scripts/ghidra-export.sh) without reading it whole.

Usage: decomp_query.py [--binary NAME] [--export DIR] [--labels FILE ...] COMMAND ARGS

Commands:
  fn ADDR|NAME          one function's pseudocode, with your labels applied
  callers ADDR|NAME     the functions that call or reference it
  callees ADDR|NAME     the functions it calls (with sizes, labelled ones first)
  find TEXT             the functions whose pseudocode contains TEXT (a string, a constant...)
  strings TEXT          defined strings containing TEXT, and the functions that use each
  writers OFFSET        the functions that store to `+ OFFSET` of a pointer (who sets a field?)
  layout FN[:VAR] ...   a structure's fields from the functions that use it: each offset with
                        its sizes, types, reads, writes and users, then a C struct to start
                        from. VAR is the pointer to it in that function (default param_1)
  biggest [N]           the N largest functions not yet labelled (where the work is)
  stats                 functions, labelled share by count and by size

ADDR is an address as Ghidra prints it (1400be770, 0x1400be770 or FUN_1400be770; for 16-bit
programs seg:off, 1000:873a or FUN_1000_873a). NAME is a
Ghidra name or one of your labels. Labels come from labels/names.tsv (address<TAB>label<TAB>
evidence): add a row every time you identify a function, and every later answer is easier to
read. A file of labels for this binary alone, labels/<binary name>.tsv in the current folder, is
read first (for overlays and DLLs whose addresses overlap). The labels are then read from each
--labels FILE (the first file to name an address wins), else from labels/names.tsv in the current folder
(the project you work in), else from the project's, else from GameFrame's own. `--binary` picks a
binary when the export holds several. The default is the only one, or else the .exe with the most
functions, so a game wins over its small launcher; a note on stderr names the choice. An address
must fall inside a function of that binary, or the query stops and names the other binaries.

`--export` defaults to analysis/export in the project: the folder GAMEFRAME_PROJECT names (a
project's `./gameframe` sets it), else GameFrame's own folder.

Named by ​

Skills: re-format, re-ghidra, re-land, re-rea, re-trace.

Agents: re-typer.

Code: Apache 2.0. Content: CC0 1.0. No game material: bring your own copy.