This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: PATCH: gdbserver: Clear regcache if buf is NULL


On Tue, Sep 28, 2010 at 1:23 PM, Pedro Alves <pedro@codesourcery.com> wrote:
> 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?
>

i387-fp.c has

  if ((x86_xcr0 & I386_XSTATE_SSE))
    {
      int xmm0_regnum = find_regno ("xmm0");

      if ((clear_bv & I386_XSTATE_SSE))
        p = NULL;
      else
        p = (char *) buf;

      for (i = 0; i < num_xmm_registers; i++)
        {
          if (p)
            p = ((char *) &fp->xmm_space[0]) + i * 16;
          supply_register (regcache, i + xmm0_regnum, p);
        }
    }



-- 
H.J.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]