# ExportCallArgs

> **Tool `tools/ghidra/ExportCallArgs.java`** (ghidra, Ghidra scripts). List every call to chosen functions with the arguments the decompiler can resolve at each call: constants, strings and global addresses.

A Ghidra script: `scripts/ghidra-export.sh` and `scripts/ghidra-run.sh` run it headless. [Source on GitHub](https://github.com/tanepiper/game-frame/blob/main/tools/ghidra/ExportCallArgs.java).

## Its own help

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

```text
List every call to chosen functions with the arguments the decompiler can resolve at each
call: constants, strings and global addresses. Answers "every sound the game plays and its
id", "every file it opens", "every random draw and its range" in one pass.

Usage: analyzeHeadless PROJECT NAME -process PROGRAM -noanalysis -scriptPath tools/ghidra \
  -postScript ExportCallArgs.java OUTPUT.tsv TARGET [TARGET ...]
TARGET is a function name (as Ghidra or your labels name it) or an address. The output has
one line per call: callee, call address, calling function, then each argument. An argument
the decompiler cannot reduce to a constant shows as the expression's variable name.
It works on the decompiler's P-Code, so it is the same for x86, 68000, MIPS or any other
processor Ghidra supports. scripts/ghidra-run.sh BINARY callargs OUT TARGET... runs it.
```
