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]

[obish] s/->pc/get_frame_pc/ et.al.


Hello,

This patch makes mechanical changes such as:

	s/fi->pc/get_frame_pc (fi)/
	s/fi->frame/get_frame_base (fi)/
	s/..id.base = ; ..id.pc =;/..id = frame_id_build (...)/
	s/fi->frame = ../deprecated_update_frame_base_hack (fi, ...)/

The intent is to clear the deck ready for:

- elimination of frame->pc and frame->frame
- revamp of frame_id for frame_id_eq()

committed,
Andrew
2003-04-04  Andrew Cagney  <cagney at redhat dot com>

	* x86-64-tdep.c (x86_64_unwind_dummy_id): Use frame_id_build.
	* dummy-frame.c (dummy_frame_this_id): Use frame_id_build.
	* d10v-tdep.c (d10v_frame_this_id): Use get_frame_pc and
	get_frame_base.
	(d10v_unwind_dummy_id): Use frame_id_build.
	* frame.c (find_frame_sal): Use get_frame_pc.
	(create_new_frame): Use deprecated_update_frame_pc_hack and
	deprecated_update_frame_base_hack.
	(create_sentinel_frame): Add comment about ->pc going away.
	(get_prev_frame): Add comment about ->pc going away.
	(legacy_get_prev_frame): Use get_frame_base, get_frame_pc,
	frame_id_build, deprecated_update_frame_pc_hack and
	deprecated_update_frame_base_hack.
	(select_frame): Use get_frame_pc.
	(legacy_saved_regs_this_id): Use frame_id_build.

Index: d10v-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/d10v-tdep.c,v
retrieving revision 1.101
diff -u -r1.101 d10v-tdep.c
--- d10v-tdep.c	1 Apr 2003 19:55:03 -0000	1.101
+++ d10v-tdep.c	4 Apr 2003 21:01:53 -0000
@@ -1474,8 +1474,8 @@
      compare the frame's PC value.  */
   if (frame_relative_level (next_frame) >= 0
       && get_frame_type (next_frame) != DUMMY_FRAME
-      && get_frame_id (next_frame).pc == pc
-      && get_frame_id (next_frame).base == base)
+      && get_frame_pc (next_frame) == pc
+      && get_frame_base (next_frame) == base)
     return;
 
   (*this_id) = frame_id_build (base, pc);
@@ -1587,11 +1587,8 @@
 d10v_unwind_dummy_id (struct gdbarch *gdbarch, struct frame_info *next_frame)
 {
   ULONGEST base;
-  struct frame_id id;
-  id.pc = frame_pc_unwind (next_frame);
   frame_unwind_unsigned_register (next_frame, SP_REGNUM, &base);
-  id.base = d10v_make_daddr (base);
-  return id;
+  return frame_id_build (d10v_make_daddr (base), frame_pc_unwind (next_frame));
 }
 
 static gdbarch_init_ftype d10v_gdbarch_init;
Index: dummy-frame.c
===================================================================
RCS file: /cvs/src/src/gdb/dummy-frame.c,v
retrieving revision 1.15
diff -u -r1.15 dummy-frame.c
--- dummy-frame.c	31 Mar 2003 23:52:37 -0000	1.15
+++ dummy-frame.c	4 Apr 2003 21:01:53 -0000
@@ -374,8 +374,7 @@
 	 same sequence as is found a traditional unwinder.  Once all
 	 architectures supply the unwind_dummy_id method, this code
 	 can go away.  */
-      (*this_id).base = read_fp ();
-      (*this_id).pc = read_pc ();
+      (*this_id) = frame_id_build (read_fp (), read_pc ());
     }
   else if (legacy_frame_p (current_gdbarch)
 	   && get_prev_frame (next_frame))
@@ -384,8 +383,8 @@
          get_prev_frame code has already created THIS frame and linked
          it in to the frame chain (a pretty bold assumption), extract
          the ID from THIS base / pc.  */
-      (*this_id).base = get_frame_base (get_prev_frame (next_frame));
-      (*this_id).pc = get_frame_pc (get_prev_frame (next_frame));
+      (*this_id) = frame_id_build (get_frame_base (get_prev_frame (next_frame)),
+				   get_frame_pc (get_prev_frame (next_frame)));
     }
   else
     {
Index: frame.c
===================================================================
RCS file: /cvs/src/src/gdb/frame.c,v
retrieving revision 1.94
diff -u -r1.94 frame.c
--- frame.c	4 Apr 2003 14:46:00 -0000	1.94
+++ frame.c	4 Apr 2003 21:01:54 -0000
@@ -70,7 +70,7 @@
 	 hence, still poke at the "struct frame_info" object directly.  */
       fi->frame = fi->id.base;
     }
-  return frame_id_build (fi->frame, fi->pc);
+  return frame_id_build (fi->frame, get_frame_pc (fi));
 }
 
 const struct frame_id null_frame_id; /* All zeros.  */
