Next: Frame Interpretation, Previous: Raw and Virtual Registers, Up: Target Architecture Definition
Maintainer's note: The way GDB manipulates registers is undergoing significant change. Many of the macros and functions referred to in this section are likely to be subject to further revision. See A.R. Index and Bug Tracking Database for further information. cagney/2002-05-06.
Some architectures can represent a data object in a register using a form that is different to the objects more normal memory representation. For example:
long double
data type occupies 96 bits in memory but only 80 bits
when stored in a register.
In general, the register representation of a data type is determined by the architecture, or gdb's interface to the architecture, while the memory representation is determined by the Application Binary Interface.
For almost all data types on almost all architectures, the two representations are identical, and no special handling is needed. However, they do occasionally differ. Your architecture may define the following macros to request conversions between the register and memory representations of a data type:
Return non-zero if the representation of a data value stored in this register may be different to the representation of that same data value when stored in memory.
When non-zero, the macros
gdbarch_register_to_value
andvalue_to_register
are used to perform any necessary conversion.This function should return zero for the register's native type, when no conversion is necessary.
Convert the value of register number reg to a data object of type type. The buffer at from holds the register's value in raw format; the converted value should be placed in the buffer at to.
Note that
gdbarch_register_to_value
andgdbarch_value_to_register
take their reg and type arguments in different orders.You should only use
gdbarch_register_to_value
with registers for which thegdbarch_convert_register_p
function returns a non-zero value.
Convert a data value of type type to register number reg' raw format.
Note that
gdbarch_register_to_value
andgdbarch_value_to_register
take their reg and type arguments in different orders.You should only use
gdbarch_value_to_register
with registers for which thegdbarch_convert_register_p
function returns a non-zero value.