Next: Register Information Functions, Previous: Raw and Cooked Registers, Up: Register Representation
These struct gdbarch
functions and variables specify the number
and type of registers in the 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 instruct gdbarch
instead (seepc_regnum
below) 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.
This specifies the register holding the stack pointer, which may be a raw or pseudo-register. It defaults to -1 (not defined), but it is an error for it not to be defined.
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_regnum
is not defined, then the functionsread_pc
andwrite_pc
(see above) must be defined.The value of the program counter (whether defined as a register, or through
read_pc
andwrite_pc
) can be accessed withing gdb as the variable $pc.