LOGBOOK

HELP

Quiz Entry - updated: 2026.11.24

What is the program counter ($pc), and why does a debugger that can write it effectively control the program?

The program counter holds the address of the next instruction the CPU will execute. A debugger with write access to it decides what runs next, so it can skip code or jump anywhere in the program.

Each time the CPU executes an instruction, the PC advances, and branches load it with a new address. p /x $pc prints it in hex; set $pc = <address> overwrites it while the core is halted, and execution continues from the new address after cont.

An address such as 0x400d3d25 is a typical ESP32 value: the 0x400Dxxxx range is code executed from flash through the cache. The odd last digit is not a mistake, because Xtensa instructions are 2 or 3 bytes long and need no special alignment.

The security point is bigger than the command. Any check the firmware performs, such as a password comparison or a licence test, is just instructions and register values. A debugger can change both, so a check enforced only on the device is not a security boundary once JTAG is open. That is the reason the defences focus on closing the port rather than on making the check cleverer.

Go deeper:

From Quiz: SIOT / Firmware Analysis and Hardening Against JTAG Attacks | Updated: Nov 24, 2026