This page was produced by an automated import process, and may have formatting errors; feel free to fix. [Functions-and-Variables-Specifying-the-Register-Architecture ]

Functions and Variables Specifying the Register Architecture

These struct gdbarch functions and variables specify the number and type of registers in the architecture.

Architecture Function: ''CORE_ADDR'' read_pc ''(struct regcache *''regcache'')''
Architecture Function: ''void'' write_pc ''(struct regcache *''regcache'', CORE_ADDR ''val'')''

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 gdbarch instead (see pc_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.

Architecture Function: ''void'' pseudo_register_read ''(struct gdbarch *''gdbarch'', struct regcache *''regcache'', int ''regnum'', const gdb_byte *''buf'')''
Architecture Function: ''void'' pseudo_register_write ''(struct gdbarch *''gdbarch'', struct regcache *''regcache'', int ''regnum'', const gdb_byte *''buf'')''

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.

Architecture Variable: ''int'' sp_regnum

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.

Architecture Variable: ''int'' pc_regnum

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 functions read_pc and write_pc (see above) must be defined.

The value of the program counter (whether defined as a register, or through read_pc and write_pc) can be accessed withing GDB as the variable $pc.

Architecture Variable: ''int'' ps_regnum

This specifies the register holding the processor status (often called the status register), which may be a raw or pseudo-register. It defaults to -1 (not defined).

If defined, the value of this register can be accessed withing GDB as the variable $ps.

Architecture Variable: ''int'' fp0_regnum

This specifies the first floating point register. It defaults to 0. fp0_regnum is not needed unless the target offers support for floating point.

None: Internals Register-Architecture-Functions-_0026-Variables (last edited 2013-08-20 23:41:15 by StanShebs)

All content (C) 2008 Free Software Foundation. For terms of use, redistribution, and modification, please see the WikiLicense page.