Quiz Entry - updated: 2026.11.27
You halt an ESP32 with JTAG at the first instruction of a function in firmware with no source and no debug symbols. Where do you look for its arguments, and where will its result be?
Step past entry, then the arguments are in a2–a7 (first argument in a2). The result will be in a2 when the function returns, and in the caller's view one window up: a10 after a call8.
The calling convention is what makes stripped firmware readable. Names and types are gone, but every compiled function still follows the register rules, so you know where to look:
- At the function's address, the window hasn't moved yet. The
callonly recorded the shift;entryperforms it. Beforeentry, the arguments are in the caller'sa10,a11, … (for acall8). Step one instruction withnextiand they appear asa2,a3, … in the callee's window. - Read them with
info registersorp/x $a2in GDB. If a value looks like an address in RAM (around0x3ffb…on the ESP32), it is probably a pointer, andx/s $a2shows the string it points to. - For the result, run to the return (
finishin GDB, or a breakpoint on theretw). The value is in the callee'sa2, which the caller then reads as itsa10. a0tells you where you came from, once you swap its leading8for a4(see the crash-dump card).
This is how analysts work out what an unknown function does: what goes in and what comes out, without reading every instruction in between.
Go deeper:
GDB manual — Registers —
info registersand$regin expressions.