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]

[commit] Remove frame-saved-regs code from frame.c


Hello,

This removes the frame-saved-regs code (another part of that legacy infrastructure), and any other deprecated references from frame.c.

committed,
Andrew

2004-08-01  Andrew Cagney  <cagney@gnu.org>

	* frame.h (deprecated_frame_xmalloc_with_cleanup)
	(frame_saved_regs_zalloc, frame_extra_info_zalloc)
	(get_frame_extra_info, deprecated_get_frame_saved_regs): Delete.
	* stack.c (frame_info): Delete references to
	DEPRECATED_FRAME_INIT_SAVED_REGS and
	deprecated_get_frame_saved_regs.
	* frame.c (struct frame_info): Delete saved_regs and extra_info.
	(frame_pc_unwind): Do not use DEPRECATED_FRAME_SAVED_PC.
	(frame_register): Do not use DEPRECATED_GET_SAVED_REGISTER.
	(frame_unwind_register_signed)
	(frame_unwind_register_unsigned)
	(frame_unwind_unsigned_register): Use register_size.
	(create_new_frame): Do not use DEPRECATED_INIT_EXTRA_FRAME_INFO.
	(deprecated_frame_xmalloc_with_cleanup)
	(frame_saved_regs_zalloc, frame_extra_info_zalloc)
	(get_frame_extra_info, deprecated_get_frame_saved_regs): Delete.

Index: frame.c
===================================================================
RCS file: /cvs/src/src/gdb/frame.c,v
retrieving revision 1.188
diff -p -u -r1.188 frame.c
--- frame.c	31 Jul 2004 21:41:50 -0000	1.188
+++ frame.c	1 Aug 2004 21:02:31 -0000
@@ -66,22 +66,6 @@ struct frame_info
      moment leave this as speculation.  */
   int level;
 
-  /* For each register, address of where it was saved on entry to the
-     frame, or zero if it was not saved on entry to this frame.  This
-     includes special registers such as pc and fp saved in special
-     ways in the stack frame.  The SP_REGNUM is even more special, the
-     address here is the sp for the previous frame, not the address
-     where the sp was saved.  */
-  /* Allocated by frame_saved_regs_zalloc () which is called /
-     initialized by DEPRECATED_FRAME_INIT_SAVED_REGS(). */
-  CORE_ADDR *saved_regs;	/*NUM_REGS + NUM_PSEUDO_REGS*/
-
-  /* Anything extra for this structure that may have been defined in
-     the machine dependent files. */
-  /* Allocated by frame_extra_info_zalloc () which is called /
-     initialized by DEPRECATED_INIT_EXTRA_FRAME_INFO */
-  struct frame_extra_info *extra_info;
-
   /* The frame's low-level unwinder and corresponding cache.  The
      low-level unwinder is responsible for unwinding register values
      for the previous frame.  The low-level unwind methods are
@@ -434,14 +418,6 @@ frame_pc_unwind (struct frame_info *this
              global register cache.  The assumption is dangerous.  */
 	  pc = read_pc ();
 	}
-      else if (DEPRECATED_FRAME_SAVED_PC_P ())
-	{
-	  /* FIXME: cagney/2003-03-06: Old code, but not a sentinel
-             frame.  Do like was always done.  Note that this method,
-             unlike unwind_pc(), tries to handle all the different
-             frame cases directly.  It fails.  */
-	  pc = DEPRECATED_FRAME_SAVED_PC (this_frame);
-	}
       else
 	internal_error (__FILE__, __LINE__, "No gdbarch_unwind_pc method");
       this_frame->prev_pc.value = pc;
