This is the mail archive of the gdb-patches@sources.redhat.com 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]

[patch] Deprecate register_valid[]


Hello,

This one definitly needs to go. Per the comment that goes with the variable, functional equivalents are available.

I'll commit tomorrow ish.

Andrew
2002-11-02  Andrew Cagney  <ac131313@redhat.com>

	* regcache.h (deprecated_register_valid): Rename register_valid.
	* regcache.c: Update.
	* ia64-aix-nat.c: Update.
	* i386gnu-nat.c: Update.
	* alpha-nat.c: Update.
	* sparc-nat.c: Update.
	* lynx-nat.c: Update.
	* remote-mips.c: Update.

Index: alpha-nat.c
===================================================================
RCS file: /cvs/src/src/gdb/alpha-nat.c,v
retrieving revision 1.11
diff -u -r1.11 alpha-nat.c
--- alpha-nat.c	26 Apr 2002 01:08:19 -0000	1.11
+++ alpha-nat.c	3 Nov 2002 03:50:01 -0000
@@ -135,7 +135,7 @@
       /* The FPU Registers.  */
       memcpy (&registers[REGISTER_BYTE (FP0_REGNUM)], core_reg_sect, 31 * 8);
       memset (&registers[REGISTER_BYTE (FP0_REGNUM + 31)], 0, 8);
-      memset (&register_valid[FP0_REGNUM], 1, 32);
+      memset (&deprecated_register_valid[FP0_REGNUM], 1, 32);
     }
   else
     {
@@ -144,8 +144,8 @@
               31 * 8);
       memcpy (&registers[REGISTER_BYTE (PC_REGNUM)], core_reg_sect + 31 * 8, 8);
       memset (&registers[REGISTER_BYTE (ALPHA_ZERO_REGNUM)], 0, 8);
-      memset (&register_valid[ALPHA_V0_REGNUM], 1, 32);
-      register_valid[PC_REGNUM] = 1;
+      memset (&deprecated_register_valid[ALPHA_V0_REGNUM], 1, 32);
+      deprecated_register_valid[PC_REGNUM] = 1;
     }
 }
 
Index: i386gnu-nat.c
===================================================================
RCS file: /cvs/src/src/gdb/i386gnu-nat.c,v
retrieving revision 1.11
diff -u -r1.11 i386gnu-nat.c
--- i386gnu-nat.c	15 Jun 2002 17:04:04 -0000	1.11
+++ i386gnu-nat.c	3 Nov 2002 03:50:01 -0000
@@ -184,7 +184,7 @@
     }
 
   /* FIXME: kettenis/2001-07-15: Is this right?  Should we somehow
-     take into account REGISTER_VALID like the old code did?  */
+     take into account DEPRECATED_REGISTER_VALID like the old code did?  */
   i387_fill_fsave (state.hw_state, regno);
 
   err = thread_set_state (thread->port, i386_FLOAT_STATE,
@@ -266,14 +266,14 @@
 	  proc_debug (thread, "storing all registers");
 
 	  for (i = 0; i < I386_NUM_GREGS; i++)
-	    if (register_valid[i])
+	    if (deprecated_register_valid[i])
 	      fill (state, i);
 	}
       else
 	{
 	  proc_debug (thread, "storing register %s", REGISTER_NAME (regno));
 
-	  gdb_assert (register_valid[regno]);
+	  gdb_assert (deprecated_register_valid[regno]);
 	  fill (state, regno);
 	}
 
Index: ia64-aix-nat.c
===================================================================
RCS file: /cvs/src/src/gdb/ia64-aix-nat.c,v
retrieving revision 1.2
diff -u -r1.2 ia64-aix-nat.c
--- ia64-aix-nat.c	1 Mar 2001 01:39:21 -0000	1.2
+++ ia64-aix-nat.c	3 Nov 2002 03:50:02 -0000
@@ -71,11 +71,11 @@
      by other means.  Those that aren't are already handled by the
      code above.  */
   for (regi = IA64_GR32_REGNUM; regi <= IA64_GR127_REGNUM; regi++)
