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]

[patch/rfc[ Deprecate INIT_FRAME_PC_FIRST


Hello,

Per:
http://sources.redhat.com/ml/gdb-patches/2002-12/msg00151.html

The attached patch changes INIT_FRAME_PC_FIRST into a function with predicate and then deprecates it.

Since the default for this method was to do nothing, it is very straight forward. So once a second round of testing has completed, I'll commit it.

Andrew


? new-gdbarch.log
? new-gdbarch.h
? new-gdbarch.c
? diffs
Index: ChangeLog
===================================================================
RCS file: /cvs/src/src/gdb/ChangeLog,v
retrieving revision 1.3550
diff -u -r1.3550 ChangeLog
--- ChangeLog	6 Dec 2002 07:35:54 -0000	1.3550
+++ ChangeLog	6 Dec 2002 15:52:20 -0000
@@ -1,5 +1,19 @@
 2002-12-05  Andrew Cagney  <ac131313@redhat.com>
 
+	* gdbarch.sh (DEPRECATED_INIT_FRAME_PC_FIRST): Rename
+	INIT_FRAME_PC_FIRST.  Change to a function with predicate.  Do not
+	provide a default value.
+	* gdbarch.h, gdbarch.c: Regenerate.
+	* frame.c (get_prev_frame): Update.  Check
+	DEPRECATED_INIT_FRAME_PC_FIRST_P.
+	* s390-tdep.c (s390_gdbarch_init): Update.
+	* mips-tdep.c (mips_gdbarch_init): Update.
+	* config/sparc/tm-sparc.h (DEPRECATED_INIT_FRAME_PC_FIRST): Update.
+	* config/rs6000/tm-rs6000.h (DEPRECATED_INIT_FRAME_PC_FIRST): Update.
+	* alpha-tdep.c (alpha_gdbarch_init): Update.
+	
+2002-12-05  Andrew Cagney  <ac131313@redhat.com>
+
 	* gdbthread.h: Include "frame.h".
 	(struct thread_info): Replace step_frame_address with
 	step_frame_id.
Index: alpha-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/alpha-tdep.c,v
retrieving revision 1.45
diff -u -r1.45 alpha-tdep.c
--- alpha-tdep.c	1 Dec 2002 19:07:14 -0000	1.45
+++ alpha-tdep.c	6 Dec 2002 15:52:20 -0000
@@ -73,7 +73,6 @@
 static gdbarch_push_dummy_frame_ftype alpha_push_dummy_frame;
 static gdbarch_pop_frame_ftype alpha_pop_frame;
 static gdbarch_fix_call_dummy_ftype alpha_fix_call_dummy;
-static gdbarch_init_frame_pc_first_ftype alpha_init_frame_pc_first;
 static gdbarch_init_extra_frame_info_ftype alpha_init_extra_frame_info;
 
 static gdbarch_get_longjmp_target_ftype alpha_get_longjmp_target;
@@ -1896,7 +1895,7 @@
   set_gdbarch_push_dummy_frame (gdbarch, alpha_push_dummy_frame);
   set_gdbarch_fix_call_dummy (gdbarch, alpha_fix_call_dummy);
   set_gdbarch_init_frame_pc (gdbarch, init_frame_pc_noop);
-  set_gdbarch_init_frame_pc_first (gdbarch, alpha_init_frame_pc_first);
+  set_gdbarch_deprecated_init_frame_pc_first (gdbarch, alpha_init_frame_pc_first);
 
   set_gdbarch_inner_than (gdbarch, core_addr_lessthan);
   set_gdbarch_skip_trampoline_code (gdbarch, find_solib_trampoline_target);
Index: frame.c
===================================================================
RCS file: /cvs/src/src/gdb/frame.c,v
retrieving revision 1.37
diff -u -r1.37 frame.c
--- frame.c	4 Dec 2002 00:05:53 -0000	1.37
+++ frame.c	6 Dec 2002 15:52:21 -0000
@@ -986,8 +986,9 @@
      to require INIT_EXTRA_FRAME_INFO before they can do
      INIT_FRAME_PC.  Phoo.
 
-     We shouldn't need INIT_FRAME_PC_FIRST to add more complication to
-     an already overcomplicated part of GDB.  gnu@cygnus.com, 15Sep92.
+     We shouldn't need DEPRECATED_INIT_FRAME_PC_FIRST to add more
+     complication to an already overcomplicated part of GDB.
+     gnu@cygnus.com, 15Sep92.
 
      Assuming that some machines need INIT_FRAME_PC after
      INIT_EXTRA_FRAME_INFO, one possible scheme:
@@ -1040,7 +1041,8 @@
      FRAME_SAVED_PC() is being superseed by frame_pc_unwind() and that
      function does have somewhere to cache that PC value.  */
 
-  INIT_FRAME_PC_FIRST (fromleaf, prev);
+  if (DEPRECATED_INIT_FRAME_PC_FIRST_P ())
+    DEPRECATED_INIT_FRAME_PC_FIRST (fromleaf, prev);
 
   if (INIT_EXTRA_FRAME_INFO_P ())
     INIT_EXTRA_FRAME_INFO (fromleaf, prev);
Index: gdbarch.c
===================================================================
RCS file: /cvs/src/src/gdb/gdbarch.c,v
retrieving revision 1.166
diff -u -r1.166 gdbarch.c
--- gdbarch.c	5 Dec 2002 15:19:45 -0000	1.166
+++ gdbarch.c	6 Dec 2002 15:52:21 -0000
@@ -195,7 +195,7 @@
   int call_dummy_stack_adjust_p;
   int call_dummy_stack_adjust;
   gdbarch_fix_call_dummy_ftype *fix_call_dummy;
-  gdbarch_init_frame_pc_first_ftype *init_frame_pc_first;
+  gdbarch_deprecated_init_frame_pc_first_ftype *deprecated_init_frame_pc_first;
   gdbarch_init_frame_pc_ftype *init_frame_pc;
   int believe_pcc_promotion;
   int believe_pcc_promotion_type;
@@ -533,7 +533,6 @@
   current_gdbarch->call_dummy_words = legacy_call_dummy_words;
   current_gdbarch->sizeof_call_dummy_words = legacy_sizeof_call_dummy_words;
   current_gdbarch->call_dummy_stack_adjust_p = -1;
-  current_gdbarch->init_frame_pc_first = init_frame_pc_noop;
   current_gdbarch->init_frame_pc = init_frame_pc_default;
   current_gdbarch->coerce_float_to_double = default_coerce_float_to_double;
   current_gdbarch->register_convertible = generic_register_convertible_not;
@@ -712,7 +711,7 @@
   if ((GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL)
       && (gdbarch->fix_call_dummy == 0))
     fprintf_unfiltered (log, "\n\tfix_call_dummy");
-  /* Skip verify of init_frame_pc_first, invalid_p == 0 */
+  /* Skip verify of deprecated_init_frame_pc_first, has predicate */
   /* Skip verify of init_frame_pc, invalid_p == 0 */
   /* Skip verify of coerce_float_to_double, invalid_p == 0 */
   /* Skip verify of get_saved_register, has predicate */
@@ -1193,6 +1192,29 @@
                         (long) current_gdbarch->deprecated_extract_struct_value_address
                         /*DEPRECATED_EXTRACT_STRUCT_VALUE_ADDRESS ()*/);
 #endif
+#ifdef DEPRECATED_INIT_FRAME_PC_FIRST_P
+  fprintf_unfiltered (file,
+                      "gdbarch_dump: %s # %s\n",
+                      "DEPRECATED_INIT_FRAME_PC_FIRST_P()",
+                      XSTRING (DEPRECATED_INIT_FRAME_PC_FIRST_P ()));
+  fprintf_unfiltered (file,
+                      "gdbarch_dump: DEPRECATED_INIT_FRAME_PC_FIRST_P() = %d\n",
+                      DEPRECATED_INIT_FRAME_PC_FIRST_P ());
+#endif
+#ifdef DEPRECATED_INIT_FRAME_PC_FIRST
+#if GDB_MULTI_ARCH
+  /* Macro might contain `[{}]' when not multi-arch */
+  fprintf_unfiltered (file,
+                      "gdbarch_dump: %s # %s\n",
+                      "DEPRECATED_INIT_FRAME_PC_FIRST(fromleaf, prev)",
+                      XSTRING (DEPRECATED_INIT_FRAME_PC_FIRST (fromleaf, prev)));
+#endif
+  if (GDB_MULTI_ARCH)
+    fprintf_unfiltered (file,
+                        "gdbarch_dump: DEPRECATED_INIT_FRAME_PC_FIRST = 0x%08lx\n",
+                        (long) current_gdbarch->deprecated_init_frame_pc_first
+                        /*DEPRECATED_INIT_FRAME_PC_FIRST ()*/);
+#endif
 #ifdef DEPRECATED_PC_IN_CALL_DUMMY_P
   fprintf_unfiltered (file,
                       "gdbarch_dump: %s # %s\n",
@@ -1572,20 +1594,6 @@
                         (long) current_gdbarch->init_frame_pc
                         /*INIT_FRAME_PC ()*/);
 #endif
-#ifdef INIT_FRAME_PC_FIRST
-#if GDB_MULTI_ARCH
-  /* Macro might contain `[{}]' when not multi-arch */
-  fprintf_unfiltered (file,
-                      "gdbarch_dump: %s # %s\n",
-                      "INIT_FRAME_PC_FIRST(fromleaf, prev)",
-                      XSTRING (INIT_FRAME_PC_FIRST (fromleaf, prev)));
-#endif
-  if (GDB_MULTI_ARCH)
-    fprintf_unfiltered (file,
-                        "gdbarch_dump: INIT_FRAME_PC_FIRST = 0x%08lx\n",
-                        (long) current_gdbarch->init_frame_pc_first
-                        /*INIT_FRAME_PC_FIRST ()*/);
-#endif
 #ifdef INNER_THAN
   fprintf_unfiltered (file,
                       "gdbarch_dump: %s # %s\n",
@@ -3776,23 +3784,30 @@
   gdbarch->fix_call_dummy = fix_call_dummy;
 }
 
+int
+gdbarch_deprecated_init_frame_pc_first_p (struct gdbarch *gdbarch)
+{
+  gdb_assert (gdbarch != NULL);
+  return gdbarch->deprecated_init_frame_pc_first != 0;
+}
+
 void
-gdbarch_init_frame_pc_first (struct gdbarch *gdbarch, int fromleaf, struct frame_info *prev)
+gdbarch_deprecated_init_frame_pc_first (struct gdbarch *gdbarch, int fromleaf, struct frame_info *prev)
 {
   gdb_assert (gdbarch != NULL);
-  if (gdbarch->init_frame_pc_first == 0)
+  if (gdbarch->deprecated_init_frame_pc_first == 0)
     internal_error (__FILE__, __LINE__,
-                    "gdbarch: gdbarch_init_frame_pc_first invalid");
+                    "gdbarch: gdbarch_deprecated_init_frame_pc_first invalid");
   if (gdbarch_debug >= 2)
-    fprintf_unfiltered (gdb_stdlog, "gdbarch_init_frame_pc_first called\n");
-  gdbarch->init_frame_pc_first (fromleaf, prev);
+    fprintf_unfiltered (gdb_stdlog, "gdbarch_deprecated_init_frame_pc_first called\n");
+  gdbarch->deprecated_init_frame_pc_first (fromleaf, prev);
 }
 
 void
