Next: Register and Memory Data, Previous: Register Architecture Functions & Variables, Up: Register Representation
These functions return information about registers.
This function should convert a register number (raw or pseudo) to a register name (as a C
const char *
). This is used both to determine the name of a register for output and to work out the meaning of any register names used as input. The function may also returnNULL
, to indicate that regnum is not a valid register.For example with the OpenRISC 1000, gdb registers 0-31 are the General Purpose Registers, register 32 is the program counter and register 33 is the supervision register (i.e. the processor status register), which map to the strings
"gpr00"
through"gpr31"
,"pc"
and"sr"
respectively. This means that the gdb command print $gpr5 should print the value of the OR1K general purpose register 51.The default value for this function is
NULL
, meaning undefined. It should always be defined.The access should be for the specified architecture, gdbarch.
Given a register number, this function identifies the type of data it may be holding, specified as a
struct type
. gdb allows creation of arbitrary types, but a number of built in types are provided (builtin_type_void
,builtin_type_int32
etc), together with functions to derive types from these.Typically the program counter will have a type of “pointer to function” (it points to code), the frame pointer and stack pointer will have types of “pointer to void” (they point to data on the stack) and all other integer registers will have a type of 32-bit integer or 64-bit integer.
This information guides the formatting when displaying register information. The default value is
NULL
meaning no information is available to guide formatting when displaying registers.
Define this function to print out one or all of the registers for the gdb info registers command. The default value is the function
default_print_registers_info
, which uses the register type information (seeregister_type
above) to determine how each register should be printed. Define a custom version of this function for fuller control over how the registers are displayed.The access should be for the specified architecture, gdbarch, with output to the file specified by the User Interface Independent Output file handle, file (see UI-Independent Output—the
ui_out
Functions).The registers should show their values in the frame specified by frame. If regnum is -1 and all is zero, then all the “significant” registers should be shown (the implementer should decide which registers are “significant”). Otherwise only the value of the register specified by regnum should be output. If regnum is -1 and all is non-zero (true), then the value of all registers should be shown.
By default
default_print_registers_info
prints one register per line, and if all is zero omits floating-point registers.
Define this function to provide output about the floating point unit and registers for the gdb info float command respectively. The default value is
NULL
(not defined), meaning no information will be provided.The gdbarch and file and frame arguments have the same meaning as in the
print_registers_info
function above. The string args contains any supplementary arguments to the info float command.Define this function if the target supports floating point operations.
Define this function to provide output about the vector unit and registers for the gdb info vector command respectively. The default value is
NULL
(not defined), meaning no information will be provided.The gdbarch, file and frame arguments have the same meaning as in the
print_registers_info
function above. The string args contains any supplementary arguments to the info vector command.Define this function if the target supports vector operations.
gdb groups registers into different categories (general, vector, floating point etc). This function, given a register, regnum, and group, group, returns 1 (true) if the register is in the group and 0 (false) otherwise.
The information should be for the specified architecture, gdbarch
The default value is the function
default_register_reggroup_p
which will do a reasonable job based on the type of the register (see the functionregister_type
above), with groups for general purpose registers, floating point registers, vector registers and raw (i.e not pseudo) registers.
[1]
Historically, gdb always had a concept of a frame pointer
register, which could be accessed via the gdb variable,
$fp. That concept is now deprecated, recognizing that not all
architectures have a frame pointer. However if an architecture does
have a frame pointer register, and defines a register or
pseudo-register with the name "fp"
, then that register will be
used as the value of the $fp variable.