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] Do not require POP_FRAME method


Hello,

The recently committed changes adding frame_pop() mean that new architectures do not need to provide POP_FRAME. Consequently, there is little reason to continue requiring its implementation.

This changes POP_FRAME into a function with predicate. Future changes will deprecate it.

committed,
Andrew
2003-01-19  Andrew Cagney  <ac131313@redhat.com>

	* frame.c (frame_saved_regs_pop): Assert POP_FRAME_P.
	* gdbarch.sh (POP_FRAME): Change to function with predicate.
	Suppress actual parameters when `-'.
	* gdbarch.h, gdbarch.c: Regenerate.

Index: frame.c
===================================================================
RCS file: /cvs/src/src/gdb/frame.c,v
retrieving revision 1.60
diff -u -r1.60 frame.c
--- frame.c	19 Jan 2003 17:39:16 -0000	1.60
+++ frame.c	19 Jan 2003 22:51:38 -0000
@@ -731,6 +731,7 @@
 frame_saved_regs_pop (struct frame_info *fi, void **cache,
 		      struct regcache *regcache)
 {
+  gdb_assert (POP_FRAME_P ());
   POP_FRAME;
 }
 
Index: gdbarch.c
===================================================================
RCS file: /cvs/src/src/gdb/gdbarch.c,v
retrieving revision 1.178
diff -u -r1.178 gdbarch.c
--- gdbarch.c	13 Jan 2003 21:10:29 -0000	1.178
+++ gdbarch.c	19 Jan 2003 22:52:32 -0000
@@ -728,9 +728,7 @@
       && (gdbarch->push_dummy_frame == 0))
     fprintf_unfiltered (log, "\n\tpush_dummy_frame");
   /* Skip verify of push_return_address, has predicate */
-  if ((GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL)
-      && (gdbarch->pop_frame == 0))
-    fprintf_unfiltered (log, "\n\tpop_frame");
+  /* Skip verify of pop_frame, has predicate */
   if ((GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL)
       && (gdbarch->store_struct_return == 0))
     fprintf_unfiltered (log, "\n\tstore_struct_return");
@@ -1761,6 +1759,15 @@
                         (long) current_gdbarch->pointer_to_address
                         /*POINTER_TO_ADDRESS ()*/);
 #endif
+#ifdef POP_FRAME_P
+  fprintf_unfiltered (file,
+                      "gdbarch_dump: %s # %s\n",
+                      "POP_FRAME_P()",
+                      XSTRING (POP_FRAME_P ()));
+  fprintf_unfiltered (file,
+                      "gdbarch_dump: POP_FRAME_P() = %d\n",
+                      POP_FRAME_P ());
+#endif
 #ifdef POP_FRAME
 #if GDB_MULTI_ARCH
   /* Macro might contain `[{}]' when not multi-arch */
@@ -4176,6 +4183,13 @@
                                  gdbarch_push_return_address_ftype push_return_address)
 {
   gdbarch->push_return_address = push_return_address;
+}
+
+int
+gdbarch_pop_frame_p (struct gdbarch *gdbarch)
+{
+  gdb_assert (gdbarch != NULL);
+  return gdbarch->pop_frame != 0;
 }
 
 void
Index: gdbarch.h
===================================================================
RCS file: /cvs/src/src/gdb/gdbarch.h,v
retrieving revision 1.139
diff -u -r1.139 gdbarch.h
--- gdbarch.h	13 Jan 2003 21:10:30 -0000	1.139
+++ gdbarch.h	19 Jan 2003 22:53:16 -0000
@@ -1577,6 +1577,32 @@
 #endif
 #endif
 
+#if defined (POP_FRAME)
+/* Legacy for systems yet to multi-arch POP_FRAME */
+#if !defined (POP_FRAME_P)
+#define POP_FRAME_P() (1)
+#endif
+#endif
+
+/* Default predicate for non- multi-arch targets. */
+#if (!GDB_MULTI_ARCH) && !defined (POP_FRAME_P)
+#define POP_FRAME_P() (0)
+#endif
+
+extern int gdbarch_pop_frame_p (struct gdbarch *gdbarch);
+#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) && defined (POP_FRAME_P)
+#error "Non multi-arch definition of POP_FRAME"
+#endif
+#if (GDB_MULTI_ARCH > GDB_MULTI_ARCH_PARTIAL) || !defined (POP_FRAME_P)
+#define POP_FRAME_P() (gdbarch_pop_frame_p (current_gdbarch))
+#endif
+
+/* Default (function) for non- multi-arch platforms. */
+#if (!GDB_MULTI_ARCH) && !defined (POP_FRAME)
+#define POP_FRAME (internal_error (__FILE__, __LINE__, "POP_FRAME"), 0)
+#define POP_FRAME (gdbarch_pop_frame (current_gdbarch))
+#endif
+
 typedef void (gdbarch_pop_frame_ftype) (void);
 extern void gdbarch_pop_frame (struct gdbarch *gdbarch);
 extern void set_gdbarch_pop_frame (struct gdbarch *gdbarch, gdbarch_pop_frame_ftype *pop_frame);
Index: gdbarch.sh
===================================================================
RCS file: /cvs/src/src/gdb/gdbarch.sh,v
retrieving revision 1.190
diff -u -r1.190 gdbarch.sh
--- gdbarch.sh	13 Jan 2003 21:10:30 -0000	1.190
+++ gdbarch.sh	19 Jan 2003 22:54:05 -0000
@@ -538,7 +538,7 @@
 f:2:PUSH_ARGUMENTS:CORE_ADDR:push_arguments:int nargs, struct value **args, CORE_ADDR sp, int struct_return, CORE_ADDR struct_addr:nargs, args, sp, struct_return, struct_addr:::default_push_arguments::0
 f:2:PUSH_DUMMY_FRAME:void:push_dummy_frame:void:-:::0
 F:2:PUSH_RETURN_ADDRESS:CORE_ADDR:push_return_address:CORE_ADDR pc, CORE_ADDR sp:pc, sp:::0
-f:2:POP_FRAME:void:pop_frame:void:-:::0
+F:2:POP_FRAME:void:pop_frame:void:-:::0
 #
 f:2:STORE_STRUCT_RETURN:void:store_struct_return:CORE_ADDR addr, CORE_ADDR sp:addr, sp:::0
 #
@@ -907,7 +907,13 @@
 	    printf "#if (!GDB_MULTI_ARCH) && !defined (${macro})\n"
 	    if [ "x${fallbackdefault}" = "x0" ]
 	    then
-		printf "#define ${macro}(${actual}) (internal_error (__FILE__, __LINE__, \"${macro}\"), 0)\n"
+		if [ "x${actual}" = "x-" ]
+		then
+		    printf "#define ${macro} (internal_error (__FILE__, __LINE__, \"${macro}\"), 0)\n"
+		    printf "#define ${macro} (gdbarch_${function} (current_gdbarch))\n"
+		else
+		    printf "#define ${macro}(${actual}) (internal_error (__FILE__, __LINE__, \"${macro}\"), 0)\n"
+		fi
 	    else
 		# FIXME: Should be passing current_gdbarch through!
 		echo "#define ${macro}(${actual}) (${fallbackdefault} (${actual}))" \

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