-set_gdbarch_init_frame_pc_first (struct gdbarch *gdbarch,
-                                 gdbarch_init_frame_pc_first_ftype init_frame_pc_first)
+set_gdbarch_deprecated_init_frame_pc_first (struct gdbarch *gdbarch,
+                                            gdbarch_deprecated_init_frame_pc_first_ftype deprecated_init_frame_pc_first)
 {
-  gdbarch->init_frame_pc_first = init_frame_pc_first;
+  gdbarch->deprecated_init_frame_pc_first = deprecated_init_frame_pc_first;
 }
 
 void
Index: gdbarch.h
===================================================================
RCS file: /cvs/src/src/gdb/gdbarch.h,v
retrieving revision 1.130
diff -u -r1.130 gdbarch.h
--- gdbarch.h	1 Dec 2002 19:07:14 -0000	1.130
+++ gdbarch.h	6 Dec 2002 15:52:22 -0000
@@ -1178,20 +1178,40 @@
 #endif
 #endif
 
+#if defined (DEPRECATED_INIT_FRAME_PC_FIRST)
+/* Legacy for systems yet to multi-arch DEPRECATED_INIT_FRAME_PC_FIRST */
+#if !defined (DEPRECATED_INIT_FRAME_PC_FIRST_P)
+#define DEPRECATED_INIT_FRAME_PC_FIRST_P() (1)
+#endif
+#endif
+
+/* Default predicate for non- multi-arch targets. */
+#if (!GDB_MULTI_ARCH) && !defined (DEPRECATED_INIT_FRAME_PC_FIRST_P)
+#define DEPRECATED_INIT_FRAME_PC_FIRST_P() (0)
+#endif
+
+extern int gdbarch_deprecated_init_frame_pc_first_p (struct gdbarch *gdbarch);
+#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (DEPRECATED_INIT_FRAME_PC_FIRST_P)
+#error "Non multi-arch definition of DEPRECATED_INIT_FRAME_PC_FIRST"
+#endif
+#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) || !defined (DEPRECATED_INIT_FRAME_PC_FIRST_P)
+#define DEPRECATED_INIT_FRAME_PC_FIRST_P() (gdbarch_deprecated_init_frame_pc_first_p (current_gdbarch))
+#endif
+
 /* Default (function) for non- multi-arch platforms. */
