Index: testsuite/ChangeLog
[deliverable/binutils-gdb.git] / gdb / frame.c
index f35d8c174876994722008d3e80feb6c2bb9e7ee8..b881a74d3453c1d38fe2cae10ef798334eb96b86 100644 (file)
@@ -139,7 +139,7 @@ static int frame_debug;
 
 static int backtrace_below_main;
 
-static void
+void
 fprint_frame_id (struct ui_file *file, struct frame_id id)
 {
   fprintf_unfiltered (file, "{stack=0x%s,code=0x%s}",
@@ -226,6 +226,19 @@ get_frame_id (struct frame_info *fi)
       if (frame_debug)
        fprintf_unfiltered (gdb_stdlog, "{ get_frame_id (fi=%d) ",
                            fi->level);
+      /* Find the unwinder.  */
+      if (fi->unwind == NULL)
+       {
+         fi->unwind = frame_unwind_find_by_pc (current_gdbarch,
+                                               get_frame_pc (fi));
+         /* FIXME: cagney/2003-04-02: Rather than storing the frame's
+            type in the frame, the unwinder's type should be returned
+            directly.  Unfortunatly, legacy code, called by
+            legacy_get_prev_frame, explicitly set the frames type
+            using the method deprecated_set_frame_type().  */
+         gdb_assert (fi->unwind->type != UNKNOWN_FRAME);
+         fi->type = fi->unwind->type;
+       }
       /* Find THIS frame's ID.  */
       fi->unwind->this_id (fi->next, &fi->prologue_cache, &fi->this_id.value);
       fi->this_id.p = 1;
@@ -282,10 +295,8 @@ frame_id_eq (struct frame_id l, struct frame_id r)
     /* The .stack and .code are identical, the ID's are identical.  */
     eq = 1;
   else
-    /* FIXME: cagney/2003-04-06: This should be zero.  Can't yet do
-       this because most frame ID's are not being initialized
-       correctly.  */
-    eq = 1;
+    /* No luck.  */
+    eq = 0;
   if (frame_debug)
     {
       fprintf_unfiltered (gdb_stdlog, "{ frame_id_eq (l=");
@@ -503,6 +514,20 @@ frame_register_unwind (struct frame_info *frame, int regnum,
      detected the problem before calling here.  */
   gdb_assert (frame != NULL);
 
+  /* Find the unwinder.  */
+  if (frame->unwind == NULL)
+    {
+      frame->unwind = frame_unwind_find_by_pc (current_gdbarch,
+                                              get_frame_pc (frame));
+      /* FIXME: cagney/2003-04-02: Rather than storing the frame's
+        type in the frame, the unwinder's type should be returned
+        directly.  Unfortunatly, legacy code, called by
+        legacy_get_prev_frame, explicitly set the frames type using
+        the method deprecated_set_frame_type().  */
+      gdb_assert (frame->unwind->type != UNKNOWN_FRAME);
+      frame->type = frame->unwind->type;
+    }
+
   /* Ask this frame to unwind its register.  See comment in
      "frame-unwind.h" for why NEXT frame and this unwind cace are
      passed in.  */
@@ -1361,7 +1386,8 @@ legacy_get_prev_frame (struct frame_info *this_frame)
             using the same sequence as is found a traditional
             unwinder.  Once all architectures supply the
             unwind_dummy_id method, this code can go away.  */
-         prev->this_id.value = frame_id_build (read_fp (), read_pc ());
+         prev->this_id.value = frame_id_build (deprecated_read_fp (),
+                                               read_pc ());
        }
 
       /* Check that the unwound ID is valid.  */
@@ -1516,8 +1542,9 @@ legacy_get_prev_frame (struct frame_info *this_frame)
      DEPRECATED_INIT_EXTRA_FRAME_INFO, one possible scheme:
 
      SETUP_INNERMOST_FRAME(): Default version is just create_new_frame
-     (read_fp ()), read_pc ()).  Machines with extra frame info would
-     do that (or the local equivalent) and then set the extra fields.
+     (deprecated_read_fp ()), read_pc ()).  Machines with extra frame
+     info would do that (or the local equivalent) and then set the
+     extra fields.
 
      SETUP_ARBITRARY_FRAME(argc, argv): Only change here is that
      create_new_frame would no longer init extra frame info;
@@ -1899,22 +1926,12 @@ get_prev_frame (struct frame_info *this_frame)
       return NULL;
     }
 
-  /* Set the unwind functions based on that identified PC.  */
-  prev_frame->unwind = frame_unwind_find_by_pc (current_gdbarch,
-                                               frame_pc_unwind (this_frame));
-
-  /* FIXME: cagney/2003-04-02: Rather than storing the frame's type in
-     the frame, the unwinder's type should be returned directly.
-     Unfortunatly, legacy code, called by legacy_get_prev_frame,
-     explicitly set the frames type using the method
-     deprecated_set_frame_type().  */
-  gdb_assert (prev_frame->unwind->type != UNKNOWN_FRAME);
-  prev_frame->type = prev_frame->unwind->type;
+  /* Don't yet compute ->unwind (and hence ->type).  It is computed
+     on-demand in get_frame_type, frame_register_unwind, and
+     get_frame_id.  */
 
-  /* Can the frame's type and unwinder be computed on demand?  That
-     would make a frame's creation really really lite!  */
-
-  /* The prev's frame's ID is computed by demand in get_frame_id().  */
+  /* Don't yet compute the frame's ID.  It is computed on-demand by
+     get_frame_id().  */
 
   /* The unwound frame ID is validate at the start of this function,
      as part of the logic to decide if that frame should be further
@@ -2052,6 +2069,20 @@ get_frame_type (struct frame_info *frame)
   if (!DEPRECATED_USE_GENERIC_DUMMY_FRAMES
       && deprecated_frame_in_dummy (frame))
     return DUMMY_FRAME;
+  if (frame->unwind == NULL)
+    {
+      /* Initialize the frame's unwinder because it is that which
+         provides the frame's type.  */
+      frame->unwind = frame_unwind_find_by_pc (current_gdbarch,
+                                              get_frame_pc (frame));
+      /* FIXME: cagney/2003-04-02: Rather than storing the frame's
+        type in the frame, the unwinder's type should be returned
+        directly.  Unfortunatly, legacy code, called by
+        legacy_get_prev_frame, explicitly set the frames type using
+        the method deprecated_set_frame_type().  */
+      gdb_assert (frame->unwind->type != UNKNOWN_FRAME);
+      frame->type = frame->unwind->type;
+    }
   if (frame->type == UNKNOWN_FRAME)
     return NORMAL_FRAME;
   else
This page took 0.028772 seconds and 4 git commands to generate.