Skip to content

Symbols and Functions

A symbol is a name attached to an address, and symbols are the difference between reading a program and reading a phone book. This chapter covers where a program's names come from, what happens when they're taken away, and the daily work of adding your own.

Where the names came from

The specimen's functions arrived with real names — main, check_code, scramble — because of where it sits on a spectrum:

  • The symbol table. A binary built for ordinary use usually carries a table mapping addresses to the names the source used. The analysers read it and the Listing and Symbol Tree light up with meaning. Imports get names the same way: puts and atoi in the specimen are the C library's functions, and the program's dynamic symbol table names them because they are called across a boundary.
  • Function ID. For code with no table of its own — statically linked library routines are the common case — the Function ID analyser compares functions against a database of known library code and names the matches (documented behaviour; the specimen's functions were its own, so the lab never saw it fire).
  • Nothing. A binary can be stripped: its symbol table deliberately removed before shipping, as most production binaries are.

The same program, stripped

The guide's lab analysed gatekeeper's stripped twin — the identical program, same BuildID, same code, table removed. Ghidra still found exactly 20 functions at exactly the same addresses (examples/headless-stripped.txt). Analysis does not need names. What changed is only what everything is called:

With symbols Stripped
scramble at 00101169 FUN_00101169
check_code at 001011a0 FUN_001011a0
main at 001011ce FUN_001011ce

FUN_ plus an address is Ghidra's christening for a function nobody named. And the decompiler didn't care at all:

bool FUN_001011a0(undefined4 param_1)
{
  int iVar1;

  iVar1 = FUN_00101169(param_1);
  return iVar1 == 0x191b2;
}

The lock's entire logic survives stripping, because the logic is in the code and only the labels were in the table. That is the single most encouraging fact in this guide: the name shortage is an inconvenience, never a wall.

Adding names of your own

Since the binary won't supply names, you will. This is the real daily work of the craft, and it happens one discovery at a time:

  • Rename anything whose job you have worked out — a function, a variable in the decompiler, a data address. In the CodeBrowser this is a right-click (or the L key over a symbol) and a new name (documented); the rename applies everywhere the name is shown, including inside other functions' decompiled bodies. FUN_001011a0 becomes check_code by your hand here, and the program gets more readable with every one.
  • Retype when the decompiler's guesses mislead: param_1 deserves to be an int named attempt, and a value used as an address deserves to be a pointer. Retyping a function's signature and renaming its parameters (right-click in the decompiler, Rename Variable; the function signature itself is edited from the Listing) (documented) turns the placeholder C of chapter 6 into something close to honest source.
  • Name libraries honestly. A matched function you cannot place is still progress: crc32_like beats FUN_… because the next session — or the next reader — inherits every name you leave.

Two disciplines make this stick. First, name from evidence: a function earns check_code when you have read the comparison, not when you have a hunch — a wrong confident name is worse than FUN_, because it lies fluently. Second, rename early and small: each rename makes the next function easier to read, and the decompiler re-renders its callers with your names as you go.

Check: progress in any real analysis is visible in the Symbol Tree — the count of FUN_ names falls and the count of meaningful names rises, session by session. In the specimen that work was done for you by the symbol table; the stripped twin shows the starting point everyone else gets, and the decompiler shows why it is enough.