Honour PRIVATE keyword
[deliverable/binutils-gdb.git] / gdb / regcache.c
index 42280ff5b8986c550f4a37b5f5b869ed81790a85..154fc5e0c71c88b3a2ba016b051d29ba963f8762 100644 (file)
@@ -1,7 +1,7 @@
 /* Cache and manage the values of registers for GDB, the GNU debugger.
 
    Copyright 1986, 1987, 1989, 1991, 1994, 1995, 1996, 1998, 2000,
-   2001, 2002 Free Software Foundation, Inc.
+   2001, 2002, 2004 Free Software Foundation, Inc.
 
    This file is part of GDB.
 
@@ -107,14 +107,14 @@ init_legacy_regcache_descr (struct gdbarch *gdbarch,
   for (i = 0; i < descr->nr_cooked_registers; i++)
     {
       /* FIXME: cagney/2001-12-04: This code shouldn't need to use
-         DEPRECATED_REGISTER_BYTE().  Unfortunatly, legacy code likes
+         DEPRECATED_REGISTER_BYTE().  Unfortunately, legacy code likes
          to lay the buffer out so that certain registers just happen
          to overlap.  Ulgh!  New targets use gdbarch's register
          read/write and entirely avoid this uglyness.  */
       descr->register_offset[i] = DEPRECATED_REGISTER_BYTE (i);
-      descr->sizeof_register[i] = REGISTER_RAW_SIZE (i);
-      gdb_assert (MAX_REGISTER_SIZE >= REGISTER_RAW_SIZE (i));
-      gdb_assert (MAX_REGISTER_SIZE >= REGISTER_VIRTUAL_SIZE (i));
+      descr->sizeof_register[i] = DEPRECATED_REGISTER_RAW_SIZE (i);
+      gdb_assert (MAX_REGISTER_SIZE >= DEPRECATED_REGISTER_RAW_SIZE (i));
+      gdb_assert (MAX_REGISTER_SIZE >= DEPRECATED_REGISTER_VIRTUAL_SIZE (i));
     }
 
   /* Compute the real size of the register buffer.  Start out by
@@ -138,7 +138,7 @@ init_legacy_regcache_descr (struct gdbarch *gdbarch,
        descr->sizeof_cooked_registers = regend;
     }
   /* FIXME: cagney/2002-05-11: Shouldn't be including pseudo-registers
-     in the register cache.  Unfortunatly some architectures still
+     in the register cache.  Unfortunately some architectures still
      rely on this and the pseudo_register_write() method.  */
   descr->sizeof_raw_registers = descr->sizeof_cooked_registers;
 }
@@ -187,7 +187,7 @@ init_regcache_descr (struct gdbarch *gdbarch)
   /* If an old style architecture, fill in the remainder of the
      register cache descriptor using the register macros.  */
   /* NOTE: cagney/2003-06-29: If either of DEPRECATED_REGISTER_BYTE or
-     REGISTER_RAW_SIZE are still present, things are most likely
+     DEPRECATED_REGISTER_RAW_SIZE are still present, things are most likely
      totally screwed.  Ex: an architecture with raw register sizes
      smaller than what DEPRECATED_REGISTER_BYTE indicates; non
      monotonic DEPRECATED_REGISTER_BYTE values.  For GDB 6 check for
@@ -196,7 +196,8 @@ init_regcache_descr (struct gdbarch *gdbarch)
   if ((!gdbarch_pseudo_register_read_p (gdbarch)
        && !gdbarch_pseudo_register_write_p (gdbarch)
        && !gdbarch_register_type_p (gdbarch))
-      || DEPRECATED_REGISTER_BYTE_P () || REGISTER_RAW_SIZE_P ())
+      || DEPRECATED_REGISTER_BYTE_P ()
+      || DEPRECATED_REGISTER_RAW_SIZE_P ())
     {
       descr->legacy_p = 1;
       init_legacy_regcache_descr (gdbarch, descr);
@@ -228,7 +229,7 @@ init_regcache_descr (struct gdbarch *gdbarch)
   }
 
   /* FIXME: cagney/2002-05-22: Should only need to allocate space for
-     the raw registers.  Unfortunatly some code still accesses the
+     the raw registers.  Unfortunately some code still accesses the
      register array directly using the global registers[].  Until that
      code has been purged, play safe and over allocating the register
      buffer.  Ulgh!  */
