public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* s/regcache_valid_p/regcache_register_status; add enum register_status
@ 2011-01-25 14:18 Pedro Alves
  2011-01-30 11:50 ` Yao Qi
  0 siblings, 1 reply; 4+ messages in thread
From: Pedro Alves @ 2011-01-25 14:18 UTC (permalink / raw)
  To: gdb-patches

Rename regcache->register_valid_p to regstatus->register_status,
and expose the register status to common code as an enum.  The rename
helps with catching all callers, and is clearer anyway than (-1, 0, 1).

Follow up patches will make regcache_raw_read and regcache_cooked_read
return an indication of whether the returned value is actually
valid (really an enum register_status), because it had been composed
of unavailable raw registers, usually.  That'll be needed to properly support
unavailable/uncollected pseudo-registers.

Tested on x86_64-linux and applied.

-- 
Pedro Alves

2011-01-25  Pedro Alves  <pedro@codesourcery.com>

	* regcache.c (struct regcache_descr): Rename
	sizeof_raw_register_valid_p field to sizeof_raw_register_status,
	and sizeof_cooked_register_valid_p to
	sizeof_cooked_register_status.
	(init_regcache_descr): Adjust.
	(struct regcache): Rename register_valid_p field to
	register_status.
	(regcache_xmalloc_1, regcache_xfree, regcache_save)
	(do_cooked_read): Adjust.
	(regcache_valid_p): Rename to ...
	(regcache_register_status): ... this.  Adjust.
	(regcache_invalidate): Adjust.
	(regcache_raw_read, regcache_cooked_read, regcache_raw_write):
	Adjust.
	(regcache_raw_supply): Adjust.  If buf i NULL, mark the register
	as unavailable, not valid.
	(regcache_dump): Adjust.
	* regcache.h (enum register_status): New.
	(regcache_register_status): Declare.
	(regcache_invalidate): Delete declaration.
	* corelow.c (get_core_registers): Adjust.
	* tracepoint.c (tfile_fetch_registers): Adjust.
	* trad-frame.c (REG_VALUE): Rename to ...
	(TF_REG_VALUE): ... this.
	(REG_UNKNOWN): Rename to ...
	(TF_REG_UNKNOWN): ... this.
	(trad_frame_set_value, trad_frame_set_unknown): Adjust.
	* mi/mi-main.c (register_changed_p): Adjust.

---
 gdb/corelow.c    |    4 +-
 gdb/mi/mi-main.c |    4 +-
 gdb/regcache.c   |   89 
+++++++++++++++++++++++++++++--------------------------
 gdb/regcache.h   |   23 ++++++++++++--
 gdb/tracepoint.c |    2 -
 gdb/trad-frame.c |    8 ++--
 6 files changed, 78 insertions(+), 52 deletions(-)

Index: src/gdb/regcache.c
===================================================================
--- src.orig/gdb/regcache.c	2011-01-25 11:57:57.000000000 +0000
+++ src/gdb/regcache.c	2011-01-25 12:40:34.107639998 +0000
@@ -53,7 +53,7 @@ struct regcache_descr
      cache.  */
   int nr_raw_registers;
   long sizeof_raw_registers;
-  long sizeof_raw_register_valid_p;
+  long sizeof_raw_register_status;
 
   /* The cooked register space.  Each cooked register in the range
      [0..NR_RAW_REGISTERS) is direct-mapped onto the corresponding raw
@@ -63,7 +63,7 @@ struct regcache_descr
      gdbarch_pseudo_register_read and gdbarch_pseudo_register_write.  */
   int nr_cooked_registers;
   long sizeof_cooked_registers;
-  long sizeof_cooked_register_valid_p;
+  long sizeof_cooked_register_status;
 
   /* Offset and size (in 8 bit bytes), of reach register in the
      register cache.  All registers (including those in the range
@@ -92,9 +92,8 @@ init_regcache_descr (struct gdbarch *gdb
      either mapped onto raw-registers or memory.  */
   descr->nr_cooked_registers = gdbarch_num_regs (gdbarch)
 			       + gdbarch_num_pseudo_regs (gdbarch);
-  descr->sizeof_cooked_register_valid_p = gdbarch_num_regs (gdbarch)
-					  + gdbarch_num_pseudo_regs 
-					      (gdbarch);
+  descr->sizeof_cooked_register_status
+    = gdbarch_num_regs (gdbarch) + gdbarch_num_pseudo_regs (gdbarch);
 
   /* Fill in a table of register types.  */
   descr->register_type
@@ -106,7 +105,7 @@ init_regcache_descr (struct gdbarch *gdb
   /* Construct a strictly RAW register cache.  Don't allow pseudo's
      into the register cache.  */
   descr->nr_raw_registers = gdbarch_num_regs (gdbarch);
-  descr->sizeof_raw_register_valid_p = gdbarch_num_regs (gdbarch);
+  descr->sizeof_raw_register_status = gdbarch_num_regs (gdbarch);
 
   /* Lay out the register cache.
 
@@ -194,11 +193,8 @@ struct regcache
      full [0 .. gdbarch_num_regs + gdbarch_num_pseudo_regs) while a 
read/write
      register cache can only hold [0 .. gdbarch_num_regs).  */
   gdb_byte *registers;
-  /* Register cache status:
-     register_valid_p[REG] == 0 if REG value is not in the cache
-                            > 0 if REG value is in the cache
-                            < 0 if REG value is permanently unavailable */
-  signed char *register_valid_p;
+  /* Register cache status.  */
+  signed char *register_status;
   /* Is this a read-only cache?  A read-only cache is used for saving
      the target's register state (e.g, across an inferior function
      call or just before forcing a function return).  A read-only
@@ -227,15 +223,15 @@ regcache_xmalloc_1 (struct gdbarch *gdba
     {
       regcache->registers
 	= XCALLOC (descr->sizeof_cooked_registers, gdb_byte);
-      regcache->register_valid_p
-	= XCALLOC (descr->sizeof_cooked_register_valid_p, gdb_byte);
+      regcache->register_status
+	= XCALLOC (descr->sizeof_cooked_register_status, gdb_byte);
     }
   else
     {
       regcache->registers
 	= XCALLOC (descr->sizeof_raw_registers, gdb_byte);
-      regcache->register_valid_p
-	= XCALLOC (descr->sizeof_raw_register_valid_p, gdb_byte);
+      regcache->register_status
+	= XCALLOC (descr->sizeof_raw_register_status, gdb_byte);
     }
   regcache->aspace = aspace;
   regcache->ptid = minus_one_ptid;
@@ -254,7 +250,7 @@ regcache_xfree (struct regcache *regcach
   if (regcache == NULL)
     return;
   xfree (regcache->registers);
-  xfree (regcache->register_valid_p);
+  xfree (regcache->register_status);
   xfree (regcache);
 }
 
@@ -306,8 +302,8 @@ regcache_save (struct regcache *dst, reg
   gdb_assert (dst->readonly_p);
   /* Clear the dest.  */
   memset (dst->registers, 0, dst->descr->sizeof_cooked_registers);
-  memset (dst->register_valid_p, 0,
-	  dst->descr->sizeof_cooked_register_valid_p);
+  memset (dst->register_status, 0,
+	  dst->descr->sizeof_cooked_register_status);
   /* Copy over any registers (identified by their membership in the
      save_reggroup) and mark them as valid.  The full [0 .. gdbarch_num_regs 
+
      gdbarch_num_pseudo_regs) range is checked since some architectures need
@@ -322,7 +318,7 @@ regcache_save (struct regcache *dst, reg
 	    {
 	      memcpy (register_buffer (dst, regnum), buf,
 		      register_size (gdbarch, regnum));
-	      dst->register_valid_p[regnum] = 1;
+	      dst->register_status[regnum] = REG_VALID;
 	    }
 	}
     }
@@ -361,7 +357,7 @@ do_cooked_read (void *src, int regnum, g
 {
   struct regcache *regcache = src;
 
-  if (!regcache->register_valid_p[regnum] && regcache->readonly_p)
+  if (regcache->register_status[regnum] == REG_UNKNOWN && regcache-
>readonly_p)
     /* Don't even think about fetching a register from a read-only
        cache when the register isn't yet valid.  There isn't a target
        from which the register value can be fetched.  */
@@ -393,14 +389,15 @@ regcache_cpy_no_passthrough (struct regc
   gdb_assert (src != NULL && dst != NULL);
   gdb_assert (src->descr->gdbarch == dst->descr->gdbarch);
   /* NOTE: cagney/2002-05-17: Don't let the caller do a no-passthrough
-     move of data into the current regcache.  Doing this would be
-     silly - it would mean that valid_p would be completely invalid.  */
+     move of data into a thread's regcache.  Doing this would be silly
+     - it would mean that regcache->register_status would be
+     completely invalid.  */
   gdb_assert (dst->readonly_p && src->readonly_p);
 
   memcpy (dst->registers, src->registers,
 	  dst->descr->sizeof_cooked_registers);
-  memcpy (dst->register_valid_p, src->register_valid_p,
-	  dst->descr->sizeof_cooked_register_valid_p);
+  memcpy (dst->register_status, src->register_status,
+	  dst->descr->sizeof_cooked_register_status);
 }
 
 struct regcache *
@@ -414,7 +411,7 @@ regcache_dup (struct regcache *src)
 }
 
 int
-regcache_valid_p (const struct regcache *regcache, int regnum)
+regcache_register_status (const struct regcache *regcache, int regnum)
 {
   gdb_assert (regcache != NULL);
   gdb_assert (regnum >= 0);
@@ -423,7 +420,7 @@ regcache_valid_p (const struct regcache
   else
     gdb_assert (regnum < regcache->descr->nr_raw_registers);
 
-  return regcache->register_valid_p[regnum];
+  return regcache->register_status[regnum];
 }
 
 void
@@ -433,7 +430,7 @@ regcache_invalidate (struct regcache *re
   gdb_assert (regnum >= 0);
   gdb_assert (!regcache->readonly_p);
   gdb_assert (regnum < regcache->descr->nr_raw_registers);
-  regcache->register_valid_p[regnum] = 0;
+  regcache->register_status[regnum] = REG_UNKNOWN;
 }
 
 
@@ -586,7 +583,7 @@ regcache_raw_read (struct regcache *regc
      On the bright side, at least there is a regcache object.  */
   if (!regcache->readonly_p)
     {
-      if (!regcache_valid_p (regcache, regnum))
+      if (regcache_register_status (regcache, regnum) == REG_UNKNOWN)
 	{
 	  struct cleanup *old_chain = save_inferior_ptid ();
 
@@ -601,7 +598,7 @@ regcache_raw_read (struct regcache *regc
 	 that a register is in one of the possible states: valid,
 	 undefined, unknown.  The last of which isn't yet
 	 possible.  */
-      gdb_assert (regcache_valid_p (regcache, regnum));
+      gdb_assert (regcache_register_status (regcache, regnum) == REG_VALID);
 #endif
     }
   /* Copy the value directly into the register cache.  */
@@ -674,8 +671,8 @@ regcache_cooked_read (struct regcache *r
     regcache_raw_read (regcache, regnum, buf);
   else if (regcache->readonly_p
 	   && regnum < regcache->descr->nr_cooked_registers
-	   && regcache->register_valid_p[regnum])
-    /* Read-only register cache, perhaps the cooked value was cached?  */
+	   && regcache->register_status[regnum] == REG_VALID)
+    /* Read-only register cache, and the cooked value was cached.  */
     memcpy (buf, register_buffer (regcache, regnum),
 	    regcache->descr->sizeof_register[regnum]);
   else
@@ -758,7 +755,7 @@ regcache_raw_write (struct regcache *reg
 
   /* If we have a valid copy of the register, and new value == old
      value, then don't bother doing the actual store.  */
-  if (regcache_valid_p (regcache, regnum)
+  if (regcache_register_status (regcache, regnum) == REG_VALID
       && (memcmp (register_buffer (regcache, regnum), buf,
 		  regcache->descr->sizeof_register[regnum]) == 0))
     return;
@@ -769,7 +766,7 @@ regcache_raw_write (struct regcache *reg
   target_prepare_to_store (regcache);
   memcpy (register_buffer (regcache, regnum), buf,
 	  regcache->descr->sizeof_register[regnum]);
-  regcache->register_valid_p[regnum] = 1;
+  regcache->register_status[regnum] = REG_VALID;
   target_store_registers (regcache, regnum);
 
   do_cleanups (old_chain);
@@ -893,12 +890,18 @@ regcache_raw_supply (struct regcache *re
   size = regcache->descr->sizeof_register[regnum];
 
   if (buf)
-    memcpy (regbuf, buf, size);
+    {
+      memcpy (regbuf, buf, size);
+      regcache->register_status[regnum] = REG_VALID;
+    }
   else
-    memset (regbuf, 0, size);
-
-  /* Mark the register as cached.  */
-  regcache->register_valid_p[regnum] = 1;
+    {
+      /* This memset not strictly necessary, but better than garbage
+	 in case the register value manages to escape somewhere (due
+	 to a bug, no less).  */
+      memset (regbuf, 0, size);
+      regcache->register_status[regnum] = REG_UNAVAILABLE;
+    }
 }
 
 /* Collect register REGNUM from REGCACHE and store its contents in BUF.  */
@@ -1022,8 +1025,8 @@ regcache_dump (struct regcache *regcache
 		      regcache->descr->nr_cooked_registers);
   fprintf_unfiltered (file, "sizeof_raw_registers %ld\n",
 		      regcache->descr->sizeof_raw_registers);
-  fprintf_unfiltered (file, "sizeof_raw_register_valid_p %ld\n",
-		      regcache->descr->sizeof_raw_register_valid_p);
+  fprintf_unfiltered (file, "sizeof_raw_register_status %ld\n",
+		      regcache->descr->sizeof_raw_register_status);
   fprintf_unfiltered (file, "gdbarch_num_regs %d\n", 
 		      gdbarch_num_regs (gdbarch));
   fprintf_unfiltered (file, "gdbarch_num_pseudo_regs %d\n",
@@ -1134,8 +1137,10 @@ regcache_dump (struct regcache *regcache
 	    fprintf_unfiltered (file, "Raw value");
 	  else if (regnum >= regcache->descr->nr_raw_registers)
 	    fprintf_unfiltered (file, "<cooked>");
-	  else if (!regcache_valid_p (regcache, regnum))
+	  else if (regcache_register_status (regcache, regnum) == REG_UNKNOWN)
 	    fprintf_unfiltered (file, "<invalid>");
+	  else if (regcache_register_status (regcache, regnum) == REG_UNAVAILABLE)
+	    fprintf_unfiltered (file, "<unavailable>");
 	  else
 	    {
 	      regcache_raw_read (regcache, regnum, buf);
@@ -1153,6 +1158,8 @@ regcache_dump (struct regcache *regcache
 	    fprintf_unfiltered (file, "Cooked value");
 	  else
 	    {
+	      /* FIXME: no way for cooked reads to signal unavailable
+		 yet.  */
 	      regcache_cooked_read (regcache, regnum, buf);
 	      fprintf_unfiltered (file, "0x");
 	      dump_endian_bytes (file,
Index: src/gdb/regcache.h
===================================================================
--- src.orig/gdb/regcache.h	2011-01-25 11:58:34.000000000 +0000
+++ src/gdb/regcache.h	2011-01-25 12:29:51.037639999 +0000
@@ -42,6 +42,27 @@ extern struct gdbarch *get_regcache_arch
 
 extern struct address_space *get_regcache_aspace (const struct regcache *);
 
+enum register_status
+  {
+    /* The register value is not in the cache, and we don't know yet
+       whether it's available in the target (or traceframe).  */
+    REG_UNKNOWN = 0,
+
+    /* The register value is valid and cached.  */
+    REG_VALID = 1,
+
+    /* The register value is unavailable.  E.g., we're inspecting a
+       traceframe, and this register wasn't collected.  Note that this
+       is different a different "unavailable" from saying the register
+       does not exist in the target's architecture --- in that case,
+       the target should have given us a target description that does
+       not include the register in the first place.  */
+    REG_UNAVAILABLE = -1
+  };
+
+enum register_status regcache_register_status (const struct regcache 
*regcache,
+					       int regnum);
+
 /* Transfer a raw register [0..NUM_REGS) between core-gdb and the
    regcache.  */
 
@@ -65,8 +86,6 @@ void regcache_raw_read_part (struct regc
 void regcache_raw_write_part (struct regcache *regcache, int regnum,
 			      int offset, int len, const gdb_byte *buf);
 
-int regcache_valid_p (const struct regcache *regcache, int regnum);
-
 void regcache_invalidate (struct regcache *regcache, int regnum);
 
 /* Transfer a cooked register [0..NUM_REGS+NUM_PSEUDO_REGS).  */
Index: src/gdb/corelow.c
===================================================================
--- src.orig/gdb/corelow.c	2011-01-13 15:07:19.000000000 +0000
+++ src/gdb/corelow.c	2011-01-25 12:26:25.547640002 +0000
@@ -615,9 +615,9 @@ get_core_registers (struct target_ops *o
 				 ".reg2", 2, "floating-point", 0);
     }
 
-  /* Supply dummy value for all registers not found in the core.  */
+  /* Mark all registers not found in the core as unavailable.  */
   for (i = 0; i < gdbarch_num_regs (get_regcache_arch (regcache)); i++)
-    if (!regcache_valid_p (regcache, i))
+    if (regcache_register_status (regcache, i) == REG_UNKNOWN)
       regcache_raw_supply (regcache, i, NULL);
 }
 
Index: src/gdb/mi/mi-main.c
===================================================================
--- src.orig/gdb/mi/mi-main.c	2011-01-13 15:07:55.000000000 +0000
+++ src/gdb/mi/mi-main.c	2011-01-25 12:26:25.547640002 +0000
@@ -1023,13 +1023,13 @@ register_changed_p (int regnum, struct r
   gdb_byte this_buffer[MAX_REGISTER_SIZE];
 
   /* Registers not valid in this frame return count as unchanged.  */
-  if (!regcache_valid_p (this_regs, regnum))
+  if (regcache_register_status (this_regs, regnum) == REG_UNKNOWN)
     return 0;
 
   /* First time through or after gdbarch change consider all registers as
      changed.  Same for registers not valid in the previous frame.  */
   if (!prev_regs || get_regcache_arch (prev_regs) != gdbarch
-      || !regcache_valid_p (prev_regs, regnum))
+      || regcache_register_status (prev_regs, regnum) == REG_UNKNOWN)
     return 1;
 
   /* Get register contents and compare.  */
Index: src/gdb/tracepoint.c
===================================================================
--- src.orig/gdb/tracepoint.c	2011-01-13 15:07:42.000000000 +0000
+++ src/gdb/tracepoint.c	2011-01-25 12:26:25.547640002 +0000
@@ -3844,7 +3844,7 @@ tfile_fetch_registers (struct target_ops
 	      /* Make sure we stay within block bounds.  */
 	      if (offset + regsize >= trace_regblock_size)
 		break;
-	      if (!regcache_valid_p (regcache, regn))
+	      if (regcache_register_status (regcache, regn) == REG_UNKNOWN)
 		{
 		  if (regno == regn)
 		    {
Index: src/gdb/trad-frame.c
===================================================================
--- src.orig/gdb/trad-frame.c	2011-01-13 15:07:42.000000000 +0000
+++ src/gdb/trad-frame.c	2011-01-25 12:26:25.547640002 +0000
@@ -66,12 +66,12 @@ trad_frame_alloc_saved_regs (struct fram
   return this_saved_regs;
 }
 
-enum { REG_VALUE = -1, REG_UNKNOWN = -2 };
+enum { TF_REG_VALUE = -1, TF_REG_UNKNOWN = -2 };
 
 int
 trad_frame_value_p (struct trad_frame_saved_reg this_saved_regs[], int 
regnum)
 {
-  return (this_saved_regs[regnum].realreg == REG_VALUE);
+  return (this_saved_regs[regnum].realreg == TF_REG_VALUE);
 }
 
 int
@@ -95,7 +95,7 @@ trad_frame_set_value (struct trad_frame_
 {
   /* Make the REALREG invalid, indicating that the ADDR contains the
      register's value.  */
-  this_saved_regs[regnum].realreg = REG_VALUE;
+  this_saved_regs[regnum].realreg = TF_REG_VALUE;
   this_saved_regs[regnum].addr = val;
 }
 
@@ -128,7 +128,7 @@ trad_frame_set_unknown (struct trad_fram
 			int regnum)
 {
   /* Make the REALREG invalid, indicating that the value is not known.  */
-  this_saved_regs[regnum].realreg = REG_UNKNOWN;
+  this_saved_regs[regnum].realreg = TF_REG_UNKNOWN;
   this_saved_regs[regnum].addr = -1;
 }
 

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: s/regcache_valid_p/regcache_register_status; add enum register_status
  2011-01-25 14:18 s/regcache_valid_p/regcache_register_status; add enum register_status Pedro Alves
@ 2011-01-30 11:50 ` Yao Qi
  2011-01-30 19:11   ` Pedro Alves
  0 siblings, 1 reply; 4+ messages in thread
From: Yao Qi @ 2011-01-30 11:50 UTC (permalink / raw)
  To: Pedro Alves; +Cc: gdb-patches

[-- Attachment #1: Type: text/plain, Size: 701 bytes --]

On 01/25/2011 08:49 PM, Pedro Alves wrote:
> 2011-01-25  Pedro Alves  <pedro@codesourcery.com>
> 
> 	* regcache.c (struct regcache_descr): Rename
[....]
> 	(regcache_valid_p): Rename to ...
> 	(regcache_register_status): ... this.  Adjust.

All the references to regcache_valid_p should be updated as well.

GDB native build on ARM is broken.
cc1: warnings being treated as errors
../../src/gdb/arm-linux-nat.c: In function store_fpregister:
../../src/gdb/arm-linux-nat.c:193: error: implicit declaration of
function regcache_valid_p

This patch is to s/regcache_valid_p/regcache_register_status in the rest
of gdb source files, and fix ARM native build failure.

OK to apply?

-- 
Yao (齐尧)

[-- Attachment #2: regcache_valid_p.patch --]
[-- Type: text/x-patch, Size: 9966 bytes --]

gdb/

2011-01-30  Yao Qi  <yao@codesourcery.com>

	* arm-linux-nat.c: Update calls to regcache_register_status
	instead of regcache_valid_p.
	* aix-thread.c: Likewise.
	* i386gnu-nat.c: Likewise.

Index: gdb/aix-thread.c
===================================================================
RCS file: /cvs/src/src/gdb/aix-thread.c,v
retrieving revision 1.74
diff -u -r1.74 aix-thread.c
--- gdb/aix-thread.c	7 Jan 2011 19:36:15 -0000	1.74
+++ gdb/aix-thread.c	30 Jan 2011 02:12:39 -0000
@@ -1321,7 +1321,7 @@
   int regno;
 
   for (regno = 0; regno < ppc_num_gprs; regno++)
-    if (regcache_valid_p (regcache, tdep->ppc_gp0_regnum + regno))
+    if (regcache_register_status (regcache, tdep->ppc_gp0_regnum + regno))
       regcache_raw_collect (regcache, tdep->ppc_gp0_regnum + regno,
 			    vals + regno);
 }
@@ -1333,7 +1333,7 @@
   int regno;
 
   for (regno = 0; regno < ppc_num_gprs; regno++)
-    if (regcache_valid_p (regcache, tdep->ppc_gp0_regnum + regno))
+    if (regcache_register_status (regcache, tdep->ppc_gp0_regnum + regno))
       regcache_raw_collect (regcache, tdep->ppc_gp0_regnum + regno,
 			    vals + regno);
 }
@@ -1353,7 +1353,7 @@
   for (regno = tdep->ppc_fp0_regnum;
        regno < tdep->ppc_fp0_regnum + ppc_num_fprs;
        regno++)
-    if (regcache_valid_p (regcache, regno))
+    if (regcache_register_status (regcache, regno))
       regcache_raw_collect (regcache, regno, vals + regno);
 }
 
@@ -1377,20 +1377,20 @@
   gdb_assert (sizeof (*iar) == register_size
 				 (gdbarch, gdbarch_pc_regnum (gdbarch)));
 
-  if (regcache_valid_p (regcache, gdbarch_pc_regnum (gdbarch)))
+  if (regcache_register_status (regcache, gdbarch_pc_regnum (gdbarch)))
     regcache_raw_collect (regcache, gdbarch_pc_regnum (gdbarch), iar);
-  if (regcache_valid_p (regcache, tdep->ppc_ps_regnum))
+  if (regcache_register_status (regcache, tdep->ppc_ps_regnum))
     regcache_raw_collect (regcache, tdep->ppc_ps_regnum, msr);
-  if (regcache_valid_p (regcache, tdep->ppc_cr_regnum))
+  if (regcache_register_status (regcache, tdep->ppc_cr_regnum))
     regcache_raw_collect (regcache, tdep->ppc_cr_regnum, cr);
-  if (regcache_valid_p (regcache, tdep->ppc_lr_regnum))
+  if (regcache_register_status (regcache, tdep->ppc_lr_regnum))
     regcache_raw_collect (regcache, tdep->ppc_lr_regnum, lr);
-  if (regcache_valid_p (regcache, tdep->ppc_ctr_regnum))
+  if (regcache_register_status (regcache, tdep->ppc_ctr_regnum))
     regcache_raw_collect (regcache, tdep->ppc_ctr_regnum, ctr);
-  if (regcache_valid_p (regcache, tdep->ppc_xer_regnum))
+  if (regcache_register_status (regcache, tdep->ppc_xer_regnum))
     regcache_raw_collect (regcache, tdep->ppc_xer_regnum, xer);
   if (tdep->ppc_fpscr_regnum >= 0
-      && regcache_valid_p (regcache, tdep->ppc_fpscr_regnum))
+      && regcache_register_status (regcache, tdep->ppc_fpscr_regnum))
     regcache_raw_collect (regcache, tdep->ppc_fpscr_regnum, fpscr);
 }
 
@@ -1411,20 +1411,20 @@
   gdb_assert (sizeof (*iar) == register_size (gdbarch,
 					      gdbarch_pc_regnum (gdbarch)));
 
-  if (regcache_valid_p (regcache, gdbarch_pc_regnum (gdbarch)))
+  if (regcache_register_status (regcache, gdbarch_pc_regnum (gdbarch)))
     regcache_raw_collect (regcache, gdbarch_pc_regnum (gdbarch), iar);
-  if (regcache_valid_p (regcache, tdep->ppc_ps_regnum))
+  if (regcache_register_status (regcache, tdep->ppc_ps_regnum))
     regcache_raw_collect (regcache, tdep->ppc_ps_regnum, msr);
-  if (regcache_valid_p (regcache, tdep->ppc_cr_regnum))
+  if (regcache_register_status (regcache, tdep->ppc_cr_regnum))
     regcache_raw_collect (regcache, tdep->ppc_cr_regnum, cr);
-  if (regcache_valid_p (regcache, tdep->ppc_lr_regnum))
+  if (regcache_register_status (regcache, tdep->ppc_lr_regnum))
     regcache_raw_collect (regcache, tdep->ppc_lr_regnum, lr);
-  if (regcache_valid_p (regcache, tdep->ppc_ctr_regnum))
+  if (regcache_register_status (regcache, tdep->ppc_ctr_regnum))
     regcache_raw_collect (regcache, tdep->ppc_ctr_regnum, ctr);
-  if (regcache_valid_p (regcache, tdep->ppc_xer_regnum))
+  if (regcache_register_status (regcache, tdep->ppc_xer_regnum))
     regcache_raw_collect (regcache, tdep->ppc_xer_regnum, xer);
   if (tdep->ppc_fpscr_regnum >= 0
-      && regcache_valid_p (regcache, tdep->ppc_fpscr_regnum))
+      && regcache_register_status (regcache, tdep->ppc_fpscr_regnum))
     regcache_raw_collect (regcache, tdep->ppc_fpscr_regnum, fpscr);
 }
 
@@ -1459,7 +1459,7 @@
   /* Collect general-purpose register values from the regcache.  */
 
   for (i = 0; i < ppc_num_gprs; i++)
-    if (regcache_valid_p (regcache, tdep->ppc_gp0_regnum + i))
+    if (regcache_register_status (regcache, tdep->ppc_gp0_regnum + i))
       {
 	if (arch64)
 	  {
@@ -1494,19 +1494,19 @@
 
       fill_sprs32 (regcache, &tmp_iar, &tmp_msr, &tmp_cr, &tmp_lr, &tmp_ctr,
 			     &tmp_xer, &tmp_fpscr);
-      if (regcache_valid_p (regcache, gdbarch_pc_regnum (gdbarch)))
+      if (regcache_register_status (regcache, gdbarch_pc_regnum (gdbarch)))
 	ctx.iar = tmp_iar;
-      if (regcache_valid_p (regcache, tdep->ppc_ps_regnum))
+      if (regcache_register_status (regcache, tdep->ppc_ps_regnum))
 	ctx.msr = tmp_msr;
-      if (regcache_valid_p (regcache, tdep->ppc_cr_regnum))
+      if (regcache_register_status (regcache, tdep->ppc_cr_regnum))
 	ctx.cr  = tmp_cr;
-      if (regcache_valid_p (regcache, tdep->ppc_lr_regnum))
+      if (regcache_register_status (regcache, tdep->ppc_lr_regnum))
 	ctx.lr  = tmp_lr;
-      if (regcache_valid_p (regcache, tdep->ppc_ctr_regnum))
+      if (regcache_register_status (regcache, tdep->ppc_ctr_regnum))
 	ctx.ctr = tmp_ctr;
-      if (regcache_valid_p (regcache, tdep->ppc_xer_regnum))
+      if (regcache_register_status (regcache, tdep->ppc_xer_regnum))
 	ctx.xer = tmp_xer;
-      if (regcache_valid_p (regcache, tdep->ppc_xer_regnum))
+      if (regcache_register_status (regcache, tdep->ppc_xer_regnum))
 	ctx.fpscr = tmp_fpscr;
     }
 
@@ -1620,7 +1620,7 @@
 	  sprs32.pt_fpscr = tmp_fpscr;
 
 	  if (tdep->ppc_mq_regnum >= 0)
-	    if (regcache_valid_p (regcache, tdep->ppc_mq_regnum))
+	    if (regcache_register_status (regcache, tdep->ppc_mq_regnum))
 	      regcache_raw_collect (regcache, tdep->ppc_mq_regnum,
 				    &sprs32.pt_mq);
 
Index: gdb/arm-linux-nat.c
===================================================================
RCS file: /cvs/src/src/gdb/arm-linux-nat.c,v
retrieving revision 1.45
diff -u -r1.45 arm-linux-nat.c
--- gdb/arm-linux-nat.c	7 Jan 2011 19:36:15 -0000	1.45
+++ gdb/arm-linux-nat.c	30 Jan 2011 02:12:39 -0000
@@ -190,7 +190,8 @@
     }
 
   /* Store fpsr.  */
-  if (ARM_FPS_REGNUM == regno && regcache_valid_p (regcache, ARM_FPS_REGNUM))
+  if (ARM_FPS_REGNUM == regno
+      && regcache_register_status (regcache, ARM_FPS_REGNUM))
     regcache_raw_collect (regcache, ARM_FPS_REGNUM, fp + NWFPE_FPSR_OFFSET);
 
   /* Store the floating point register.  */
@@ -226,12 +227,12 @@
     }
 
   /* Store fpsr.  */
-  if (regcache_valid_p (regcache, ARM_FPS_REGNUM))
+  if (regcache_register_status (regcache, ARM_FPS_REGNUM))
     regcache_raw_collect (regcache, ARM_FPS_REGNUM, fp + NWFPE_FPSR_OFFSET);
 
   /* Store the floating point registers.  */
   for (regno = ARM_F0_REGNUM; regno <= ARM_F7_REGNUM; regno++)
-    if (regcache_valid_p (regcache, regno))
+    if (regcache_register_status (regcache, regno))
       collect_nwfpe_register (regcache, regno, fp);
 
   ret = ptrace (PTRACE_SETFPREGS, tid, 0, fp);
@@ -328,7 +329,7 @@
   int ret, tid;
   elf_gregset_t regs;
   
-  if (!regcache_valid_p (regcache, regno))
+  if (!regcache_register_status (regcache, regno))
     return;
 
   /* Get the thread id for the ptrace call.  */
@@ -378,11 +379,11 @@
 
   for (regno = ARM_A1_REGNUM; regno <= ARM_PC_REGNUM; regno++)
     {
-      if (regcache_valid_p (regcache, regno))
+      if (regcache_register_status (regcache, regno))
 	regcache_raw_collect (regcache, regno, (char *) &regs[regno]);
     }
 
-  if (arm_apcs_32 && regcache_valid_p (regcache, ARM_PS_REGNUM))
+  if (arm_apcs_32 && regcache_register_status (regcache, ARM_PS_REGNUM))
     regcache_raw_collect (regcache, ARM_PS_REGNUM,
 			 (char *) &regs[ARM_CPSR_GREGNUM]);
 
@@ -446,17 +447,17 @@
     }
 
   for (regno = 0; regno < 16; regno++)
-    if (regcache_valid_p (regcache, regno + ARM_WR0_REGNUM))
+    if (regcache_register_status (regcache, regno + ARM_WR0_REGNUM))
       regcache_raw_collect (regcache, regno + ARM_WR0_REGNUM,
 			    &regbuf[regno * 8]);
 
   for (regno = 0; regno < 2; regno++)
-    if (regcache_valid_p (regcache, regno + ARM_WCSSF_REGNUM))
+    if (regcache_register_status (regcache, regno + ARM_WCSSF_REGNUM))
       regcache_raw_collect (regcache, regno + ARM_WCSSF_REGNUM,
 			    &regbuf[16 * 8 + regno * 4]);
 
   for (regno = 0; regno < 4; regno++)
-    if (regcache_valid_p (regcache, regno + ARM_WCGR0_REGNUM))
+    if (regcache_register_status (regcache, regno + ARM_WCGR0_REGNUM))
       regcache_raw_collect (regcache, regno + ARM_WCGR0_REGNUM,
 			    &regbuf[16 * 8 + 2 * 4 + regno * 4]);
 
Index: gdb/i386gnu-nat.c
===================================================================
RCS file: /cvs/src/src/gdb/i386gnu-nat.c,v
retrieving revision 1.41
diff -u -r1.41 i386gnu-nat.c
--- gdb/i386gnu-nat.c	9 Jan 2011 03:08:56 -0000	1.41
+++ gdb/i386gnu-nat.c	30 Jan 2011 02:12:40 -0000
@@ -272,7 +272,7 @@
 	  proc_debug (thread, "storing all registers");
 
 	  for (i = 0; i < I386_NUM_GREGS; i++)
-	    if (regcache_valid_p (regcache, i))
+	    if (regcache_register_status (regcache, i))
 	      regcache_raw_collect (regcache, i, REG_ADDR (state, i));
 	}
       else
@@ -280,7 +280,7 @@
 	  proc_debug (thread, "storing register %s",
 		      gdbarch_register_name (gdbarch, regno));
 
-	  gdb_assert (regcache_valid_p (regcache, regno));
+	  gdb_assert (regcache_register_status (regcache, regno));
 	  regcache_raw_collect (regcache, regno, REG_ADDR (state, regno));
 	}
 

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: s/regcache_valid_p/regcache_register_status; add enum register_status
  2011-01-30 11:50 ` Yao Qi
