Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: "H.J. Lu" <hjl.tools@gmail.com>
To: Pedro Alves <pedro@codesourcery.com>
Cc: gdb-patches@sourceware.org
Subject: Re: PATCH: gdbserver: Clear regcache if buf is NULL
Date: Fri, 01 Oct 2010 01:51:00 -0000	[thread overview]
Message-ID: <AANLkTim6oLv-WqasLRfxG=tf3QVFj=hP=Nn1U0KGovcm@mail.gmail.com> (raw)
In-Reply-To: <201009282123.29913.pedro@codesourcery.com>

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.


  reply	other threads:[~2010-10-01  1:51 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-02-03 17:44 H.J. Lu
2010-02-03 17:57 ` Daniel Jacobowitz
2010-09-29  1:54 ` Pedro Alves
2010-10-01  1:51   ` H.J. Lu [this message]
2010-10-16 20:01     ` Pedro Alves
2010-10-16 20:16       ` H.J. Lu
2010-10-16 20:49         ` Pedro Alves
2010-10-16 22:02           ` H.J. Lu
2010-10-17  8:01             ` Pedro Alves
2010-10-31 13:25           ` Mark Kettenis

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='AANLkTim6oLv-WqasLRfxG=tf3QVFj=hP=Nn1U0KGovcm@mail.gmail.com' \
    --to=hjl.tools@gmail.com \
    --cc=gdb-patches@sourceware.org \
    --cc=pedro@codesourcery.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox