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] deprecate generic_pc_in_dummy_frame


Hello,

My cleanups have reached the point where:

DEPRECATED_USE_GENERIC_DUMMY_FRAMES =>
  !DEPRECATED_PC_IN_CALL_DUMMY_P
  && DEPRECATED_PC_IN_CALL_DUMMY == generic_pc_in_call_dummy

and:

!DEPRECATED_USE_GENERIC_DUMMY_FRAMES =>
  DEPRECATED_PC_IN_CALL_DUMMY_P
  && DEPRECATED_PC_IN_CALL_DUMMY == in_call_dummy_on_stack

(the latter being PC_IN_CALL_DUMMY's default).

The attached patch pushes things along a little:

- deprecates generic_pc_in_call_dummy
It was long ago superseeded by the dummy frame sniffer so is definitly not a prefered interface -> deprecate


- removes pc_in_dummy_frame
Like generic_pc_in_call_dummy this interface has been superseeded by the dummy frame sniffer -> make it static


- bypass DEPRECATED_PC_IN_CALL_DUMMY
since the above condition holds, it becomes possible to simplify a number of conditionals calling generic_pc_in_call_dummy directly


committed,
Andrew

2004-03-22  Andrew Cagney  <cagney@redhat.com>

	* frame.h (deprecated_pc_in_call_dummy): Rename
	generic_pc_in_call_dummy.
	* dummy-frame.h (pc_in_dummy_frame): Delete declaration.
	* dummy-frame.c (deprecated_pc_in_call_dummy): Rename
	generic_pc_in_call_dummy.
	(pc_in_dummy_frame): Make static.
	* gdbarch.sh (DEPRECATED_PC_IN_CALL_DUMMY): Update.
	* gdbarch.h, gdbarch.c: Re-generate.
	* dummy-frame.c (dummy_frame_sniffer): Simplify.
	* frame.c (frame_type_from_pc): Call deprecated_pc_in_call_dummy.
	(legacy_get_prev_frame): Ditto.
	* inferior.h: Delete reference to generic_pc_in_call_dummy in
	comment.
	
Index: dummy-frame.c
===================================================================
RCS file: /cvs/src/src/gdb/dummy-frame.c,v
retrieving revision 1.27
diff -u -r1.27 dummy-frame.c
--- dummy-frame.c	10 Oct 2003 00:28:43 -0000	1.27
+++ dummy-frame.c	22 Mar 2004 15:34:21 -0000
@@ -36,6 +36,8 @@
 				 void **this_prologue_cache,
 				 struct frame_id *this_id);
 
+static int pc_in_dummy_frame (CORE_ADDR pc);
+
 /* Dummy frame.  This saves the processor state just prior to setting
    up the inferior function call.  Older targets save the registers
    on the target stack (but that really slows down function calls).  */
@@ -137,7 +139,7 @@
    subtracted out.  */
 
 int
-generic_pc_in_call_dummy (CORE_ADDR pc, CORE_ADDR sp, CORE_ADDR fp)
+deprecated_pc_in_call_dummy (CORE_ADDR pc, CORE_ADDR sp, CORE_ADDR fp)
 {
   return pc_in_dummy_frame (pc);
 }
@@ -155,7 +157,7 @@
    !DEPRECATED_CALL_DUMMY_BREAKPOINT_OFFSET_P yet generic dummy
    targets set DEPRECATED_CALL_DUMMY_BREAKPOINT_OFFSET. True?).  */
 