@ 2011-01-30 19:11   ` Pedro Alves
  2011-01-30 23:31     ` Yao Qi
  0 siblings, 1 reply; 4+ messages in thread
From: Pedro Alves @ 2011-01-30 19:11 UTC (permalink / raw)
  To: Yao Qi; +Cc: gdb-patches

On Sunday 30 January 2011 03:21:03, Yao Qi wrote:
> On 01/25/2011 08:49 PM, Pedro Alves wrote:
> > 2011-01-25  Pedro Alves  <pedro@codesourcery.com>
> > 
> > 	* regcache.c (struct regcache_descr): Rename
> [....]
> > 	(regcache_valid_p): Rename to ...
> > 	(regcache_register_status): ... this.  Adjust.
> 
> All the references to regcache_valid_p should be updated as well.

Aaww, completely missed that.

> GDB native build on ARM is broken.
> cc1: warnings being treated as errors
> ../../src/gdb/arm-linux-nat.c: In function store_fpregister:
> ../../src/gdb/arm-linux-nat.c:193: error: implicit declaration of
> function regcache_valid_p
> 
> This patch is to s/regcache_valid_p/regcache_register_status in the rest
> of gdb source files, and fix ARM native build failure.
> 
> OK to apply?

Not as is.  Please use 'if (regcache_register_status (..) == REG_VALID)'
instead of 'if (regcache_register_status (..)'.  Okay with that
change.

