11.6.5 Register Caching
struct regcache, associated with a
struct gdbarch to hold the cached values of the raw
registers. A set of functions is provided to access both the raw
raw in their name) and the full set of cooked
cooked in their name). Functions are provided
to ensure the register cache is kept synchronized with the values of
the actual registers in the target.
Accessing registers through the
struct regcache routines will
ensure that the appropriate
struct gdbarch functions are called
when necessary to access the underlying target architecture. In general
users should use the cooked functions, since these will map to the
raw functions automatically as appropriate.
The two key functions are
regcache_cooked_write which read or write a register from or to
a byte buffer (type
gdb_byte *). For convenience the wrapper
regcache_cooked_write_unsigned are provided, which read or
write the value using the buffer and convert to or from an integral
value as appropriate.