-    register_valid[regi] = 1;
+    deprecated_register_valid[regi] = 1;
   for (regi = IA64_PR0_REGNUM; regi <= IA64_PR63_REGNUM; regi++)
-    register_valid[regi] = 1;
+    deprecated_register_valid[regi] = 1;
   for (regi = IA64_VFP_REGNUM; regi <= NUM_REGS; regi++)
-    register_valid[regi] = 1;
+    deprecated_register_valid[regi] = 1;
 }
 
 void
Index: lynx-nat.c
===================================================================
RCS file: /cvs/src/src/gdb/lynx-nat.c,v
retrieving revision 1.9
diff -u -r1.9 lynx-nat.c
--- lynx-nat.c	15 Jun 2001 23:50:46 -0000	1.9
+++ lynx-nat.c	3 Nov 2002 03:50:02 -0000
@@ -299,7 +299,7 @@
       memcpy (&registers[REGISTER_BYTE (G1_REGNUM)], &ec.g1,
 	      4 * REGISTER_RAW_SIZE (G1_REGNUM));
       for (i = G1_REGNUM; i <= G1_REGNUM + 3; i++)
-	register_valid[i] = 1;
+	deprecated_register_valid[i] = 1;
 
       supply_register (PS_REGNUM, (char *) &ec.psr);
       supply_register (Y_REGNUM, (char *) &ec.y);
@@ -310,7 +310,7 @@
       memcpy (&registers[REGISTER_BYTE (O0_REGNUM)], ec.o,
 	      8 * REGISTER_RAW_SIZE (O0_REGNUM));
       for (i = O0_REGNUM; i <= O0_REGNUM + 7; i++)
-	register_valid[i] = 1;
+	deprecated_register_valid[i] = 1;
     }
 
   if (whatregs & WHATREGS_STACK)
@@ -324,13 +324,13 @@
 			  &registers[REGISTER_BYTE (I0_REGNUM)],
 			  8 * REGISTER_RAW_SIZE (I0_REGNUM));
       for (i = I0_REGNUM; i <= I7_REGNUM; i++)
-	register_valid[i] = 1;
+	deprecated_register_valid[i] = 1;
 
       target_read_memory (sp + FRAME_SAVED_L0,
 			  &registers[REGISTER_BYTE (L0_REGNUM)],
 			  8 * REGISTER_RAW_SIZE (L0_REGNUM));
       for (i = L0_REGNUM; i <= L0_REGNUM + 7; i++)
-	register_valid[i] = 1;
+	deprecated_register_valid[i] = 1;
     }
 
   if (whatregs & WHATREGS_FLOAT)
@@ -348,7 +348,7 @@
       memcpy (&registers[REGISTER_BYTE (FP0_REGNUM)], fc.f.fregs,
 	      32 * REGISTER_RAW_SIZE (FP0_REGNUM));
       for (i = FP0_REGNUM; i <= FP0_REGNUM + 31; i++)
-	register_valid[i] = 1;
+	deprecated_register_valid[i] = 1;
 
       supply_register (FPS_REGNUM, (char *) &fc.fsr);
     }