Thanks!

-- 
Pedro Alves

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: s/regcache_valid_p/regcache_register_status; add enum register_status
  2011-01-30 19:11   ` Pedro Alves
@ 2011-01-30 23:31     ` Yao Qi
  0 siblings, 0 replies; 4+ messages in thread
From: Yao Qi @ 2011-01-30 23:31 UTC (permalink / raw)
  To: Pedro Alves; +Cc: gdb-patches

[-- Attachment #1: Type: text/plain, Size: 335 bytes --]

On 01/30/2011 07:50 PM, Pedro Alves wrote:
>> > OK to apply?
> Not as is.  Please use 'if (regcache_register_status (..) == REG_VALID)'
> instead of 'if (regcache_register_status (..)'.  Okay with that
> change.
> 

Revise patch as Pedro suggested, and rebuild native GDB on ARM.
Everything looks OK.

Applied.

-- 
Yao (齐尧)

[-- Attachment #2: regcache_valid_p.patch --]
[-- Type: text/x-patch, Size: 10599 bytes --]

gdb/

2011-01-30  Yao Qi  <yao@codesourcery.com>

	* arm-linux-nat.c: Update calls to regcache_register_status
	instead of regcache_valid_p.
	* aix-thread.c: Likewise.
	* i386gnu-nat.c: Likewise.

Index: gdb/aix-thread.c
===================================================================
RCS file: /cvs/src/src/gdb/aix-thread.c,v
retrieving revision 1.74
diff -u -r1.74 aix-thread.c
--- gdb/aix-thread.c	7 Jan 2011 19:36:15 -0000	1.74
+++ gdb/aix-thread.c	30 Jan 2011 22:39:08 -0000
@@ -1321,7 +1321,8 @@
   int regno;
 
   for (regno = 0; regno < ppc_num_gprs; regno++)
-    if (regcache_valid_p (regcache, tdep->ppc_gp0_regnum + regno))
+    if (REG_VALID == regcache_register_status (regcache,
+					       tdep->ppc_gp0_regnum + regno))
       regcache_raw_collect (regcache, tdep->ppc_gp0_regnum + regno,
 			    vals + regno);
 }
@@ -1333,7 +1334,8 @@
   int regno;
 
   for (regno = 0; regno < ppc_num_gprs; regno++)
-    if (regcache_valid_p (regcache, tdep->ppc_gp0_regnum + regno))
+    if (REG_VALID == regcache_register_status (regcache,
+					       tdep->ppc_gp0_regnum + regno))
       regcache_raw_collect (regcache, tdep->ppc_gp0_regnum + regno,
 			    vals + regno);
 }
