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] Add a SENTINEL_FRAME type


To quote s390-tdep.c:

-      if (get_frame_type (next_frame) == NORMAL_FRAME
-         /* For some reason, sentinel frames are NORMAL_FRAMEs
-            -- but they have negative frame level.  */
-         && frame_relative_level (next_frame) >= 0)

and sentinel-frame.c:

-  /* Should the sentinel frame be given a special type?  */
-  NORMAL_FRAME,

There is no reason for having sentinel frame type set to NORMAL_FRAME, and their attributes (e.g., address in block) are nothing like normal frames.

This adds an explicit SENTINEL_FRAME type and then the fact that SENTINEL_FRAME != NORMAL_FRAME to simplify some of the more obvious sentinel frame tests.

committed,
Andrew
2004-05-01  Andrew Cagney  <cagney@redhat.com>

	* frame.c (create_sentinel_frame): Set type to SENTINEL_FRAME.
	* dummy-frame.c (dummy_frame_this_id): Use get_frame_type, instead
	of frame_relative_level.
	* sentinel-frame.c (sentinel_frame_unwinder): Set unwinder's type
	to SENTINEL_FRAME.
	* frame.h (enum frame_type): Add SENTINEL_FRAME.
	* s390-tdep.c (s390_prologue_frame_unwind_cache): Delete calls to
	frame_relative_level.

Index: dummy-frame.c
===================================================================
RCS file: /cvs/src/src/gdb/dummy-frame.c,v
retrieving revision 1.30
diff -p -u -r1.30 dummy-frame.c
--- dummy-frame.c	3 Apr 2004 21:22:10 -0000	1.30
+++ dummy-frame.c	1 May 2004 19:33:43 -0000
@@ -353,7 +353,7 @@ dummy_frame_this_id (struct frame_info *
 	 determine the dummy frame's ID.  */
       (*this_id) = gdbarch_unwind_dummy_id (current_gdbarch, next_frame);
     }
-  else if (frame_relative_level (next_frame) < 0)
+  else if (get_frame_type (next_frame) == SENTINEL_FRAME)
     {
       /* We're unwinding a sentinel frame, the PC of which is pointing
 	 at a stack dummy.  Fake up the dummy frame's ID using the
Index: frame.c
===================================================================
RCS file: /cvs/src/src/gdb/frame.c,v
retrieving revision 1.176
diff -p -u -r1.176 frame.c
--- frame.c	1 May 2004 19:02:11 -0000	1.176
+++ frame.c	1 May 2004 19:33:45 -0000
@@ -767,7 +767,7 @@ static struct frame_info *
 create_sentinel_frame (struct regcache *regcache)
 {
   struct frame_info *frame = FRAME_OBSTACK_ZALLOC (struct frame_info);
-  frame->type = NORMAL_FRAME;
+  frame->type = SENTINEL_FRAME;
   frame->level = -1;
   /* Explicitly initialize the sentinel frame's cache.  Provide it
      with the underlying regcache.  In the future additional
Index: frame.h
===================================================================
RCS file: /cvs/src/src/gdb/frame.h,v
retrieving revision 1.130
diff -p -u -r1.130 frame.h
--- frame.h	1 May 2004 19:02:11 -0000	1.130
+++ frame.h	1 May 2004 19:33:45 -0000
@@ -355,7 +355,10 @@ enum frame_type
   DUMMY_FRAME,
   /* In a signal handler, various OSs handle this in various ways.
      The main thing is that the frame may be far from normal.  */
-  SIGTRAMP_FRAME
+  SIGTRAMP_FRAME,
+  /* Sentinel or registers frame.  This frame obtains register values
+     direct from the inferior's registers.  */
+  SENTINEL_FRAME
 };
 extern enum frame_type get_frame_type (struct frame_info *);
 
Index: s390-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/s390-tdep.c,v
retrieving revision 1.130
diff -p -u -r1.130 s390-tdep.c
--- s390-tdep.c	22 Mar 2004 22:33:33 -0000	1.130
+++ s390-tdep.c	1 May 2004 19:33:46 -0000
@@ -1803,10 +1803,10 @@ s390_prologue_frame_unwind_cache (struct
       /* If the next frame is a NORMAL_FRAME, this frame *cannot* have frame 
 	 size zero.  This is only possible if the next frame is a sentinel 
 	 frame, a dummy frame, or a signal trampoline frame.  */
-      if (get_frame_type (next_frame) == NORMAL_FRAME
-	  /* For some reason, sentinel frames are NORMAL_FRAMEs
-	     -- but they have negative frame level.  */
-	  && frame_relative_level (next_frame) >= 0)
+      /* FIXME: cagney/2004-05-01: This sanity check shouldn't be
+	 needed, instead the code should simpliy rely on its
+	 analysis.  */
+      if (get_frame_type (next_frame) == NORMAL_FRAME)
 	return 0;
 
       /* If we really have a frameless function, %r14 must be valid
@@ -1850,9 +1850,9 @@ s390_prologue_frame_unwind_cache (struct
      treat it as frameless if we're currently within the function epilog 
      code at a point where the frame pointer has already been restored.  
      This can only happen in an innermost frame.  */
-  if (size > 0
-      && (get_frame_type (next_frame) != NORMAL_FRAME
-	  || frame_relative_level (next_frame) < 0))
+  /* FIXME: cagney/2004-05-01: This sanity check shouldn't be needed,
+     instead the code should simpliy rely on its analysis.  */
+  if (size > 0 && get_frame_type (next_frame) != NORMAL_FRAME)
     {
       /* See the comment in s390_in_function_epilogue_p on why this is
 	 not completely reliable ...  */
Index: sentinel-frame.c
===================================================================
RCS file: /cvs/src/src/gdb/sentinel-frame.c,v
retrieving revision 1.8
diff -p -u -r1.8 sentinel-frame.c
--- sentinel-frame.c	8 Jun 2003 18:27:14 -0000	1.8
+++ sentinel-frame.c	1 May 2004 19:33:46 -0000
@@ -83,8 +83,7 @@ sentinel_frame_this_id (struct frame_inf
 
 const struct frame_unwind sentinel_frame_unwinder =
 {
-  /* Should the sentinel frame be given a special type?  */
-  NORMAL_FRAME,
+  SENTINEL_FRAME,
   sentinel_frame_this_id,
   sentinel_frame_prev_register
 };

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