@@ -511,6 +511,8 @@
   /* FIXME: cagney/2003-01-10: Problem here.  Unwinding a sentinel
      frame's PC may require information such as the frame's thread's
      stop reason.  Is it possible to get to that?  */
+  /* FIXME: cagney/2003-04-04: Once ->pc is eliminated, this
+     assignment can go away.  */
   frame->pc = frame_pc_unwind (frame);
   /* Make the sentinel frame's ID valid, but invalid.  That way all
      comparisons with it should fail.  */
@@ -645,7 +647,7 @@
      source language of this frame, and switch to it if desired.  */
   if (fi)
     {
-      s = find_pc_symtab (fi->pc);
+      s = find_pc_symtab (get_frame_pc (fi));
       if (s
 	  && s->language != current_language->la_language
 	  && s->language != language_unknown
@@ -760,8 +762,7 @@
 	 unwinding a sentinel frame, the PC of which is pointing at a
 	 stack dummy.  Fake up the dummy frame's ID using the same
 	 sequence as is found a traditional unwinder.  */
-      (*id).base = read_fp ();
-      (*id).pc = read_pc ();
+      (*id) = frame_id_build (read_fp (), read_pc ());
       return;
     }
 
@@ -814,8 +815,7 @@
   /* FIXME: cagney/2002-06-08: This should probably return the frame's
      function and not the PC (a.k.a. resume address).  */
   pc = frame_pc_unwind (next_frame);
-  id->pc = pc;
-  id->base = base;
+  (*id) = frame_id_build (base, pc);
 }
 	
 const struct frame_unwind legacy_saved_regs_unwinder = {
@@ -959,16 +959,16 @@
 
   fi = frame_obstack_zalloc (sizeof (struct frame_info));
 
-  fi->frame = addr;
-  fi->pc = pc;
   fi->next = create_sentinel_frame (current_regcache);
   fi->type = frame_type_from_pc (pc);
+  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);
 
   /* Select/initialize an unwind function.  */
-  fi->unwind = frame_unwind_find_by_pc (current_gdbarch, fi->pc);
+  fi->unwind = frame_unwind_find_by_pc (current_gdbarch, get_frame_pc (fi));
 
   return fi;
 }
@@ -1073,8 +1073,8 @@
 	 because (well ignoring the PPC) a dummy frame can be located
 	 using THIS_FRAME's frame ID.  */
       
-      prev->pc = frame_pc_unwind (this_frame);
-      if (prev->pc == 0)
+      deprecated_update_frame_pc_hack (prev, frame_pc_unwind (this_frame));
+      if (get_frame_pc (prev) == 0)
 	{
 	  /* The allocated PREV_FRAME will be reclaimed when the frame
 	     obstack is next purged.  */
@@ -1083,10 +1083,11 @@
 				"Outermost frame - unwound PC zero\n");
 	  return NULL;
 	}
-      prev->type = frame_type_from_pc (prev->pc);
+      prev->type = frame_type_from_pc (get_frame_pc (prev));
 
       /* Set the unwind functions based on that identified PC.  */
-      prev->unwind = frame_unwind_find_by_pc (current_gdbarch, prev->pc);
+      prev->unwind = frame_unwind_find_by_pc (current_gdbarch,
+					      get_frame_pc (prev));
 
       /* Find the prev's frame's ID.  */
       if (prev->type == DUMMY_FRAME
@@ -1117,8 +1118,7 @@
 	     using the same sequence as is found a traditional
 	     unwinder.  Once all architectures supply the
 	     unwind_dummy_id method, this code can go away.  */
-	  prev->id.base = read_fp ();
-	  prev->id.pc = read_pc ();
+	  prev->id = frame_id_build (read_fp (), read_pc ());
 	}
 
       /* Check that the unwound ID is valid.  */
@@ -1143,6 +1143,8 @@
 	 store the frame ID in PREV_FRAME.  Unfortunatly, some
 	 architectures (HP/UX) still reply on EXTRA_FRAME_INFO and,
 	 hence, still poke at the "struct frame_info" object directly.  */
+      /* FIXME: cagney/2003-04-04: Once ->frame is eliminated, this
+         assignment can go.  */
       prev->frame = prev->id.base;
 
       /* Link it in.  */
@@ -1223,7 +1225,7 @@
   /* Link in the already allocated prev frame.  */
   this_frame->prev = prev;
   prev->next = this_frame;
-  prev->frame = address;
+  deprecated_update_frame_base_hack (prev, address);
 
   /* This change should not be needed, FIXME!  We should determine
      whether any targets *need* DEPRECATED_INIT_FRAME_PC to happen
@@ -1299,7 +1301,9 @@
      that PC value.  */
 
   if (DEPRECATED_INIT_FRAME_PC_FIRST_P ())