-int
+static int
 pc_in_dummy_frame (CORE_ADDR pc)
 {
   struct dummy_frame *dummyframe;
@@ -411,9 +413,8 @@
 dummy_frame_sniffer (struct frame_info *next_frame)
 {
   CORE_ADDR pc = frame_pc_unwind (next_frame);
-  if (DEPRECATED_PC_IN_CALL_DUMMY_P ()
-      ? DEPRECATED_PC_IN_CALL_DUMMY (pc, 0, 0)
-      : pc_in_dummy_frame (pc))
+  gdb_assert (DEPRECATED_USE_GENERIC_DUMMY_FRAMES);
+  if (pc_in_dummy_frame (pc))
     return &dummy_frame_unwind;
   else
     return NULL;
Index: dummy-frame.h
===================================================================
RCS file: /cvs/src/src/gdb/dummy-frame.h,v
retrieving revision 1.12
diff -u -r1.12 dummy-frame.h
--- dummy-frame.h	16 Jul 2003 22:29:13 -0000	1.12
+++ dummy-frame.h	22 Mar 2004 15:34:21 -0000
@@ -50,31 +50,6 @@
 
 extern const struct frame_unwind *dummy_frame_sniffer (struct frame_info *next_frame);
 
-/* Does the PC fall in a dummy frame?
-
-   This function is used by "frame.c" when creating a new `struct
-   frame_info'.
-
-   Note that there is also very similar code in breakpoint.c (where
-   the bpstat stop reason is computed).  It is looking for a PC
-   falling on a dummy_frame breakpoint.  Perhaphs this, and that code
-   should be combined?
-
-   Architecture dependant code, that has access to a frame, should not
-   use this function.  Instead (get_frame_type() == DUMMY_FRAME)
-   should be used.
-
-   Hmm, but what about threads?  When the dummy-frame code tries to
-   relocate a dummy frame's saved registers it definitly needs to
-   differentiate between threads (otherwize it will do things like
-   clean-up the wrong threads frames).  However, when just trying to
-   identify a dummy-frame that shouldn't matter.  The wost that can
-   happen is that a thread is marked as sitting in a dummy frame when,
-   in reality, its corrupted its stack, to the point that a PC is
-   pointing into a dummy frame.  */
-
-extern int pc_in_dummy_frame (CORE_ADDR pc);
-
 /* Return the regcache that belongs to the dummy-frame identifed by PC
    and FP, or NULL if no such frame exists.  */
 /* FIXME: cagney/2002-11-08: The function only exists because of
Index: frame.c
===================================================================
RCS file: /cvs/src/src/gdb/frame.c,v
retrieving revision 1.164
diff -u -r1.164 frame.c
--- frame.c	21 Mar 2004 22:28:52 -0000	1.164
+++ frame.c	22 Mar 2004 15:34:22 -0000
@@ -1154,12 +1154,8 @@
 static enum frame_type
 frame_type_from_pc (CORE_ADDR pc)
 {
-  /* FIXME: cagney/2002-11-24: Can't yet directly call
-     pc_in_dummy_frame() as some architectures don't set
-     PC_IN_CALL_DUMMY() to generic_pc_in_call_dummy() (remember the
-     latter is implemented by simply calling pc_in_dummy_frame).  */
   if (DEPRECATED_USE_GENERIC_DUMMY_FRAMES
-      && DEPRECATED_PC_IN_CALL_DUMMY (pc, 0, 0))
+      && deprecated_pc_in_call_dummy (pc, 0, 0))
     return DUMMY_FRAME;
   else
     {
@@ -1688,9 +1684,7 @@
      initialization, as seen in create_new_frame(), should occur
      before the INIT function has been called.  */
   if (DEPRECATED_USE_GENERIC_DUMMY_FRAMES
-      && (DEPRECATED_PC_IN_CALL_DUMMY_P ()
-	  ? DEPRECATED_PC_IN_CALL_DUMMY (get_frame_pc (prev), 0, 0)
-	  : pc_in_dummy_frame (get_frame_pc (prev))))
+      && deprecated_pc_in_call_dummy (get_frame_pc (prev), 0, 0))
     prev->type = DUMMY_FRAME;
   else
     {
Index: frame.h
===================================================================
RCS file: /cvs/src/src/gdb/frame.h,v
retrieving revision 1.119
diff -u -r1.119 frame.h
--- frame.h	16 Feb 2004 21:49:21 -0000	1.119
+++ frame.h	22 Mar 2004 15:34:22 -0000
@@ -568,8 +568,8 @@
 extern void generic_pop_current_frame (void (*)(struct frame_info *));
 extern void generic_pop_dummy_frame (void);
 
-extern int generic_pc_in_call_dummy (CORE_ADDR pc,
-				     CORE_ADDR sp, CORE_ADDR fp);
+extern int deprecated_pc_in_call_dummy (CORE_ADDR pc, CORE_ADDR sp,
+					CORE_ADDR fp);
 
 /* NOTE: cagney/2002-06-26: Targets should no longer use this
    function.  Instead, the contents of a dummy frames registers can be
Index: gdbarch.c
===================================================================
RCS file: /cvs/src/src/gdb/gdbarch.c,v
retrieving revision 1.276
diff -u -r1.276 gdbarch.c
--- gdbarch.c	15 Mar 2004 20:38:08 -0000	1.276
+++ gdbarch.c	22 Mar 2004 15:34:24 -0000
@@ -347,7 +347,7 @@
   0,  /* cannot_fetch_register */
   0,  /* cannot_store_register */
   0,  /* get_longjmp_target */
-  generic_pc_in_call_dummy,  /* deprecated_pc_in_call_dummy */
+  deprecated_pc_in_call_dummy,  /* deprecated_pc_in_call_dummy */
   0,  /* deprecated_init_frame_pc_first */
   0,  /* deprecated_init_frame_pc */
   0,  /* believe_pcc_promotion */
@@ -499,7 +499,7 @@
   current_gdbarch->register_sim_regno = legacy_register_sim_regno;
   current_gdbarch->cannot_fetch_register = cannot_register_not;
   current_gdbarch->cannot_store_register = cannot_register_not;
-  current_gdbarch->deprecated_pc_in_call_dummy = generic_pc_in_call_dummy;
+  current_gdbarch->deprecated_pc_in_call_dummy = deprecated_pc_in_call_dummy;
   current_gdbarch->convert_register_p = legacy_convert_register_p;
   current_gdbarch->register_to_value = legacy_register_to_value;
   current_gdbarch->value_to_register = legacy_value_to_register;
@@ -3767,7 +3767,7 @@
 gdbarch_deprecated_pc_in_call_dummy_p (struct gdbarch *gdbarch)
 {
   gdb_assert (gdbarch != NULL);
-  return gdbarch->deprecated_pc_in_call_dummy != generic_pc_in_call_dummy;
+  return gdbarch->deprecated_pc_in_call_dummy != deprecated_pc_in_call_dummy;
 }
 
 int
@@ -3775,7 +3775,7 @@
 {
   gdb_assert (gdbarch != NULL);
   gdb_assert (gdbarch->deprecated_pc_in_call_dummy != NULL);
-  /* Do not check predicate: gdbarch->deprecated_pc_in_call_dummy != generic_pc_in_call_dummy, allow call.  */
+  /* Do not check predicate: gdbarch->deprecated_pc_in_call_dummy != deprecated_pc_in_call_dummy, allow call.  */
   if (gdbarch_debug >= 2)
     fprintf_unfiltered (gdb_stdlog, "gdbarch_deprecated_pc_in_call_dummy called\n");
   return gdbarch->deprecated_pc_in_call_dummy (pc, sp, frame_address);
Index: gdbarch.sh
===================================================================
RCS file: /cvs/src/src/gdb/gdbarch.sh,v
retrieving revision 1.302
diff -u -r1.302 gdbarch.sh
--- gdbarch.sh	15 Mar 2004 20:38:08 -0000	1.302
+++ gdbarch.sh	22 Mar 2004 15:34:25 -0000
@@ -562,7 +562,7 @@
 # is false, the corresponding function works.  This simplifies the
 # migration process - old code, calling DEPRECATED_PC_IN_CALL_DUMMY(),
 # doesn't need to be modified.
-F::DEPRECATED_PC_IN_CALL_DUMMY:int:deprecated_pc_in_call_dummy:CORE_ADDR pc, CORE_ADDR sp, CORE_ADDR frame_address:pc, sp, frame_address::generic_pc_in_call_dummy:generic_pc_in_call_dummy
+F::DEPRECATED_PC_IN_CALL_DUMMY:int:deprecated_pc_in_call_dummy:CORE_ADDR pc, CORE_ADDR sp, CORE_ADDR frame_address:pc, sp, frame_address::deprecated_pc_in_call_dummy:deprecated_pc_in_call_dummy
 F:2:DEPRECATED_INIT_FRAME_PC_FIRST:CORE_ADDR:deprecated_init_frame_pc_first:int fromleaf, struct frame_info *prev:fromleaf, prev
 F:2:DEPRECATED_INIT_FRAME_PC:CORE_ADDR:deprecated_init_frame_pc:int fromleaf, struct frame_info *prev:fromleaf, prev
 #
Index: inferior.h
===================================================================
RCS file: /cvs/src/src/gdb/inferior.h,v
retrieving revision 1.61
diff -u -r1.61 inferior.h
--- inferior.h	22 Mar 2004 01:43:32 -0000	1.61
+++ inferior.h	22 Mar 2004 15:34:25 -0000
@@ -454,10 +454,10 @@
 
 /* Are we in a call dummy? */
 
-/* NOTE: cagney/2002-11-24: Targets need to both switch to generic
-   dummy frames, and use generic_pc_in_call_dummy().  The generic
-   version should be able to handle all cases since that code works by
-   saving the address of the dummy's breakpoint (where ever it is).  */
+/* NOTE: cagney/2002-11-24 cagney/2004-03-22: Targets need to both
+   switch to generic dummy frames.  The generic version should be able
+   to handle all cases since that code works by saving the address of
+   the dummy's breakpoint (where ever it is).  */
 
 extern int deprecated_pc_in_call_dummy_on_stack (CORE_ADDR pc,
 						 CORE_ADDR sp,

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