@@ -411,7 +411,7 @@
 
       if (regno == -1 || regno == SP_REGNUM)
 	{
-	  if (!register_valid[L0_REGNUM + 5])
+	  if (!deprecated_register_valid[L0_REGNUM + 5])
 	    internal_error (__FILE__, __LINE__, "failed internal consistency check");
 	  target_write_memory (sp + FRAME_SAVED_I0,
 			      &registers[REGISTER_BYTE (I0_REGNUM)],
@@ -423,7 +423,7 @@
 	}
       else if (regno >= L0_REGNUM && regno <= I7_REGNUM)
 	{
-	  if (!register_valid[regno])
+	  if (!deprecated_register_valid[regno])
 	    internal_error (__FILE__, __LINE__, "failed internal consistency check");
 	  if (regno >= L0_REGNUM && regno <= L0_REGNUM + 7)
 	    regoffset = REGISTER_BYTE (regno) - REGISTER_BYTE (L0_REGNUM)
Index: regcache.c
===================================================================
RCS file: /cvs/src/src/gdb/regcache.c,v
retrieving revision 1.60
diff -u -r1.60 regcache.c
--- regcache.c	2 Nov 2002 15:13:34 -0000	1.60
+++ regcache.c	3 Nov 2002 03:50:21 -0000
@@ -418,7 +418,7 @@
 
 /* Global structure containing the current regcache.  */
 /* FIXME: cagney/2002-05-11: The two global arrays registers[] and
-   register_valid[] currently point into this structure.  */
+   deprecated_register_valid[] currently point into this structure.  */
 struct regcache *current_regcache;
 
 /* NOTE: this is a write-through cache.  There is no "dirty" bit for
@@ -430,7 +430,7 @@
 
 char *registers;
 
-/* REGISTER_VALID is 0 if the register needs to be fetched,
+/* DEPRECATED_REGISTER_VALID is 0 if the register needs to be fetched,
                      1 if it has been fetched, and
 		    -1 if the register value was not available.  
 
@@ -441,7 +441,7 @@
    system being debugged - some of the registers in such a system may
    not have been saved.  */
 
-signed char *register_valid;
+signed char *deprecated_register_valid;
 
 /* The thread/process associated with the current set of registers. */
 
@@ -460,7 +460,7 @@
 int
 register_cached (int regnum)
 {
-  return register_valid[regnum];
+  return deprecated_register_valid[regnum];
 }
 
 /* Record that REGNUM's value is cached if STATE is >0, uncached but
@@ -675,7 +675,7 @@
       gdb_assert (regcache == current_regcache);
       /* For moment, just use underlying legacy code.  Ulgh!!! This
 	 silently and very indirectly updates the regcache's regcache
-	 via the global register_valid[].  */
+	 via the global deprecated_register_valid[].  */
       legacy_read_register_gen (regnum, buf);
       return;
     }
@@ -850,7 +850,7 @@
     {
       /* For moment, just use underlying legacy code.  Ulgh!!! This
 	 silently and very indirectly updates the regcache's buffers
-	 via the globals register_valid[] and registers[].  */
+	 via the globals deprecated_register_valid[] and registers[].  */
       gdb_assert (regcache == current_regcache);
       legacy_write_register_gen (regnum, buf);
       return;
@@ -1455,7 +1455,7 @@
   current_regcache = regcache_xmalloc (current_gdbarch);
   current_regcache->passthrough_p = 1;
   registers = deprecated_grub_regcache_for_registers (current_regcache);
-  register_valid = deprecated_grub_regcache_for_register_valid (current_regcache);
+  deprecated_register_valid = deprecated_grub_regcache_for_register_valid (current_regcache);
 }
 
 static void
@@ -1737,7 +1737,7 @@
 						 xfree_regcache_descr);
   REGISTER_GDBARCH_SWAP (current_regcache);
   register_gdbarch_swap (&registers, sizeof (registers), NULL);