-#if (!GDB_MULTI_ARCH) && !defined (INIT_FRAME_PC_FIRST)
-#define INIT_FRAME_PC_FIRST(fromleaf, prev) (init_frame_pc_noop (fromleaf, prev))
+#if (!GDB_MULTI_ARCH) && !defined (DEPRECATED_INIT_FRAME_PC_FIRST)
+#define DEPRECATED_INIT_FRAME_PC_FIRST(fromleaf, prev) (internal_error (__FILE__, __LINE__, "DEPRECATED_INIT_FRAME_PC_FIRST"), 0)
 #endif
 
-typedef void (gdbarch_init_frame_pc_first_ftype) (int fromleaf, struct frame_info *prev);
-extern void gdbarch_init_frame_pc_first (struct gdbarch *gdbarch, int fromleaf, struct frame_info *prev);
-extern void set_gdbarch_init_frame_pc_first (struct gdbarch *gdbarch, gdbarch_init_frame_pc_first_ftype *init_frame_pc_first);
-#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (INIT_FRAME_PC_FIRST)
-#error "Non multi-arch definition of INIT_FRAME_PC_FIRST"
+typedef void (gdbarch_deprecated_init_frame_pc_first_ftype) (int fromleaf, struct frame_info *prev);
+extern void gdbarch_deprecated_init_frame_pc_first (struct gdbarch *gdbarch, int fromleaf, struct frame_info *prev);
+extern void set_gdbarch_deprecated_init_frame_pc_first (struct gdbarch *gdbarch, gdbarch_deprecated_init_frame_pc_first_ftype *deprecated_init_frame_pc_first);
+#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (DEPRECATED_INIT_FRAME_PC_FIRST)
+#error "Non multi-arch definition of DEPRECATED_INIT_FRAME_PC_FIRST"
 #endif
 #if GDB_MULTI_ARCH
