Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Pedro Alves <pedro@codesourcery.com>
To: Tom Tromey <tromey@redhat.com>, "H.J. Lu" <hjl.tools@gmail.com>
Cc: gdb-patches@sourceware.org, Daniel Jacobowitz <drow@false.org>
Subject: Re: RFC: partially available registers
Date: Wed, 27 Jul 2011 19:33:00 -0000	[thread overview]
Message-ID: <201107272026.24532.pedro@codesourcery.com> (raw)
In-Reply-To: <m34o278rth.fsf@fleche.redhat.com>

On Wednesday 27 July 2011 20:08:26, Tom Tromey wrote:
> Pedro> ... but I think that we should go with 0, instead of <unavailable>,
> Pedro> meaning changing x87-tdep.c:i387_supply_xsave to supply
> Pedro> explicity zeroed buffer, instead of a NULL pointer, like
> Pedro> gdbserver does.
> 
> Tom> I will do this.
> 
> Here's the patch.

Thanks.  Why only the AVX state though?  There are
several other places in the same function that
pass NULL to regcache_raw_supply that I think
should get the same treatment.

i387_supply_xsave accepts and handles a NULL XSAVE
argument.  I suppose it's for cores that miss the
xsave section?  I can't quite tell what path ends 
up calling i387_supply_xsave with NULL.  Maybe it's
dead code (I remember this code having changed a bit
the design throughout the review iterations; this bit may
have been left behind).  If not dead, that may be a genuine
case for <unavailable>.

> 
> In absence of comment I will check it in, in a couple of days.
> 
> Built and regtested by the buildbot.
> 
> Tom
> 
> 2011-07-27  Tom Tromey  <tromey@redhat.com>
> 
> 	* i387-tdep.c (i387_supply_xsave): Supply zero for high bits of
> 	AVX registers.
> 
> diff --git a/gdb/i387-tdep.c b/gdb/i387-tdep.c
> index c4ace82..332d491 100644
> --- a/gdb/i387-tdep.c
> +++ b/gdb/i387-tdep.c
> @@ -798,17 +798,26 @@ i387_supply_xsave (struct regcache *regcache, int regnum,
>        /* Handle the upper YMM registers.  */
>        if ((tdep->xcr0 & I386_XSTATE_AVX))
>  	{
> +	  gdb_byte buf[MAX_REGISTER_SIZE];
> +
>  	  if ((clear_bv & I386_XSTATE_AVX))
> -	    p = NULL;
> +	    {
> +	      memset (buf, 0, sizeof (buf));
> +	      p = NULL;
> +	    }
>  	  else
>  	    p = regs;
>  
>  	  for (i = I387_YMM0H_REGNUM (tdep);
>  	       i < I387_YMMENDH_REGNUM (tdep); i++)
>  	    {
> +	      const void *arg;
> +
>  	      if (p != NULL)
> -		p = XSAVE_AVXH_ADDR (tdep, regs, i);
> -	      regcache_raw_supply (regcache, i, p);
> +		arg = XSAVE_AVXH_ADDR (tdep, regs, i);
> +	      else
> +		arg = buf;
> +	      regcache_raw_supply (regcache, i, arg);
>  	    }
>  	}
>  
> 

-- 
Pedro Alves


  reply	other threads:[~2011-07-27 19:26 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-07-13 20:17 Tom Tromey
2011-07-14  4:24 ` Daniel Jacobowitz
2011-07-15 20:52   ` Tom Tromey
2011-07-18  4:15     ` Daniel Jacobowitz
2011-07-20 20:14       ` Pedro Alves
2011-07-20 18:49     ` Sergio Durigan Junior
2011-07-20 20:46     ` Tom Tromey
2011-07-20 20:53       ` Tom Tromey
2011-07-24 13:48         ` Mark Kettenis
2011-07-25 15:50           ` Tom Tromey
2011-07-21  5:23       ` Ulrich Weigand
2011-07-21 20:27         ` Tom Tromey
2011-07-22 13:48           ` Ulrich Weigand
2011-07-22 15:42             ` Tom Tromey
2011-07-22 14:30       ` Pedro Alves
2011-07-22 15:40         ` Tom Tromey
2011-07-22 19:10           ` Pedro Alves
2011-07-22 19:19             ` Tom Tromey
2011-07-22 19:31               ` Pedro Alves
2011-07-22 21:58                 ` Pedro Alves
2011-07-22 22:20                 ` Tom Tromey
2011-07-26 17:08                   ` Pedro Alves
2011-07-26 17:13                     ` Pedro Alves
2011-07-26 19:46                       ` Tom Tromey
2011-07-27 18:25                     ` Tom Tromey
2011-07-27 19:30                       ` Tom Tromey
2011-07-27 19:33                         ` Pedro Alves [this message]
2011-07-28  5:19                         ` 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=201107272026.24532.pedro@codesourcery.com \
    --to=pedro@codesourcery.com \
    --cc=drow@false.org \
    --cc=gdb-patches@sourceware.org \
    --cc=hjl.tools@gmail.com \
    --cc=tromey@redhat.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