-  register_gdbarch_swap (&register_valid, sizeof (register_valid), NULL);
+  register_gdbarch_swap (&deprecated_register_valid, sizeof (deprecated_register_valid), NULL);
   register_gdbarch_swap (NULL, 0, build_regcache);
 
   add_com ("flushregs", class_maintenance, reg_flush_command,
Index: regcache.h
===================================================================
RCS file: /cvs/src/src/gdb/regcache.h,v
retrieving revision 1.21
diff -u -r1.21 regcache.h
--- regcache.h	2 Nov 2002 20:06:56 -0000	1.21
+++ regcache.h	3 Nov 2002 03:50:22 -0000
@@ -149,12 +149,6 @@
 
 extern char *registers;
 
-/* DEPRECATED: Character array containing the current state of each
-   register (unavailable<0, invalid=0, valid>0) for the most recently
-   referenced thread. */
-
-extern signed char *register_valid;
-
 /* Copy/duplicate the contents of a register cache.  By default, the
    operation is pass-through.  Writes to DST and reads from SRC will
    go through to the target.
@@ -187,6 +181,17 @@
 extern char *deprecated_grub_regcache_for_register_valid (struct regcache *);
 extern void deprecated_read_register_gen (int regnum, char *myaddr);
 extern void deprecated_write_register_gen (int regnum, char *myaddr);
+
+/* Character array containing the current state of each register
+   (unavailable<0, invalid=0, valid>0) for the most recently
+   referenced thread.  This global is often found in close proximity
+   to code that is directly manipulating the deprecated_registers[]
+   array.  In such cases, it should be possible to replace the lot
+   with a call to supply_register().  If you find yourself in dire
+   straits, still needing access to the cache status bit, the
+   regcache_valid_p() and set_register_cached() functions are
+   available.  */
+extern signed char *deprecated_register_valid;
 
 extern int register_cached (int regnum);
 
Index: remote-mips.c
===================================================================
RCS file: /cvs/src/src/gdb/remote-mips.c,v
retrieving revision 1.27
diff -u -r1.27 remote-mips.c
--- remote-mips.c	5 May 2002 01:15:13 -0000	1.27
+++ remote-mips.c	3 Nov 2002 03:50:26 -0000
@@ -3443,7 +3443,7 @@
       /* Work around problem where PMON monitor updates the PC after a load
          to a different value than GDB thinks it has. The following ensures
          that the write_pc() WILL update the PC value: */
-      register_valid[PC_REGNUM] = 0;
+      deprecated_register_valid[PC_REGNUM] = 0;
     }
   if (exec_bfd)
     write_pc (bfd_get_start_address (exec_bfd));
Index: sparc-nat.c
===================================================================
RCS file: /cvs/src/src/gdb/sparc-nat.c,v
retrieving revision 1.13
diff -u -r1.13 sparc-nat.c
--- sparc-nat.c	21 Apr 2002 05:34:06 -0000	1.13
+++ sparc-nat.c	3 Nov 2002 03:50:27 -0000
@@ -73,7 +73,7 @@
      to the stack pointer.  */
   if (regno < O7_REGNUM		/* including -1 */
       || regno >= Y_REGNUM
-      || (!register_valid[SP_REGNUM] && regno < I7_REGNUM))
+      || (!deprecated_register_valid[SP_REGNUM] && regno < I7_REGNUM))
     {
       if (0 != ptrace (PTRACE_GETREGS, PIDGET (inferior_ptid),
 		       (PTRACE_ARG3_TYPE) & inferior_registers, 0))
@@ -88,16 +88,16 @@
       *(int *) &registers[REGISTER_BYTE (Y_REGNUM)] = inferior_registers.r_y;
 
       for (i = G0_REGNUM; i <= O7_REGNUM; i++)
-	register_valid[i] = 1;
-      register_valid[Y_REGNUM] = 1;
-      register_valid[PS_REGNUM] = 1;
-      register_valid[PC_REGNUM] = 1;
-      register_valid[NPC_REGNUM] = 1;
+	deprecated_register_valid[i] = 1;
+      deprecated_register_valid[Y_REGNUM] = 1;
+      deprecated_register_valid[PS_REGNUM] = 1;
+      deprecated_register_valid[PC_REGNUM] = 1;
+      deprecated_register_valid[NPC_REGNUM] = 1;
       /* If we don't set these valid, read_register_bytes() rereads
          all the regs every time it is called!  FIXME.  */
-      register_valid[WIM_REGNUM] = 1;	/* Not true yet, FIXME */
-      register_valid[TBR_REGNUM] = 1;	/* Not true yet, FIXME */
-      register_valid[CPS_REGNUM] = 1;	/* Not true yet, FIXME */
+      deprecated_register_valid[WIM_REGNUM] = 1;	/* Not true yet, FIXME */
+      deprecated_register_valid[TBR_REGNUM] = 1;	/* Not true yet, FIXME */
+      deprecated_register_valid[CPS_REGNUM] = 1;	/* Not true yet, FIXME */
     }
 
   /* Floating point registers */