@@ -590,33 +566,6 @@ frame_register (struct frame_info *frame
   gdb_assert (realnump != NULL);
   /* gdb_assert (bufferp != NULL); */
 
-  /* Ulgh!  Old code that, for lval_register, sets ADDRP to the offset
-     of the register in the register cache.  It should instead return
-     the REGNUM corresponding to that register.  Translate the .  */
-  if (DEPRECATED_GET_SAVED_REGISTER_P ())
-    {
-      DEPRECATED_GET_SAVED_REGISTER (bufferp, optimizedp, addrp, frame,
-				     regnum, lvalp);
-      /* Compute the REALNUM if the caller wants it.  */
-      if (*lvalp == lval_register)
-	{
-	  int regnum;
-	  for (regnum = 0; regnum < NUM_REGS + NUM_PSEUDO_REGS; regnum++)
-	    {
-	      if (*addrp == register_offset_hack (current_gdbarch, regnum))
-		{
-		  *realnump = regnum;
-		  return;
-		}
-	    }
-	  internal_error (__FILE__, __LINE__,
-			  "Failed to compute the register number corresponding"
-			  " to 0x%s", paddr_d (*addrp));
-	}
-      *realnump = -1;
-      return;
-    }
-
   /* Obtain the register value by unwinding the register from the next
      (more inner frame).  */
   gdb_assert (frame != NULL && frame->next != NULL);
@@ -647,7 +596,8 @@ frame_unwind_register_signed (struct fra
 {
   char buf[MAX_REGISTER_SIZE];
   frame_unwind_register (frame, regnum, buf);
-  return extract_signed_integer (buf, DEPRECATED_REGISTER_VIRTUAL_SIZE (regnum));
+  return extract_signed_integer (buf, register_size (get_frame_arch (frame),
+						     regnum));
 }
 
 LONGEST
@@ -661,7 +611,8 @@ frame_unwind_register_unsigned (struct f
 {
   char buf[MAX_REGISTER_SIZE];
   frame_unwind_register (frame, regnum, buf);
-  return extract_unsigned_integer (buf, DEPRECATED_REGISTER_VIRTUAL_SIZE (regnum));
+  return extract_unsigned_integer (buf, register_size (get_frame_arch (frame),
+						       regnum));
 }
 
 ULONGEST
@@ -676,7 +627,9 @@ frame_unwind_unsigned_register (struct f
 {
   char buf[MAX_REGISTER_SIZE];
   frame_unwind_register (frame, regnum, buf);
-  (*val) = extract_unsigned_integer (buf, DEPRECATED_REGISTER_VIRTUAL_SIZE (regnum));
+  (*val) = extract_unsigned_integer (buf,
+				     register_size (get_frame_arch (frame),
+						    regnum));
 }
 
 void
@@ -712,8 +665,7 @@ put_frame_register (struct frame_info *f
 /* frame_register_read ()
 
    Find and return the value of REGNUM for the specified stack frame.
-   The number of bytes copied is DEPRECATED_REGISTER_RAW_SIZE
-   (REGNUM).
+   The number of bytes copied is REGISTER_SIZE (REGNUM).
 
    Returns 0 if the register value could not be found.  */
 
@@ -803,20 +755,6 @@ frame_obstack_zalloc (unsigned long size
   return data;
 }
 
-CORE_ADDR *
-frame_saved_regs_zalloc (struct frame_info *fi)
-{
-  fi->saved_regs = (CORE_ADDR *)
-    frame_obstack_zalloc (SIZEOF_FRAME_SAVED_REGS);
-  return fi->saved_regs;
-}
-
-CORE_ADDR *
-deprecated_get_frame_saved_regs (struct frame_info *fi)
-{
-  return fi->saved_regs;
-}
-
 /* Return the innermost (currently executing) stack frame.  This is
    split into two functions.  The function unwind_to_current_frame()
    is wrapped in catch exceptions so that, even when the unwind of the
@@ -967,9 +905,6 @@ create_new_frame (CORE_ADDR addr, CORE_A
   deprecated_update_frame_base_hack (fi, addr);
   deprecated_update_frame_pc_hack (fi, pc);
 
-  if (DEPRECATED_INIT_EXTRA_FRAME_INFO_P ())
-    DEPRECATED_INIT_EXTRA_FRAME_INFO (0, fi);
-
   if (frame_debug)
     {
       fprintf_unfiltered (gdb_stdlog, "-> ");
@@ -1415,19 +1350,6 @@ get_frame_type (struct frame_info *frame
   return frame->unwind->type;
 }
 
-struct frame_extra_info *
-get_frame_extra_info (struct frame_info *fi)
-{
-  return fi->extra_info;
-}
-
-struct frame_extra_info *
-frame_extra_info_zalloc (struct frame_info *fi, long size)
-{
-  fi->extra_info = frame_obstack_zalloc (size);
-  return fi->extra_info;
-}
-
 void
 deprecated_update_frame_pc_hack (struct frame_info *frame, CORE_ADDR pc)
 {
@@ -1460,27 +1382,6 @@ deprecated_update_frame_base_hack (struc
   frame->this_id.value.stack_addr = base;
 }
 
-struct frame_info *
-deprecated_frame_xmalloc_with_cleanup (long sizeof_saved_regs,
-				       long sizeof_extra_info)
-{
-  struct frame_info *frame = XMALLOC (struct frame_info);
-  memset (frame, 0, sizeof (*frame));
-  frame->this_id.p = 1;
-  make_cleanup (xfree, frame);
-  if (sizeof_saved_regs > 0)
-    {
-      frame->saved_regs = xcalloc (1, sizeof_saved_regs);
-      make_cleanup (xfree, frame->saved_regs);
-    }
-  if (sizeof_extra_info > 0)
-    {
-      frame->extra_info = xcalloc (1, sizeof_extra_info);
-      make_cleanup (xfree, frame->extra_info);
-    }
-  return frame;
-}
-
 /* Memory access methods.  */
 
 void
Index: frame.h
===================================================================
RCS file: /cvs/src/src/gdb/frame.h,v
retrieving revision 1.137
diff -p -u -r1.137 frame.h
--- frame.h	31 Jul 2004 21:41:50 -0000	1.137
+++ frame.h	1 Aug 2004 21:02:31 -0000
@@ -657,22 +657,6 @@ extern struct frame_info *deprecated_saf
 
 extern struct frame_info *create_new_frame (CORE_ADDR base, CORE_ADDR pc);
 
-
-/* Create/access the frame's `extra info'.  The extra info is used by
-   older code to store information such as the analyzed prologue.  The
-   zalloc() should only be called by the INIT_EXTRA_INFO method.  */
-
-extern struct frame_extra_info *frame_extra_info_zalloc (struct frame_info *fi,
-							 long size);
-extern struct frame_extra_info *get_frame_extra_info (struct frame_info *fi);
-
-/* Create/access the frame's `saved_regs'.  The saved regs are used by
-   older code to store the address of each register (except for
-   SP_REGNUM where the value of the register in the previous frame is
-   stored).  */
-extern CORE_ADDR *frame_saved_regs_zalloc (struct frame_info *);
-extern CORE_ADDR *deprecated_get_frame_saved_regs (struct frame_info *);
-
 /* FIXME: cagney/2002-12-06: Has the PC in the current frame changed?
    "infrun.c", Thanks to DECR_PC_AFTER_BREAK, can change the PC after
    the initial frame create.  This puts things back in sync.
@@ -691,13 +675,4 @@ extern void deprecated_update_frame_pc_h
 extern void deprecated_update_frame_base_hack (struct frame_info *frame,
 					       CORE_ADDR base);
 
-/* FIXME: cagney/2003-01-05: Allocate a frame, along with the
-   saved_regs and extra_info.  Set up cleanups for all three.  Same as
-   for deprecated_frame_xmalloc, targets are calling this when
-   creating a scratch `struct frame_info'.  The frame overhaul makes
-   this unnecessary since all frame queries are parameterized with a
-   common cache parameter and a frame.  */
-extern struct frame_info *deprecated_frame_xmalloc_with_cleanup (long sizeof_saved_regs,
-								 long sizeof_extra_info);
-
 #endif /* !defined (FRAME_H)  */
Index: stack.c
===================================================================
RCS file: /cvs/src/src/gdb/stack.c,v
retrieving revision 1.110
diff -p -u -r1.110 stack.c
--- stack.c	10 Jul 2004 01:17:52 -0000	1.110
+++ stack.c	1 Aug 2004 21:02:32 -0000
@@ -1003,9 +1003,6 @@ frame_info (char *addr_exp, int from_tty
       }
   }
 
-  if (DEPRECATED_FRAME_INIT_SAVED_REGS_P ()
-      && deprecated_get_frame_saved_regs (fi) == NULL)
-    DEPRECATED_FRAME_INIT_SAVED_REGS (fi);
   /* Print as much information as possible on the location of all the
      registers.  */
   {

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