2004-09-03 Andrew Cagney <cagney@gnu.org>
[deliverable/binutils-gdb.git] / gdb / regcache.c
index dee37c31070126c4dce2faeb1a2df60e87155e9d..12721c330e35ac72234eb4df38b75e825674e721 100644 (file)
@@ -549,7 +549,7 @@ deprecated_read_register_bytes (int in_start, char *in_buf, int in_len)
       int byte;
 
       reg_start = DEPRECATED_REGISTER_BYTE (regnum);
-      reg_len = DEPRECATED_REGISTER_RAW_SIZE (regnum);
+      reg_len = register_size (current_gdbarch, regnum);
       reg_end = reg_start + reg_len;
 
       if (reg_end <= in_start || in_end <= reg_start)
@@ -614,6 +614,15 @@ regcache_raw_read (struct regcache *regcache, int regnum, void *buf)
        }
       if (!register_cached (regnum))
        target_fetch_registers (regnum);
+#if 0
+      /* FIXME: cagney/2004-08-07: At present a number of targets
+        forget (or didn't know that they needed) set this leading to
+        panics.  Also is the problem that target's need to indicate
+        that a register is in one of the possible states: valid,
+        undefined, unknown.  The last of which isn't yet
+        possible.  */
+      gdb_assert (register_cached (regnum));
+#endif
     }
   /* Copy the value directly into the register cache.  */
   memcpy (buf, register_buffer (regcache, regnum),
@@ -819,7 +828,7 @@ deprecated_write_register_bytes (int myregstart, char *myaddr, int inlen)
       int regstart, regend;
 
       regstart = DEPRECATED_REGISTER_BYTE (regnum);
-      regend = regstart + DEPRECATED_REGISTER_RAW_SIZE (regnum);
+      regend = regstart + register_size (current_gdbarch, regnum);
 
       /* Is this register completely outside the range the user is writing?  */
       if (myregend <= regstart || regend <= myregstart)
@@ -943,14 +952,22 @@ register_offset_hack (struct gdbarch *gdbarch, int regnum)
   return descr->register_offset[regnum];
 }
 
+/* Hack to keep code using register_bytes working.  */
+
+int
+deprecated_register_bytes (void)
+{
+  return current_regcache->descr->sizeof_raw_registers;
+}
+
 /* Return the contents of register REGNUM as an unsigned integer.  */
 
 ULONGEST
 read_register (int regnum)
 {
-  char *buf = alloca (DEPRECATED_REGISTER_RAW_SIZE (regnum));
+  char *buf = alloca (register_size (current_gdbarch, regnum));
   deprecated_read_register_gen (regnum, buf);
-  return (extract_unsigned_integer (buf, DEPRECATED_REGISTER_RAW_SIZE (regnum)));
+  return (extract_unsigned_integer (buf, register_size (current_gdbarch, regnum)));
 }
 
 ULONGEST
@@ -981,7 +998,7 @@ write_register (int regnum, LONGEST val)
 {
   void *buf;
   int size;
-  size = DEPRECATED_REGISTER_RAW_SIZE (regnum);
+  size = register_size (current_gdbarch, regnum);
   buf = alloca (size);
   store_signed_integer (buf, size, (LONGEST) val);
   deprecated_write_register_gen (regnum, buf);
@@ -1057,19 +1074,18 @@ regcache_raw_collect (const struct regcache *regcache, int regnum, void *buf)
 }
 
 
-/* read_pc, write_pc, read_sp, deprecated_read_fp, etc.  Special
-   handling for registers PC, SP, and FP.  */
+/* read_pc, write_pc, read_sp, etc.  Special handling for registers
+   PC, SP, and FP.  */
 
-/* NOTE: cagney/2001-02-18: The functions read_pc_pid(), read_pc(),
-   read_sp(), and deprecated_read_fp(), will eventually be replaced by
-   per-frame methods.  Instead of relying on the global INFERIOR_PTID,
-   they will use the contextual information provided by the FRAME.
-   These functions do not belong in the register cache.  */
+/* NOTE: cagney/2001-02-18: The functions read_pc_pid(), read_pc() and
+   read_sp(), will eventually be replaced by per-frame methods.
+   Instead of relying on the global INFERIOR_PTID, they will use the
+   contextual information provided by the FRAME.  These functions do
+   not belong in the register cache.  */
 
 /* NOTE: cagney/2003-06-07: The functions generic_target_write_pc(),
-   write_pc_pid(), write_pc(), and deprecated_read_fp(), all need to
-   be replaced by something that does not rely on global state.  But
-   what?  */
+   write_pc_pid() and write_pc(), all need to be replaced by something
+   that does not rely on global state.  But what?  */
 
 CORE_ADDR
 read_pc_pid (ptid_t ptid)
@@ -1148,24 +1164,6 @@ read_sp (void)
   internal_error (__FILE__, __LINE__, "read_sp: Unable to find SP");
 }
 
-void
-deprecated_write_sp (CORE_ADDR val)
-{
-  gdb_assert (SP_REGNUM >= 0);
-  write_register (SP_REGNUM, val);
-}
-
-CORE_ADDR
-deprecated_read_fp (void)
-{
-  if (DEPRECATED_TARGET_READ_FP_P ())
-    return DEPRECATED_TARGET_READ_FP ();
-  else if (DEPRECATED_FP_REGNUM >= 0)
-    return read_register (DEPRECATED_FP_REGNUM);
-  else
-    internal_error (__FILE__, __LINE__, "deprecated_read_fp");
-}
-
 static void
 reg_flush_command (char *command, int from_tty)
 {
This page took 0.024473 seconds and 4 git commands to generate.