@@ -242,8 +243,8 @@ init_regcache_descr (struct gdbarch *gdbarch)
       if (DEPRECATED_REGISTER_BYTE_P ())
        gdb_assert (descr->register_offset[i] == DEPRECATED_REGISTER_BYTE (i));
 #if 0
-      gdb_assert (descr->sizeof_register[i] == REGISTER_RAW_SIZE (i));
-      gdb_assert (descr->sizeof_register[i] == REGISTER_VIRTUAL_SIZE (i));
+      gdb_assert (descr->sizeof_register[i] == DEPRECATED_REGISTER_RAW_SIZE (i));
+      gdb_assert (descr->sizeof_register[i] == DEPRECATED_REGISTER_VIRTUAL_SIZE (i));
 #endif
     }
   /* gdb_assert (descr->sizeof_raw_registers == DEPRECATED_REGISTER_BYTES (i));  */
@@ -278,9 +279,9 @@ register_size (struct gdbarch *gdbarch, int regnum)
   int size;
   gdb_assert (regnum >= 0 && regnum < (NUM_REGS + NUM_PSEUDO_REGS));
   size = descr->sizeof_register[regnum];
-  /* NB: The deprecated REGISTER_RAW_SIZE, if not provided, defaults
+  /* NB: The deprecated DEPRECATED_REGISTER_RAW_SIZE, if not provided, defaults
      to the size of the register's type.  */
-  gdb_assert (size == REGISTER_RAW_SIZE (regnum)); /* OK */
+  gdb_assert (size == DEPRECATED_REGISTER_RAW_SIZE (regnum)); /* OK */
   /* NB: Don't check the register's virtual size.  It, in say the case
      of the MIPS, may not match the raw size!  */
   return size;
@@ -458,7 +459,7 @@ regcache_cpy_no_passthrough (struct regcache *dst, struct regcache *src)
   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 completly invalid.  */
+     silly - it would mean that valid_p would be completely invalid.  */
   gdb_assert (dst != current_regcache);
   memcpy (dst->registers, src->registers, dst->descr->sizeof_raw_registers);
   memcpy (dst->register_valid_p, src->register_valid_p,
@@ -661,7 +662,7 @@ deprecated_read_register_bytes (int in_start, char *in_buf, int in_len)
       int byte;
 
       reg_start = DEPRECATED_REGISTER_BYTE (regnum);
-      reg_len = REGISTER_RAW_SIZE (regnum);
+      reg_len = DEPRECATED_REGISTER_RAW_SIZE (regnum);
       reg_end = reg_start + reg_len;
 
       if (reg_end <= in_start || in_end <= reg_start)
@@ -726,7 +727,7 @@ legacy_read_register_gen (int regnum, char *myaddr)
     target_fetch_registers (regnum);
 
   memcpy (myaddr, register_buffer (current_regcache, regnum),
-         REGISTER_RAW_SIZE (regnum));
+         DEPRECATED_REGISTER_RAW_SIZE (regnum));
 }
 
 void
@@ -913,7 +914,7 @@ legacy_write_register_gen (int regnum, const void *myaddr)
       registers_ptid = inferior_ptid;
     }
 
