2004-05-01 Andrew Cagney <cagney@redhat.com>
[deliverable/binutils-gdb.git] / gdb / frame.c
index bdb6cb9221c45ae7cc4926b3d01a98c0338a763b..8fb0344220218f226f72cfdd1a473b15ba97a301 100644 (file)
@@ -67,10 +67,10 @@ struct frame_info
   int level;
 
   /* The frame's type.  */
-  /* FIXME: cagney/2003-04-02: Should instead be returning
-     ->unwind->type.  Unfortunately, legacy code is still explicitly
-     setting the type using the method deprecated_set_frame_type.
-     Eliminate that method and this field can be eliminated.  */
+  /* FIXME: cagney/2004-05-01: Should instead just use ->unwind->type.
+     Unfortunately, legacy_get_prev_frame is still explicitly setting
+     the type.  Eliminate that method and this field can be
+     eliminated.  */
   enum frame_type type;
 
   /* For each register, address of where it was saved on entry to the
@@ -233,11 +233,10 @@ get_frame_id (struct frame_info *fi)
        {
          fi->unwind = frame_unwind_find_by_frame (fi->next,
                                                   &fi->prologue_cache);
-         /* FIXME: cagney/2003-04-02: Rather than storing the frame's
-            type in the frame, the unwinder's type should be returned
-            directly.  Unfortunately legacy code, called by
-            legacy_get_prev_frame(), explicitly sets the frame's type
-            using the method deprecated_set_frame_type().  */
+         /* FIXME: cagney/2004-05-01: Should instead just use
+            ->unwind->type.  Unfortunately, legacy_get_prev_frame is
+            still explicitly setting the type.  Eliminate that method
+            and this field can be eliminated.  */
          fi->type = fi->unwind->type;
        }
       /* Find THIS frame's ID.  */
@@ -548,11 +547,10 @@ frame_register_unwind (struct frame_info *frame, int regnum,
     {
       frame->unwind = frame_unwind_find_by_frame (frame->next,
                                                  &frame->prologue_cache);
-      /* FIXME: cagney/2003-04-02: Rather than storing the frame's
-        type in the frame, the unwinder's type should be returned
-        directly.  Unfortunately, legacy code, called by
-        legacy_get_prev_frame(), explicitly set the frames type using
-        the method deprecated_set_frame_type().  */
+      /* FIXME: cagney/2004-05-01: Should instead just use ->unwind->type.
+        Unfortunately, legacy_get_prev_frame is still explicitly setting
+        the type.  Eliminate that method and this field can be
+        eliminated.  */
       frame->type = frame->unwind->type;
     }
 
@@ -769,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
@@ -1059,109 +1057,6 @@ const struct frame_unwind legacy_saved_regs_unwinder = {
 };
 const struct frame_unwind *legacy_saved_regs_unwind = &legacy_saved_regs_unwinder;
 
-
-/* Function: deprecated_generic_get_saved_register
-   Find register number REGNUM relative to FRAME and put its (raw,
-   target format) contents in *RAW_BUFFER.
-
-   Set *OPTIMIZED if the variable was optimized out (and thus can't be
-   fetched).  Note that this is never set to anything other than zero
-   in this implementation.
-
-   Set *LVAL to lval_memory, lval_register, or not_lval, depending on
-   whether the value was fetched from memory, from a register, or in a
-   strange and non-modifiable way (e.g. a frame pointer which was
-   calculated rather than fetched).  We will use not_lval for values
-   fetched from generic dummy frames.
-
-   Set *ADDRP to the address, either in memory or as a
-   DEPRECATED_REGISTER_BYTE offset into the registers array.  If the
-   value is stored in a dummy frame, set *ADDRP to zero.
-
-   The argument RAW_BUFFER must point to aligned memory.  */
-
-void
-deprecated_generic_get_saved_register (char *raw_buffer, int *optimized,
-                                      CORE_ADDR *addrp,
-                                      struct frame_info *frame, int regnum,
-                                      enum lval_type *lval)
-{
-  if (!target_has_registers)
-    error ("No registers.");
-
-  /* Normal systems don't optimize out things with register numbers.  */
-  if (optimized != NULL)
-    *optimized = 0;
-
-  if (addrp)                   /* default assumption: not found in memory */
-    *addrp = 0;
-
-  /* Note: since the current frame's registers could only have been
-     saved by frames INTERIOR TO the current frame, we skip examining
-     the current frame itself: otherwise, we would be getting the
-     previous frame's registers which were saved by the current frame.  */
-
-  if (frame != NULL)
-    {
-      for (frame = get_next_frame (frame);
-          frame_relative_level (frame) >= 0;
-          frame = get_next_frame (frame))
-       {
-         if (get_frame_type (frame) == DUMMY_FRAME)
-           {
-             if (lval)         /* found it in a CALL_DUMMY frame */
-               *lval = not_lval;
-             if (raw_buffer)
-               /* FIXME: cagney/2002-06-26: This should be via the
-                  gdbarch_register_read() method so that it, on the
-                  fly, constructs either a raw or pseudo register
-                  from the raw register cache.  */
-               regcache_raw_read
-                 (deprecated_find_dummy_frame_regcache (get_frame_pc (frame),
-                                                        get_frame_base (frame)),
-                  regnum, raw_buffer);
-             return;
-           }
-
-         DEPRECATED_FRAME_INIT_SAVED_REGS (frame);
-         if (deprecated_get_frame_saved_regs (frame) != NULL
-             && deprecated_get_frame_saved_regs (frame)[regnum] != 0)
-           {
-             if (lval)         /* found it saved on the stack */
-               *lval = lval_memory;
-             if (regnum == SP_REGNUM)
-               {
-                 if (raw_buffer)       /* SP register treated specially */
-                   /* NOTE: cagney/2003-05-09: In-line store_address()
-                       with it's body - store_unsigned_integer().  */
-                   store_unsigned_integer (raw_buffer,
-                                           DEPRECATED_REGISTER_RAW_SIZE (regnum),
-                                           deprecated_get_frame_saved_regs (frame)[regnum]);
-               }
-             else
-               {
-                 if (addrp)    /* any other register */
-                   *addrp = deprecated_get_frame_saved_regs (frame)[regnum];
-                 if (raw_buffer)
-                   read_memory (deprecated_get_frame_saved_regs (frame)[regnum], raw_buffer,
-                                DEPRECATED_REGISTER_RAW_SIZE (regnum));
-               }
-             return;
-           }
-       }
-    }
-
-  /* If we get thru the loop to this point, it means the register was
-     not saved in any frame.  Return the actual live-register value.  */
-
-  if (lval)                    /* found it in a live register */
-    *lval = lval_register;
-  if (addrp)
-    *addrp = DEPRECATED_REGISTER_BYTE (regnum);
-  if (raw_buffer)
-    deprecated_read_register_gen (regnum, raw_buffer);
-}
-
 /* Determine the frame's type based on its PC.  */
 
 static enum frame_type
@@ -1171,14 +1066,7 @@ frame_type_from_pc (CORE_ADDR pc)
       && deprecated_pc_in_call_dummy (pc, 0, 0))
     return DUMMY_FRAME;
   else