-    prev->pc = (DEPRECATED_INIT_FRAME_PC_FIRST (fromleaf, prev));
+    deprecated_update_frame_pc_hack (prev,
+				     DEPRECATED_INIT_FRAME_PC_FIRST (fromleaf,
+								     prev));
 
   if (DEPRECATED_INIT_EXTRA_FRAME_INFO_P ())
     DEPRECATED_INIT_EXTRA_FRAME_INFO (fromleaf, prev);
@@ -1308,15 +1312,17 @@
      FRAME_SAVED_PC may use that queue to figure out its value (see
      tm-sparc.h).  We want the pc saved in the inferior frame. */
   if (DEPRECATED_INIT_FRAME_PC_P ())
-    prev->pc = DEPRECATED_INIT_FRAME_PC (fromleaf, prev);
+    deprecated_update_frame_pc_hack (prev,
+				     DEPRECATED_INIT_FRAME_PC (fromleaf,
+							       prev));
 
   /* If ->frame and ->pc are unchanged, we are in the process of
      getting ourselves into an infinite backtrace.  Some architectures
      check this in DEPRECATED_FRAME_CHAIN or thereabouts, but it seems
      like there is no reason this can't be an architecture-independent
      check.  */
-  if (prev->frame == this_frame->frame
-      && prev->pc == this_frame->pc)
+  if (get_frame_base (prev) == get_frame_base (this_frame)
+      && get_frame_pc (prev) == get_frame_pc (this_frame))
     {
       this_frame->prev = NULL;
       obstack_free (&frame_cache_obstack, prev);
@@ -1327,7 +1333,8 @@
      (and probably other architectural information).  The PC lets you
      check things like the debug info at that point (dwarf2cfi?) and
      use that to decide how the frame should be unwound.  */
-  prev->unwind = frame_unwind_find_by_pc (current_gdbarch, prev->pc);
+  prev->unwind = frame_unwind_find_by_pc (current_gdbarch,
+					  get_frame_pc (prev));
 
   /* NOTE: cagney/2002-11-18: The code segments, found in
      create_new_frame and get_prev_frame(), that initializes the
@@ -1339,8 +1346,8 @@
      before the INIT function has been called.  */
   if (DEPRECATED_USE_GENERIC_DUMMY_FRAMES
       && (DEPRECATED_PC_IN_CALL_DUMMY_P ()
-	  ? DEPRECATED_PC_IN_CALL_DUMMY (prev->pc, 0, 0)
-	  : pc_in_dummy_frame (prev->pc)))
+	  ? DEPRECATED_PC_IN_CALL_DUMMY (get_frame_pc (prev), 0, 0)
+	  : pc_in_dummy_frame (get_frame_pc (prev))))
     prev->type = DUMMY_FRAME;
   else
     {
@@ -1351,8 +1358,8 @@
 	 Unforunatly, its the INIT code that sets the PC (Hmm, catch
 	 22).  */
       char *name;
-      find_pc_partial_function (prev->pc, &name, NULL, NULL);
-      if (PC_IN_SIGTRAMP (prev->pc, name))
+      find_pc_partial_function (get_frame_pc (prev), &name, NULL, NULL);
+      if (PC_IN_SIGTRAMP (get_frame_pc (prev), name))
 	prev->type = SIGTRAMP_FRAME;
       /* FIXME: cagney/2002-11-11: Leave prev->type alone.  Some
          architectures are forcing the frame's type in INIT so we
@@ -1555,6 +1562,8 @@
      because (well ignoring the PPC) a dummy frame can be located
      using THIS_FRAME's frame ID.  */
 
+  /* FIXME: cagney/2003-04-04: Once ->pc is eliminated, this
+     assignment can go away.  */
   prev_frame->pc = frame_pc_unwind (this_frame);
   if (prev_frame->pc == 0)
     {
@@ -1618,7 +1627,7 @@
 void
 find_frame_sal (struct frame_info *frame, struct symtab_and_line *sal)
 {
-  (*sal) = find_pc_line (frame->pc, pc_notcurrent (frame));
+  (*sal) = find_pc_line (get_frame_pc (frame), pc_notcurrent (frame));
 }
 
 /* Per "frame.h", return the ``address'' of the frame.  Code should
Index: x86-64-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/x86-64-tdep.c,v
retrieving revision 1.60
diff -u -r1.60 x86-64-tdep.c
--- x86-64-tdep.c	30 Mar 2003 14:32:09 -0000	1.60
+++ x86-64-tdep.c	4 Apr 2003 21:01:55 -0000
@@ -936,12 +936,9 @@
 static struct frame_id
 x86_64_unwind_dummy_id (struct gdbarch *gdbarch, struct frame_info *frame)
 {
-  struct frame_id id;
-  
-  id.pc = frame_pc_unwind (frame);
-  frame_unwind_unsigned_register (frame, SP_REGNUM, &id.base);
-
-  return id;
+  CORE_ADDR base;
+  frame_unwind_unsigned_register (frame, SP_REGNUM, &base);
+  return frame_id_build (base, frame_pc_unwind (frame));
 }
 
 void

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