-#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) || !defined (INIT_FRAME_PC_FIRST)
-#define INIT_FRAME_PC_FIRST(fromleaf, prev) (gdbarch_init_frame_pc_first (current_gdbarch, fromleaf, prev))
+#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) || !defined (DEPRECATED_INIT_FRAME_PC_FIRST)
+#define DEPRECATED_INIT_FRAME_PC_FIRST(fromleaf, prev) (gdbarch_deprecated_init_frame_pc_first (current_gdbarch, fromleaf, prev))
 #endif
 #endif
 
Index: gdbarch.sh
===================================================================
RCS file: /cvs/src/src/gdb/gdbarch.sh,v
retrieving revision 1.178
diff -u -r1.178 gdbarch.sh
--- gdbarch.sh	5 Dec 2002 15:19:45 -0000	1.178
+++ gdbarch.sh	6 Dec 2002 15:52:22 -0000
@@ -513,7 +513,7 @@
 v:1:CALL_DUMMY_STACK_ADJUST_P:int:call_dummy_stack_adjust_p::::0:-1:::0x%08lx
 v:2:CALL_DUMMY_STACK_ADJUST:int:call_dummy_stack_adjust::::0:::gdbarch->call_dummy_stack_adjust_p && gdbarch->call_dummy_stack_adjust == 0:0x%08lx::CALL_DUMMY_STACK_ADJUST_P
 f:2:FIX_CALL_DUMMY:void:fix_call_dummy:char *dummy, CORE_ADDR pc, CORE_ADDR fun, int nargs, struct value **args, struct type *type, int gcc_p:dummy, pc, fun, nargs, args, type, gcc_p:::0
