www.delorie.com/gnu/docs/gdb/gdbint_67.html   search  
 
Buy the book!


GDB Internals

[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

9.5 Using Different Register and Memory Data Representations

Maintainer's note: The way GDB manipulates registers is undergoing significant change. Many of the macros and functions refered 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:

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:

Target Macro: int CONVERT_REGISTER_P (int reg)
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 REGISTER_TO_VALUE and VALUE_TO_REGISTER are used to perform any necessary conversion.

Target Macro: void REGISTER_TO_VALUE (int reg, struct type *type, char *from, char *to)
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 REGISTER_TO_VALUE and VALUE_TO_REGISTER take their reg and type arguments in different orders.

You should only use REGISTER_TO_VALUE with registers for which the CONVERT_REGISTER_P macro returns a non-zero value.

Target Macro: void VALUE_TO_REGISTER (struct type *type, int reg, char *from, char *to)
Convert a data value of type type to register number reg' raw format.

Note that REGISTER_TO_VALUE and VALUE_TO_REGISTER take their reg and type arguments in different orders.

You should only use VALUE_TO_REGISTER with registers for which the CONVERT_REGISTER_P macro returns a non-zero value.

Target Macro: void REGISTER_CONVERT_TO_TYPE (int regnum, struct type *type, char *buf)
See `mips-tdep.c'. It does not do what you want.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

  webmaster   donations   bookstore     delorie software   privacy  
  Copyright © 2003   by The Free Software Foundation     Updated Jun 2003