@@ -1353,7 +1355,7 @@
   for (regno = tdep->ppc_fp0_regnum;
        regno < tdep->ppc_fp0_regnum + ppc_num_fprs;
        regno++)
-    if (regcache_valid_p (regcache, regno))
+    if (REG_VALID == regcache_register_status (regcache, regno))
       regcache_raw_collect (regcache, regno, vals + regno);
 }
 
@@ -1377,20 +1379,22 @@
   gdb_assert (sizeof (*iar) == register_size
 				 (gdbarch, gdbarch_pc_regnum (gdbarch)));
 
-  if (regcache_valid_p (regcache, gdbarch_pc_regnum (gdbarch)))
+  if (REG_VALID == regcache_register_status (regcache,
+					     gdbarch_pc_regnum (gdbarch)))
     regcache_raw_collect (regcache, gdbarch_pc_regnum (gdbarch), iar);
-  if (regcache_valid_p (regcache, tdep->ppc_ps_regnum))
+  if (REG_VALID == regcache_register_status (regcache, tdep->ppc_ps_regnum))
     regcache_raw_collect (regcache, tdep->ppc_ps_regnum, msr);
-  if (regcache_valid_p (regcache, tdep->ppc_cr_regnum))
+  if (REG_VALID == regcache_register_status (regcache, tdep->ppc_cr_regnum))
     regcache_raw_collect (regcache, tdep->ppc_cr_regnum, cr);
