# ApplyLabels

> **Tool `tools/ghidra/ApplyLabels.java`** (ghidra, Ghidra scripts). Apply a labels file (labels/names.tsv style: address&lt;TAB&gt;label[&lt;TAB&gt;evidence]) to the program.

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/ApplyLabels.java).

## Its own help

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

```text
Apply a labels file (labels/names.tsv style: address<TAB>label[<TAB>evidence]) to the program:
  - an address in executable memory becomes a function (created if Ghidra missed it) with that name;
  - any other address gets the label as its primary symbol (a global variable).
Lines starting with '#' and rows whose address is not in the program are skipped. Addresses
are as Ghidra prints them: 140001000 or 0x140001000 (flat), 1000:873a (segmented, 16-bit).
Usage: analyzeHeadless ... -postScript ApplyLabels.java REPORT.txt LABELS.tsv
  (scripts/ghidra-export.sh --labels FILE runs it before the export; scripts/ghidra-run.sh
   BINARY labels REPORT FILE runs it on an analysed project).
It does not set types, parameters or comments.
```
