* defs.h (read_relative_register_raw_bytes): Delete declaration.
[deliverable/binutils-gdb.git] / gdb / frame.c
index e29729171c98c11c0e140cb8fefdccc00571d8d2..5886ab5ffb83542de605261eb786239d7e1ef3b6 100644 (file)
@@ -1,6 +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 Free Software Foundation, Inc.
+   2001, 2002 Free Software Foundation, Inc.
 
    This file is part of GDB.
 
@@ -23,7 +24,8 @@
 #include "frame.h"
 #include "target.h"
 #include "value.h"
-#include "inferior.h"  /* for inferior_pid */
+#include "inferior.h"  /* for inferior_ptid */
+#include "regcache.h"
 
 /* FIND_SAVED_REGISTER ()
 
@@ -173,52 +175,26 @@ get_saved_register (char *raw_buffer,
   GET_SAVED_REGISTER (raw_buffer, optimized, addrp, frame, regnum, lval);
 }
 
-/* READ_RELATIVE_REGISTER_RAW_BYTES_FOR_FRAME
+/* frame_register_read ()
 
-   Copy the bytes of register REGNUM, relative to the input stack frame,
-   into our memory at MYADDR, in target byte order.
+   Find and return the value of REGNUM for the specified stack frame.
    The number of bytes copied is REGISTER_RAW_SIZE (REGNUM).
 
-   Returns 1 if could not be read, 0 if could.  */
-
-/* FIXME: This function increases the confusion between FP_REGNUM
-   and the virtual/pseudo-frame pointer.  */
+   Returns 0 if the register value could not be found.  */
 
-static int
-read_relative_register_raw_bytes_for_frame (int regnum,
-                                           char *myaddr,
-                                           struct frame_info *frame)
+int
+frame_register_read (struct frame_info *frame, int regnum, void *myaddr)
 {
   int optim;
-  if (regnum == FP_REGNUM && frame)
-    {
-      /* Put it back in target format. */
-      store_address (myaddr, REGISTER_RAW_SIZE (FP_REGNUM),
-                    (LONGEST) FRAME_FP (frame));
-
-      return 0;
-    }
-
   get_saved_register (myaddr, &optim, (CORE_ADDR *) NULL, frame,
                      regnum, (enum lval_type *) NULL);
 
+  /* FIXME: cagney/2002-04-10: This test is just bogus.  It is no
+     indication of the validity of the register.  The value could
+     easily be found (on the stack) even though the corresponding
+     register isn't available.  */
   if (register_cached (regnum) < 0)
-    return 1;                  /* register value not available */
+    return 0;                  /* register value not available */
 
-  return optim;
-}
-
-/* READ_RELATIVE_REGISTER_RAW_BYTES
-
-   Copy the bytes of register REGNUM, relative to the current stack
-   frame, into our memory at MYADDR, in target byte order.  
-   The number of bytes copied is REGISTER_RAW_SIZE (REGNUM).
-
-   Returns 1 if could not be read, 0 if could.  */
-
-int
-read_relative_register_raw_bytes (int regnum, char *myaddr)
-{
-  return read_relative_register_raw_bytes_for_frame (regnum, myaddr,
-                                                    selected_frame);
+  return !optim;
 }
This page took 0.025557 seconds and 4 git commands to generate.