-  if (regcache_valid_p (regcache, tdep->ppc_lr_regnum))
+  if (REG_VALID == regcache_register_status (regcache, tdep->ppc_lr_regnum))
     regcache_raw_collect (regcache, tdep->ppc_lr_regnum, lr);
-  if (regcache_valid_p (regcache, tdep->ppc_ctr_regnum))
+  if (REG_VALID == regcache_register_status (regcache, tdep->ppc_ctr_regnum))
     regcache_raw_collect (regcache, tdep->ppc_ctr_regnum, ctr);
-  if (regcache_valid_p (regcache, tdep->ppc_xer_regnum))
+  if (REG_VALID == regcache_register_status (regcache, tdep->ppc_xer_regnum))
     regcache_raw_collect (regcache, tdep->ppc_xer_regnum, xer);
   if (tdep->ppc_fpscr_regnum >= 0
-      && regcache_valid_p (regcache, tdep->ppc_fpscr_regnum))
+      && REG_VALID == regcache_register_status (regcache,
+						tdep->ppc_fpscr_regnum))
     regcache_raw_collect (regcache, tdep->ppc_fpscr_regnum, fpscr);
 }
 
@@ -1411,20 +1415,21 @@
   gdb_assert (sizeof (*iar) == register_size (gdbarch,
 					      gdbarch_pc_regnum (gdbarch)));
 