-    {
-      char *name;
-      find_pc_partial_function (pc, &name, NULL, NULL);
-      if (DEPRECATED_PC_IN_SIGTRAMP (pc, name))
-       return SIGTRAMP_FRAME;
-      else
-       return NORMAL_FRAME;
-    }
+    return NORMAL_FRAME;
 }
 
 /* Create an arbitrary (i.e. address specified by user) or innermost frame.
@@ -1514,11 +1402,10 @@ legacy_get_prev_frame (struct frame_info *this_frame)
          /* Find PREV frame's unwinder.  */
          prev->unwind = frame_unwind_find_by_frame (this_frame,
                                                     &prev->prologue_cache);
-         /* FIXME: cagney/2003-04-02: Rather than storing the frame's
-            type in the frame, the unwinder's type should be returned
-            directly.  Unfortunately, legacy code, called by
-            legacy_get_prev_frame(), explicitly set the frames type
-            using the method deprecated_set_frame_type().  */
+         /* FIXME: cagney/2004-05-01: Should instead just use
+            ->unwind->type.  Unfortunately, legacy_get_prev_frame is
+            still explicitly setting the type.  Eliminate that method
+            and this field can be eliminated.  */
          prev->type = prev->unwind->type;
          /* Find PREV frame's ID.  */
          prev->unwind->this_id (this_frame,
@@ -1697,25 +1584,6 @@ legacy_get_prev_frame (struct frame_info *this_frame)
   if (DEPRECATED_USE_GENERIC_DUMMY_FRAMES
       && deprecated_pc_in_call_dummy (get_frame_pc (prev), 0, 0))
     prev->type = DUMMY_FRAME;
-  else
-    {
-      /* FIXME: cagney/2002-11-10: This should be moved to before the
-        INIT code above so that the INIT code knows what the frame's
-        type is (in fact, for a [generic] dummy-frame, the type can
-        be set and then the entire initialization can be skipped).
-        Unfortunately, it's the INIT code that sets the PC (Hmm, catch
-        22).  */
-      char *name;
-      find_pc_partial_function (get_frame_pc (prev), &name, NULL, NULL);
-      if (DEPRECATED_PC_IN_SIGTRAMP (get_frame_pc (prev), name))
-       prev->type = SIGTRAMP_FRAME;
-      /* FIXME: cagney/2002-11-11: Leave prev->type alone.  Some
-         architectures are forcing the frame's type in INIT so we
-         don't want to override it here.  Remember, NORMAL_FRAME == 0,
-         so it all works (just :-/).  Once this initialization is
-         moved to the start of this function, all this nastness will
-         go away.  */
-    }
 
   if (prev->type == NORMAL_FRAME)
     prev->this_id.value.code_addr
@@ -1954,13 +1822,12 @@ get_prev_frame (struct frame_info *this_frame)
      be allowed to unwind.  */
   /* NOTE: cagney/2003-02-25: Don't enable until someone has found
      hard evidence that this is needed.  */
-  /* NOTE: cagney/2003-07-07: Fixed a bug in inside_main_func() - wasn't
-     checking for "main" in the minimal symbols.  With that fixed
-     asm-source tests now stop in "main" instead of halting the
+  /* NOTE: cagney/2003-07-07: Fixed a bug in inside_main_func() -
+     wasn't checking for "main" in the minimal symbols.  With that
+     fixed asm-source tests now stop in "main" instead of halting the
      backtrace in weird and wonderful ways somewhere inside the entry
-     file.  Suspect that deprecated_inside_entry_file() and
-     inside_entry_func() tests were added to work around that (now
-     fixed) case.  */
+     file.  Suspect that tests for inside the entry file/func were
+     added to work around that (now fixed) case.  */
   /* NOTE: cagney/2003-07-15: danielj (if I'm reading it right)
      suggested having the inside_entry_func test use the
      inside_main_func() msymbol trick (along with entry_point_address()
@@ -1981,35 +1848,6 @@ get_prev_frame (struct frame_info *this_frame)
       return NULL;
     }
 
-  /* If we're inside the entry file, it isn't valid.  Don't apply this
-     test to a dummy frame - dummy frame PCs typically land in the
-     entry file.  Don't apply this test to the sentinel frame.
-     Sentinel frames should always be allowed to unwind.  */
-  /* NOTE: drow/2002-12-25: should there be a way to disable this
-     check?  It assumes a single small entry file, and the way some
-     debug readers (e.g. dbxread) figure out which object is the
-     entry file is somewhat hokey.  */
-  /* NOTE: cagney/2003-01-10: If there is a way of disabling this test
-     then it should probably be moved to before the ->prev_p test,
-     above.  */
-  /* NOTE: vinschen/2003-04-01: Disabled.  It turns out that the call
-     to deprecated_inside_entry_file() destroys a meaningful backtrace
-     under some conditions, e.g. the backtrace tests in the
-     asm-source testcase are broken for some targets.  In this test
-     the functions are all implemented as part of one file and the
-     testcase is not necessarily linked with a start file (depending
-     on the target).  What happens is that the first frame is printed
-     normally and following frames are treated as being inside the
-     entry file then.  This way, only the #0 frame is printed in the
-     backtrace output.  */
-  if (0
-      && this_frame->type != DUMMY_FRAME && this_frame->level >= 0
-      && deprecated_inside_entry_file (get_frame_pc (this_frame)))
-    {
-      frame_debug_got_null_frame (gdb_stdlog, this_frame, "inside entry file");
-      return NULL;
-    }
-
   return get_prev_frame_1 (this_frame);
 }
 