@@ -115,8 +115,8 @@
 	      &inferior_fp_registers.Fpu_fsr,
 	      sizeof (FPU_FSR_TYPE));
       for (i = FP0_REGNUM; i <= FP0_REGNUM + 31; i++)
-	register_valid[i] = 1;
-      register_valid[FPS_REGNUM] = 1;
+	deprecated_register_valid[i] = 1;
+      deprecated_register_valid[FPS_REGNUM] = 1;
     }
 
   /* These regs are saved on the stack by the kernel.  Only read them
@@ -127,17 +127,17 @@
       target_read_memory (sp, &registers[REGISTER_BYTE (L0_REGNUM)],
 			  16 * REGISTER_RAW_SIZE (L0_REGNUM));
       for (i = L0_REGNUM; i <= I7_REGNUM; i++)
-	register_valid[i] = 1;
+	deprecated_register_valid[i] = 1;
     }
   else if (regno >= L0_REGNUM && regno <= I7_REGNUM)
     {
       CORE_ADDR sp = *(unsigned int *) & registers[REGISTER_BYTE (SP_REGNUM)];
       i = REGISTER_BYTE (regno);
-      if (register_valid[regno])
+      if (deprecated_register_valid[regno])
 	printf_unfiltered ("register %d valid and read\n", regno);
       target_read_memory (sp + i - REGISTER_BYTE (L0_REGNUM),
 			  &registers[i], REGISTER_RAW_SIZE (regno));
-      register_valid[regno] = 1;
+      deprecated_register_valid[regno] = 1;
     }
 }
 
@@ -199,7 +199,7 @@
 
       if (regno < 0 || regno == SP_REGNUM)
 	{
-	  if (!register_valid[L0_REGNUM + 5])
+	  if (!deprecated_register_valid[L0_REGNUM + 5])
 	    internal_error (__FILE__, __LINE__, "failed internal consistency check");
 	  target_write_memory (sp,
 			       &registers[REGISTER_BYTE (L0_REGNUM)],
@@ -207,7 +207,7 @@
 	}
       else
 	{
-	  if (!register_valid[regno])
+	  if (!deprecated_register_valid[regno])
 	    internal_error (__FILE__, __LINE__, "failed internal consistency check");
 	  target_write_memory (sp + REGISTER_BYTE (regno) - REGISTER_BYTE (L0_REGNUM),
 			       &registers[REGISTER_BYTE (regno)],
@@ -218,7 +218,7 @@
 
   if (wanna_store & INT_REGS)
     {
-      if (!register_valid[G1_REGNUM])
+      if (!deprecated_register_valid[G1_REGNUM])
 	internal_error (__FILE__, __LINE__, "failed internal consistency check");
 
       memcpy (&inferior_registers.r_g1, &registers[REGISTER_BYTE (G1_REGNUM)],
@@ -240,7 +240,7 @@
 
   if (wanna_store & FP_REGS)
     {
-      if (!register_valid[FP0_REGNUM + 9])
+      if (!deprecated_register_valid[FP0_REGNUM + 9])
 	internal_error (__FILE__, __LINE__, "failed internal consistency check");
       memcpy (&inferior_fp_registers, &registers[REGISTER_BYTE (FP0_REGNUM)],
 	      sizeof inferior_fp_registers.fpu_fr);

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