-  if (regcache_valid_p (regcache, gdbarch_pc_regnum (gdbarch)))
+  if (REG_VALID == regcache_register_status (regcache,
+					     gdbarch_pc_regnum (gdbarch)))
     regcache_raw_collect (regcache, gdbarch_pc_regnum (gdbarch), iar);
-  if (regcache_valid_p (regcache, tdep->ppc_ps_regnum))
+  if (REG_VALID == regcache_register_status (regcache, tdep->ppc_ps_regnum))
     regcache_raw_collect (regcache, tdep->ppc_ps_regnum, msr);
-  if (regcache_valid_p (regcache, tdep->ppc_cr_regnum))
+  if (REG_VALID == regcache_register_status (regcache, tdep->ppc_cr_regnum))
     regcache_raw_collect (regcache, tdep->ppc_cr_regnum, cr);
-  if (regcache_valid_p (regcache, tdep->ppc_lr_regnum))
+  if (REG_VALID == regcache_register_status (regcache, tdep->ppc_lr_regnum))
     regcache_raw_collect (regcache, tdep->ppc_lr_regnum, lr);
-  if (regcache_valid_p (regcache, tdep->ppc_ctr_regnum))
+  if (REG_VALID == regcache_register_status (regcache, tdep->ppc_ctr_regnum))
     regcache_raw_collect (regcache, tdep->ppc_ctr_regnum, ctr);