@@ -2161,11 +1999,10 @@ get_frame_type (struct frame_info *frame)
          provides the frame's type.  */
       frame->unwind = frame_unwind_find_by_frame (frame->next, 
                                                  &frame->prologue_cache);
-      /* FIXME: cagney/2003-04-02: Rather than storing the frame's
-        type in the frame, the unwinder's type should be returned
-        directly.  Unfortunately, legacy code, called by
-        legacy_get_prev_frame(), explicitly set the frames type using
-        the method deprecated_set_frame_type().  */
+      /* FIXME: cagney/2004-05-01: Should instead just use
+        ->unwind->type.  Unfortunately, legacy_get_prev_frame is
+        still explicitly setting the type.  Eliminate that method and
+        this field can be eliminated.  */
       frame->type = frame->unwind->type;
     }
   if (frame->type == UNKNOWN_FRAME)
@@ -2174,13 +2011,6 @@ get_frame_type (struct frame_info *frame)
     return frame->type;
 }
 
-void
-deprecated_set_frame_type (struct frame_info *frame, enum frame_type type)
-{
-  /* Arrrg!  See comment in "frame.h".  */
-  frame->type = type;
-}
-
 struct frame_extra_info *
 get_frame_extra_info (struct frame_info *fi)
 {
This page took 0.02828 seconds and 4 git commands to generate.