This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: PATCH: gdbserver: Clear regcache if buf is NULL
- From: Pedro Alves <pedro at codesourcery dot com>
- To: gdb-patches at sourceware dot org, "H.J. Lu" <hjl dot tools at gmail dot com>
- Date: Tue, 28 Sep 2010 21:23:29 +0100
- Subject: Re: PATCH: gdbserver: Clear regcache if buf is NULL
- References: <20100203174414.GA29948@lucon.org>
On Wednesday 03 February 2010 17:44:14, H.J. Lu wrote:
> If xstate_bv bits are zero, XSAVE extended state is in init state and
> gdbserver should treat XMM/YMM registers as 0. This patch clears regcache
> if buf is NULL. OK to install?
>
> Thanks.
>
>
> H.J.
> ---
> 2010-02-03 H.J. Lu <hongjiu.lu@intel.com>
>
> * regcache.c (supply_register): Clear regcache if buf is NULL.
>
> diff --git a/gdb/gdbserver/regcache.c b/gdb/gdbserver/regcache.c
> index 2082604..d6cdc46 100644
> --- a/gdb/gdbserver/regcache.c
> +++ b/gdb/gdbserver/regcache.c
> @@ -215,7 +215,10 @@ register_data (struct regcache *regcache, int n, int fetch)
> void
> supply_register (struct regcache *regcache, int n, const void *buf)
> {
> - memcpy (register_data (regcache, n, 0), buf, register_size (n));
> + if (buf)
> + memcpy (register_data (regcache, n, 0), buf, register_size (n));
> + else
> + memset (register_data (regcache, n, 0), 0, register_size (n));
> }
Hi H.J.. I'm looking at where in the current sources this
ended up being used, and not finding it. Am I right in thinking
that the need for this was obsoleted when you later tought
gdbserver x86-linux about xml descriptions?
I'm teaching gdbserver to tell gdb about unavailable registers
in the context of tracepoint frames, and wondering whether to put
that info in the regcache for general use, or whether I can
make it tracepoint specific.
--
Pedro Alves