| www.delorie.com/gnu/docs/gdb/gdbint_66.html | search |
![]() Buy the book! | |
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Maintainer note: This section is pretty much obsolete. The functionality described here has largely been replaced by pseudo-registers and the mechanisms described in Using Different Register and Memory Data Representations. See also Bug Tracking Database and ARI Index for more up-to-date information.
Some architectures use one representation for a value when it lives in a
register, but use a different representation when it lives in memory.
In GDB's terminology, the raw representation is the one used in
the target registers, and the virtual representation is the one
used in memory, and within GDB struct value objects.
Maintainer note: Notice that the same mechanism is being used to
both convert a register to a struct value and alternative
register forms.
For almost all data types on almost all architectures, the virtual and raw representations are identical, and no special handling is needed. However, they do occasionally differ. For example:
long double type. However, when
we store those values in memory, they occupy twelve bytes: the
floating-point number occupies the first ten, and the final two bytes
are unused. This keeps the values aligned on four-byte boundaries,
allowing more efficient access. Thus, the x86 80-bit floating-point
type is the raw representation, and the twelve-byte loosely-packed
arrangement is the virtual representation.
In general, the raw representation is determined by the architecture, or
GDB's interface to the architecture, while the virtual representation
can be chosen for GDB's convenience. GDB's register file,
registers, holds the register contents in raw format, and the
GDB remote protocol transmits register values in raw format.
Your architecture may define the following macros to request conversions between the raw and virtual format:
You should not use REGISTER_CONVERT_TO_VIRTUAL for a register
unless this macro returns a non-zero value for that register.
registers, or in a GDB
remote protocol packet.
struct value's buffer will have, holding that
register's value.
REGISTER_VIRTUAL_TYPE (reg). The buffer
at from holds the register's value in raw format; the macro should
convert the value to virtual format, and place it at to.
Note that REGISTER_CONVERT_TO_VIRTUAL and
REGISTER_CONVERT_TO_RAW take their reg and type
arguments in different orders.
You should only use REGISTER_CONVERT_TO_VIRTUAL with registers
for which the REGISTER_CONVERTIBLE macro returns a non-zero
value.
REGISTER_VIRTUAL_TYPE (reg). The buffer
at from holds the register's value in raw format; the macro should
convert the value to virtual format, and place it at to.
Note that REGISTER_CONVERT_TO_VIRTUAL and REGISTER_CONVERT_TO_RAW take their reg and type arguments in different orders.
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
| webmaster donations bookstore | delorie software privacy |
| Copyright © 2003 by The Free Software Foundation | Updated Jun 2003 |