Skip to content

10.13 Registers

info registers

info all-registers

GDB has four “standard” register names that are available (in expressions) on most machines—whenever they do not conflict with an architecture’s canonical mnemonics(助记符) for registers.

Register name Register Reference
$pc program counter register wikipedia Program counter
$sp stack pointer wikipedia Stack register
$fp register that contains a pointer to the current stack frame
$ps register that contains the processor status

NOTE:register的理论知识,重要在工程Hardware中进行的讨论。

For example, you could print the program counter in hex with

p/x $pc

or print the instruction to be executed next with

x/i $pc

or add four to the stack pointer12 with

set $sp += 4