-  size = REGISTER_RAW_SIZE (regnum);
+  size = DEPRECATED_REGISTER_RAW_SIZE (regnum);
 
   if (real_register (regnum))
     {
@@ -1023,7 +1024,7 @@ deprecated_write_register_bytes (int myregstart, char *myaddr, int inlen)
       int regstart, regend;
 
       regstart = DEPRECATED_REGISTER_BYTE (regnum);
-      regend = regstart + REGISTER_RAW_SIZE (regnum);
+      regend = regstart + DEPRECATED_REGISTER_RAW_SIZE (regnum);
 
       /* Is this register completely outside the range the user is writing?  */
       if (myregend <= regstart || regend <= myregstart)
@@ -1152,9 +1153,9 @@ register_offset_hack (struct gdbarch *gdbarch, int regnum)
 ULONGEST
 read_register (int regnum)
 {
-  char *buf = alloca (REGISTER_RAW_SIZE (regnum));
+  char *buf = alloca (DEPRECATED_REGISTER_RAW_SIZE (regnum));
   deprecated_read_register_gen (regnum, buf);
-  return (extract_unsigned_integer (buf, REGISTER_RAW_SIZE (regnum)));
+  return (extract_unsigned_integer (buf, DEPRECATED_REGISTER_RAW_SIZE (regnum)));
 }
 
 ULONGEST
@@ -1185,7 +1186,7 @@ write_register (int regnum, LONGEST val)
 {
   void *buf;
   int size;
-  size = REGISTER_RAW_SIZE (regnum);
+  size = DEPRECATED_REGISTER_RAW_SIZE (regnum);
   buf = alloca (size);
   store_signed_integer (buf, size, (LONGEST) val);
   deprecated_write_register_gen (regnum, buf);
@@ -1331,8 +1332,7 @@ read_pc_pid (ptid_t ptid)
   else if (PC_REGNUM >= 0)
     {
       CORE_ADDR raw_val = read_register_pid (PC_REGNUM, ptid);
-      CORE_ADDR pc_val = ADDR_BITS_REMOVE (raw_val);
-      return pc_val;
+      pc_val = ADDR_BITS_REMOVE (raw_val);
     }
   else
     internal_error (__FILE__, __LINE__, "read_pc_pid: Unable to find PC");
@@ -1350,15 +1350,11 @@ read_pc (void)
 void
 generic_target_write_pc (CORE_ADDR pc, ptid_t ptid)
 {
-#ifdef PC_REGNUM
   if (PC_REGNUM >= 0)
     write_register_pid (PC_REGNUM, pc, ptid);
-  if (DEPRECATED_NPC_REGNUM >= 0)
-    write_register_pid (DEPRECATED_NPC_REGNUM, pc + 4, ptid);
-#else
-  internal_error (__FILE__, __LINE__,
-                 "generic_target_write_pc");
-#endif
+  else
+    internal_error (__FILE__, __LINE__,
+                   "generic_target_write_pc");
 }
 
 void
@@ -1551,9 +1547,9 @@ regcache_dump (struct regcache *regcache, struct ui_file *file,
          fprintf_unfiltered (file, " %5ld",
                              regcache->descr->sizeof_register[regnum]);
          if ((regcache->descr->sizeof_register[regnum]
-              != REGISTER_RAW_SIZE (regnum))
+              != DEPRECATED_REGISTER_RAW_SIZE (regnum))
              || (regcache->descr->sizeof_register[regnum]
-                 != REGISTER_VIRTUAL_SIZE (regnum))
+                 != DEPRECATED_REGISTER_VIRTUAL_SIZE (regnum))
              || (regcache->descr->sizeof_register[regnum]
                  != TYPE_LENGTH (register_type (regcache->descr->gdbarch,
                                                 regnum)))
@@ -1609,7 +1605,7 @@ regcache_dump (struct regcache *regcache, struct ui_file *file,
              regcache_raw_read (regcache, regnum, buf);
              fprintf_unfiltered (file, "0x");
              dump_endian_bytes (file, TARGET_BYTE_ORDER, buf,
-                                REGISTER_RAW_SIZE (regnum));
+                                DEPRECATED_REGISTER_RAW_SIZE (regnum));
            }
        }
 
@@ -1623,7 +1619,7 @@ regcache_dump (struct regcache *regcache, struct ui_file *file,
              regcache_cooked_read (regcache, regnum, buf);
              fprintf_unfiltered (file, "0x");
              dump_endian_bytes (file, TARGET_BYTE_ORDER, buf,
-                                REGISTER_VIRTUAL_SIZE (regnum));
+                                DEPRECATED_REGISTER_VIRTUAL_SIZE (regnum));
            }
        }
 
@@ -1710,10 +1706,10 @@ void
 _initialize_regcache (void)
 {
   regcache_descr_handle = register_gdbarch_data (init_regcache_descr);
-  REGISTER_GDBARCH_SWAP (current_regcache);
-  register_gdbarch_swap (&deprecated_registers, sizeof (deprecated_registers), NULL);
-  register_gdbarch_swap (&deprecated_register_valid, sizeof (deprecated_register_valid), NULL);
-  register_gdbarch_swap (NULL, 0, build_regcache);
+  DEPRECATED_REGISTER_GDBARCH_SWAP (current_regcache);
+  DEPRECATED_REGISTER_GDBARCH_SWAP (deprecated_registers);
+  DEPRECATED_REGISTER_GDBARCH_SWAP (deprecated_register_valid);
+  deprecated_register_gdbarch_swap (NULL, 0, build_regcache);
 
   add_com ("flushregs", class_maintenance, reg_flush_command,
           "Force gdb to flush its register cache (maintainer command)");
This page took 0.027303 seconds and 4 git commands to generate.