RFC: partially available registers

Tom Tromey tromey@redhat.com
Wed Jul 27 19:30:00 GMT 2011


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.

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);
 	    }
 	}
 



More information about the Gdb-patches mailing list