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]

[offbyone branch] Fix off by one error in frame code


Hello,

I've created a new branch (cagney_offbyone-20030303-branch) so that I can test several changes related to an off-by-one error in the frame code.

The attached is the `fix'.
(takes deep breath)

The wrong id unwinder was being passed the wrong [prologue] cache - things were one frame out. When determining the frame ID for the prev frame, that prev's frame's ID analyzer needs to be called with that prev's frame's cache.

The code (old and new) was working around this in weird and mysterious ways. It, for instance, explains the mess of prev/next in the sparc unwind code.

Next is to figure out what it broke ....

Andrew
2003-03-03  Andrew Cagney  <cagney at redhat dot com>

	* frame.c (frame_id_unwind): Delete function.
	(get_prev_frame): Use prev's unwinder to unwind the frame ID.
	* frame.h (frame_id_unwind): Delete declaration.

Index: frame.c
===================================================================
RCS file: /cvs/src/src/gdb/frame.c,v
retrieving revision 1.71
diff -u -r1.71 frame.c
--- frame.c	2 Mar 2003 04:02:22 -0000	1.71
+++ frame.c	3 Mar 2003 21:18:14 -0000
@@ -145,17 +145,6 @@
   return frame->pc_unwind_cache;
 }
 
-struct frame_id
-frame_id_unwind (struct frame_info *frame)
-{
-  if (!frame->id_unwind_cache_p)
-    {
-      frame->unwind->id (frame, &frame->unwind_cache, &frame->id_unwind_cache);
-      frame->id_unwind_cache_p = 1;
-    }
-  return frame->id_unwind_cache;
-}
-
 void
 frame_pop (struct frame_info *frame)
 {
@@ -1347,7 +1336,8 @@
   {
     /* FIXME: cagney/2002-12-18: Instead of this hack, should just
        save the frame ID directly.  */
-    struct frame_id id = frame_id_unwind (next_frame);
+    struct frame_id id = prev_frame->unwind->id (next_frame,
+						 &prev_frame->unwind_cache);
     /* Check that the unwound ID is valid.  As of 2003-02-24 the
        x86-64 was returning an invalid frame ID when trying to do an
        unwind a sentinel frame that belonged to a frame dummy.  */
Index: frame.h
===================================================================
RCS file: /cvs/src/src/gdb/frame.h,v
retrieving revision 1.70
diff -u -r1.70 frame.h
--- frame.h	2 Mar 2003 04:02:22 -0000	1.70
+++ frame.h	3 Mar 2003 21:18:14 -0000
@@ -310,10 +310,6 @@
 
 extern CORE_ADDR frame_pc_unwind (struct frame_info *frame);
 
-/* Unwind the frame ID.  Return an ID that uniquely identifies the
-   caller's frame.  */
-extern struct frame_id frame_id_unwind (struct frame_info *frame);
-
 /* Discard the specified frame.  Restoring the registers to the state
    of the caller.  */
 extern void frame_pop (struct frame_info *frame);

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