-f:2:INIT_FRAME_PC_FIRST:void:init_frame_pc_first:int fromleaf, struct frame_info *prev:fromleaf, prev:::init_frame_pc_noop::0
+F::DEPRECATED_INIT_FRAME_PC_FIRST:void:deprecated_init_frame_pc_first:int fromleaf, struct frame_info *prev:fromleaf, prev
 f:2:INIT_FRAME_PC:void:init_frame_pc:int fromleaf, struct frame_info *prev:fromleaf, prev:::init_frame_pc_default::0
 #
 v:2:BELIEVE_PCC_PROMOTION:int:believe_pcc_promotion:::::::
Index: mips-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/mips-tdep.c,v
retrieving revision 1.143
diff -u -r1.143 mips-tdep.c
--- mips-tdep.c	5 Dec 2002 05:17:39 -0000	1.143
+++ mips-tdep.c	6 Dec 2002 15:52:23 -0000
@@ -5964,8 +5964,8 @@
   set_gdbarch_addr_bits_remove (gdbarch, mips_addr_bits_remove);
 
   /* There's a mess in stack frame creation.  See comments in
-     blockframe.c near reference to INIT_FRAME_PC_FIRST.  */
-  set_gdbarch_init_frame_pc_first (gdbarch, mips_init_frame_pc_first);
+     blockframe.c near reference to DEPRECATED_INIT_FRAME_PC_FIRST.  */
+  set_gdbarch_deprecated_init_frame_pc_first (gdbarch, mips_init_frame_pc_first);
   set_gdbarch_init_frame_pc (gdbarch, init_frame_pc_noop);
 
   /* Map debug register numbers onto internal register numbers.  */
Index: s390-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/s390-tdep.c,v
retrieving revision 1.59
diff -u -r1.59 s390-tdep.c
--- s390-tdep.c	1 Dec 2002 19:07:15 -0000	1.59
+++ s390-tdep.c	6 Dec 2002 15:52:23 -0000
@@ -1790,7 +1790,7 @@
   set_gdbarch_breakpoint_from_pc (gdbarch, s390_breakpoint_from_pc);
   set_gdbarch_skip_prologue (gdbarch, s390_skip_prologue);
   set_gdbarch_init_extra_frame_info (gdbarch, s390_init_extra_frame_info);
-  set_gdbarch_init_frame_pc_first (gdbarch, s390_init_frame_pc_first);
+  set_gdbarch_deprecated_init_frame_pc_first (gdbarch, s390_init_frame_pc_first);
   set_gdbarch_read_fp (gdbarch, s390_read_fp);
   /* This function that tells us whether the function invocation represented
      by FI does not have a frame on the stack associated with it.  If it
Index: config/rs6000/tm-rs6000.h
===================================================================
RCS file: /cvs/src/src/gdb/config/rs6000/tm-rs6000.h,v
retrieving revision 1.18
diff -u -r1.18 tm-rs6000.h
--- config/rs6000/tm-rs6000.h	11 Oct 2002 14:02:39 -0000	1.18
+++ config/rs6000/tm-rs6000.h	6 Dec 2002 15:52:24 -0000
@@ -78,7 +78,7 @@
 
 /* Define other aspects of the stack frame.  */
 
-#define INIT_FRAME_PC_FIRST(fromleaf, prev) \
+#define DEPRECATED_INIT_FRAME_PC_FIRST(fromleaf, prev) \
   prev->pc = (fromleaf ? SAVED_PC_AFTER_CALL (prev->next) : \
 	      prev->next ? FRAME_SAVED_PC (prev->next) : read_pc ());
 #define INIT_FRAME_PC(fromleaf, prev)	/* nothing */
Index: config/sparc/tm-sparc.h
===================================================================
RCS file: /cvs/src/src/gdb/config/sparc/tm-sparc.h,v
retrieving revision 1.23
diff -u -r1.23 tm-sparc.h
--- config/sparc/tm-sparc.h	1 Dec 2002 19:07:16 -0000	1.23
+++ config/sparc/tm-sparc.h	6 Dec 2002 15:52:24 -0000
@@ -520,7 +520,7 @@
 /* INIT_EXTRA_FRAME_INFO needs the PC to detect flat frames.  */
 
 #define	INIT_FRAME_PC(FROMLEAF, PREV)	/* nothing */
-#define INIT_FRAME_PC_FIRST(FROMLEAF, PREV) \
+#define DEPRECATED_INIT_FRAME_PC_FIRST(FROMLEAF, PREV) \
   (PREV)->pc = ((FROMLEAF) ? SAVED_PC_AFTER_CALL ((PREV)->next) : \
 	      (PREV)->next ? FRAME_SAVED_PC ((PREV)->next) : read_pc ());
 

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