RFA: Recognize 'x' in response to 'p' packet

Michael Snyder msnyder@redhat.com
Fri Dec 3 21:45:00 GMT 2004

Paul Schlie wrote:
>>Jim Blandy
>>* remote.c (fetch_register_using_p): Recognize 'x's for the value
>>  of the register as indicating that the register's value is not
>>  available.
> Out of curiosity, under what practical circumstances would the value of a
> register not be accessible? (and if not, shouldn't an error be returned, as
> opposed to an 'x' which is converted to a 0 anyway? Which I've noticed "g"
> packets also assume?)

Post-mortem debugging.  See tracepoint.c.  In a nutshell, you set up a
tracing experiment wherein a debugging agent on the target (like an
enhanced version of gdbserver) will collect data for you on the fly,
saving it to be retrieved later.  Data can include register values
and memory values.  During the post-mortem data examination stage,
the target agent enters a mode where, whenever GDB requests a register
or memory value, the agent supplies it from the collected cache rather
than from the 'live' target.  It lets GDB look at a saved machine state,
but you can only examine those registers that were saved.  Those that
weren't saved are not available, hence we need an idiom for reporting
this to gdb.  We can't use any legitimate integer value because a saved
register might actually have had that value.

More information about the Gdb-patches mailing list