-  if (regcache_valid_p (regcache, tdep->ppc_xer_regnum))
+  if (REG_VALID == regcache_register_status (regcache, tdep->ppc_xer_regnum))
     regcache_raw_collect (regcache, tdep->ppc_xer_regnum, xer);
   if (tdep->ppc_fpscr_regnum >= 0
-      && regcache_valid_p (regcache, tdep->ppc_fpscr_regnum))
+      && REG_VALID == regcache_register_status (regcache, tdep->ppc_fpscr_regnum))
     regcache_raw_collect (regcache, tdep->ppc_fpscr_regnum, fpscr);
 }
 
@@ -1459,7 +1464,8 @@
   /* Collect general-purpose register values from the regcache.  */
 
   for (i = 0; i < ppc_num_gprs; i++)
-    if (regcache_valid_p (regcache, tdep->ppc_gp0_regnum + i))
+    if (REG_VALID == regcache_register_status (regcache,
+					       tdep->ppc_gp0_regnum + i))
       {
 	if (arch64)
 	  {
@@ -1494,19 +1500,23 @@
 
       fill_sprs32 (regcache, &tmp_iar, &tmp_msr, &tmp_cr, &tmp_lr, &tmp_ctr,
 			     &tmp_xer, &tmp_fpscr);
-      if (regcache_valid_p (regcache, gdbarch_pc_regnum (gdbarch)))
+      if (REG_VALID == regcache_register_status (regcache,
+						 gdbarch_pc_regnum (gdbarch)))
 	ctx.iar = tmp_iar;
-      if (regcache_valid_p (regcache, tdep->ppc_ps_regnum))
+      if (REG_VALID == regcache_register_status (regcache, tdep->ppc_ps_regnum))
 	ctx.msr = tmp_msr;
-      if (regcache_valid_p (regcache, tdep->ppc_cr_regnum))
+      if (REG_VALID == regcache_register_status (regcache, tdep->ppc_cr_regnum))
 	ctx.cr  = tmp_cr;
-      if (regcache_valid_p (regcache, tdep->ppc_lr_regnum))
+      if (REG_VALID == regcache_register_status (regcache, tdep->ppc_lr_regnum))
 	ctx.lr  = tmp_lr;
-      if (regcache_valid_p (regcache, tdep->ppc_ctr_regnum))
+      if (REG_VALID == regcache_register_status (regcache,
+						 tdep->ppc_ctr_regnum))
 	ctx.ctr = tmp_ctr;
-      if (regcache_valid_p (regcache, tdep->ppc_xer_regnum))
+      if (REG_VALID == regcache_register_status (regcache,
+						 tdep->ppc_xer_regnum))
 	ctx.xer = tmp_xer;
-      if (regcache_valid_p (regcache, tdep->ppc_xer_regnum))
+      if (REG_VALID == regcache_register_status (regcache,
+						 tdep->ppc_xer_regnum))
 	ctx.fpscr = tmp_fpscr;
     }
 
@@ -1620,7 +1630,8 @@
 	  sprs32.pt_fpscr = tmp_fpscr;
 
 	  if (tdep->ppc_mq_regnum >= 0)
-	    if (regcache_valid_p (regcache, tdep->ppc_mq_regnum))
+	    if (REG_VALID == regcache_register_status (regcache,
+						       tdep->ppc_mq_regnum))
 	      regcache_raw_collect (regcache, tdep->ppc_mq_regnum,
 				    &sprs32.pt_mq);
 
Index: gdb/i386gnu-nat.c
===================================================================
RCS file: /cvs/src/src/gdb/i386gnu-nat.c,v
retrieving revision 1.41
diff -u -r1.41 i386gnu-nat.c
--- gdb/i386gnu-nat.c	9 Jan 2011 03:08:56 -0000	1.41
+++ gdb/i386gnu-nat.c	30 Jan 2011 22:39:08 -0000
@@ -272,7 +272,7 @@
 	  proc_debug (thread, "storing all registers");
 
 	  for (i = 0; i < I386_NUM_GREGS; i++)
-	    if (regcache_valid_p (regcache, i))
+	    if (REG_VALID == regcache_register_status (regcache, i))
 	      regcache_raw_collect (regcache, i, REG_ADDR (state, i));
 	}
       else
