11.6.2 Functions and Variables Specifying the Register Architecture
Read or write the program counter. The default value of both functions is
NULL(no function available). If the program counter is just an ordinary register, it can be specified in
struct gdbarchinstead (see
pc_regnumbelow) and it will be read or written using the standard routines to access registers. This function need only be specified if the program counter is not an ordinary register.
Any register information can be obtained using the supplied register cache, regcache. See Register Caching.
These functions should be defined if there are any pseudo-registers. The default value is
NULL. regnum is the number of the register to read or write (which will be a cooked register number) and buf is the buffer where the value read will be placed, or from which the value to be written will be taken. The value in the buffer may be converted to or from a signed or unsigned integral value using one of the utility functions (see Using Different Register and Memory Data Representations).
The access should be for the specified architecture, gdbarch. Any register information can be obtained using the supplied register cache, regcache. See Register Caching.
The value of the stack pointer register can be accessed withing gdb as the variable $sp.
This specifies the register holding the program counter, which may be a raw or pseudo-register. It defaults to -1 (not defined). If
pc_regnumis not defined, then the functions
write_pc(see above) must be defined.
The value of the program counter (whether defined as a register, or through
write_pc) can be accessed withing gdb as the variable $pc.
If defined, the value of this register can be accessed withing gdb as the variable $ps.