@@ -280,7 +280,7 @@
 	  proc_debug (thread, "storing register %s",
 		      gdbarch_register_name (gdbarch, regno));
 
-	  gdb_assert (regcache_valid_p (regcache, regno));
+	  gdb_assert (REG_VALID == regcache_register_status (regcache, regno));
 	  regcache_raw_collect (regcache, regno, REG_ADDR (state, regno));
 	}
 
Index: gdb/arm-linux-nat.c
===================================================================
RCS file: /cvs/src/src/gdb/arm-linux-nat.c,v
retrieving revision 1.45
diff -u -r1.45 arm-linux-nat.c
--- gdb/arm-linux-nat.c	7 Jan 2011 19:36:15 -0000	1.45
+++ gdb/arm-linux-nat.c	30 Jan 2011 22:39:09 -0000
@@ -190,7 +190,8 @@
     }
 
   /* Store fpsr.  */
-  if (ARM_FPS_REGNUM == regno && regcache_valid_p (regcache, ARM_FPS_REGNUM))
+  if (ARM_FPS_REGNUM == regno
+      && REG_VALID == regcache_register_status (regcache, ARM_FPS_REGNUM))
     regcache_raw_collect (regcache, ARM_FPS_REGNUM, fp + NWFPE_FPSR_OFFSET);
 
   /* Store the floating point register.  */
@@ -226,12 +227,12 @@
     }
 
   /* Store fpsr.  */
-  if (regcache_valid_p (regcache, ARM_FPS_REGNUM))
+  if (REG_VALID == regcache_register_status (regcache, ARM_FPS_REGNUM))
     regcache_raw_collect (regcache, ARM_FPS_REGNUM, fp + NWFPE_FPSR_OFFSET);
 
   /* Store the floating point registers.  */
   for (regno = ARM_F0_REGNUM; regno <= ARM_F7_REGNUM; regno++)
-    if (regcache_valid_p (regcache, regno))
+    if (REG_VALID == regcache_register_status (regcache, regno))
       collect_nwfpe_register (regcache, regno, fp);
 
   ret = ptrace (PTRACE_SETFPREGS, tid, 0, fp);
@@ -328,7 +329,7 @@
   int ret, tid;
   elf_gregset_t regs;
   
-  if (!regcache_valid_p (regcache, regno))
+  if (REG_VALID != regcache_register_status (regcache, regno))
     return;
 
   /* Get the thread id for the ptrace call.  */
@@ -378,11 +379,11 @@
 
   for (regno = ARM_A1_REGNUM; regno <= ARM_PC_REGNUM; regno++)
     {
-      if (regcache_valid_p (regcache, regno))
+      if (REG_VALID == regcache_register_status (regcache, regno))
 	regcache_raw_collect (regcache, regno, (char *) &regs[regno]);
     }
 
-  if (arm_apcs_32 && regcache_valid_p (regcache, ARM_PS_REGNUM))
+  if (arm_apcs_32 && REG_VALID == regcache_register_status (regcache, ARM_PS_REGNUM))
     regcache_raw_collect (regcache, ARM_PS_REGNUM,
 			 (char *) &regs[ARM_CPSR_GREGNUM]);
 
@@ -446,17 +447,20 @@
     }
 
   for (regno = 0; regno < 16; regno++)
-    if (regcache_valid_p (regcache, regno + ARM_WR0_REGNUM))
+    if (REG_VALID == regcache_register_status (regcache,
+					       regno + ARM_WR0_REGNUM))
       regcache_raw_collect (regcache, regno + ARM_WR0_REGNUM,
 			    &regbuf[regno * 8]);
 
   for (regno = 0; regno < 2; regno++)
-    if (regcache_valid_p (regcache, regno + ARM_WCSSF_REGNUM))
+    if (REG_VALID == regcache_register_status (regcache,
+					       regno + ARM_WCSSF_REGNUM))
       regcache_raw_collect (regcache, regno + ARM_WCSSF_REGNUM,
 			    &regbuf[16 * 8 + regno * 4]);
 
   for (regno = 0; regno < 4; regno++)
-    if (regcache_valid_p (regcache, regno + ARM_WCGR0_REGNUM))
+    if (REG_VALID == regcache_register_status (regcache,
+					       regno + ARM_WCGR0_REGNUM))
       regcache_raw_collect (regcache, regno + ARM_WCGR0_REGNUM,
 			    &regbuf[16 * 8 + 2 * 4 + regno * 4]);
 

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2011-01-30 23:14 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-01-25 14:18 s/regcache_valid_p/regcache_register_status; add enum register_status Pedro Alves
2011-01-30 11:50 ` Yao Qi
2011-01-30 19:11   ` Pedro Alves
2011-01-30 23:31     ` Yao Qi

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).