2004-05-10 Randolph Chung <tausq@debian.org>
[deliverable/binutils-gdb.git] / gdb / blockframe.c
index 00d7d8f13e473680f362c999e0f5e532971c6e7d..428377e688dcac6fccb08b34beaac70dae75bc91 100644 (file)
@@ -25,7 +25,6 @@
 #include "defs.h"
 #include "symtab.h"
 #include "bfd.h"
-#include "symfile.h"
 #include "objfiles.h"
 #include "frame.h"
 #include "gdbcore.h"
 
 void _initialize_blockframe (void);
 
-/* Is ADDR inside the startup file?  Note that if your machine has a
-   way to detect the bottom of the stack, there is no need to call
-   this function from DEPRECATED_FRAME_CHAIN_VALID; the reason for
-   doing so is that some machines have no way of detecting bottom of
-   stack.
-
-   A PC of zero is always considered to be the bottom of the stack. */
-
-int
-deprecated_inside_entry_file (CORE_ADDR addr)
-{
-  if (addr == 0)
-    return 1;
-  if (symfile_objfile == 0)
-    return 0;
-  if (CALL_DUMMY_LOCATION == AT_ENTRY_POINT
-      || CALL_DUMMY_LOCATION == AT_SYMBOL)
-    {
-      /* Do not stop backtracing if the pc is in the call dummy
-         at the entry point.  */
-      /* FIXME: Won't always work with zeros for the last two arguments */
-      if (DEPRECATED_PC_IN_CALL_DUMMY (addr, 0, 0))
-       return 0;
-    }
-  return (addr >= symfile_objfile->ei.deprecated_entry_file_lowpc &&
-         addr < symfile_objfile->ei.deprecated_entry_file_highpc);
-}
-
 /* Test whether PC is in the range of addresses that corresponds to
    the "main" function.  */
 
@@ -186,12 +157,12 @@ legacy_inside_entry_func (CORE_ADDR pc)
          && symfile_objfile->ei.entry_func_highpc > pc);
 }
 
-/* Return nonzero if the function for this frame lacks a prologue.  Many
-   machines can define FRAMELESS_FUNCTION_INVOCATION to just call this
-   function.  */
+/* Return nonzero if the function for this frame lacks a prologue.
+   Many machines can define DEPRECATED_FRAMELESS_FUNCTION_INVOCATION
+   to just call this function.  */
 
 int
-frameless_look_for_prologue (struct frame_info *frame)
+legacy_frameless_look_for_prologue (struct frame_info *frame)
 {
   CORE_ADDR func_start;
 
@@ -199,9 +170,16 @@ frameless_look_for_prologue (struct frame_info *frame)
   if (func_start)
     {
       func_start += FUNCTION_START_OFFSET;
-      /* This is faster, since only care whether there *is* a
-         prologue, not how long it is.  */
-      return PROLOGUE_FRAMELESS_P (func_start);
+      /* NOTE: cagney/2004-02-09: Eliminated per-architecture
+         PROLOGUE_FRAMELESS_P call as architectures with custom
+         implementations had all been deleted.  Eventually even this
+         function can go - GDB no longer tries to differentiate
+         between framed, frameless and stackless functions.  They are
+         all now considered equally evil :-^.  */
+      /* If skipping the prologue ends up skips nothing, there must be
+         no prologue and hence no code creating a frame.  There for
+         the function is "frameless" :-/.  */
+      return func_start == SKIP_PROLOGUE (func_start);
     }
   else if (get_frame_pc (frame) == 0)
     /* A frame with a zero PC is usually created by dereferencing a
@@ -337,10 +315,13 @@ clear_pc_function_cache (void)
    If it fails, it sets *NAME, *ADDRESS, and *ENDADDR to zero and
    returns 0.  */
 
+/* Backward compatibility, no section argument.  */
+
 int
-find_pc_sect_partial_function (CORE_ADDR pc, asection *section, char **name,
-                              CORE_ADDR *address, CORE_ADDR *endaddr)
+find_pc_partial_function (CORE_ADDR pc, char **name, CORE_ADDR *address,
+                         CORE_ADDR *endaddr)
 {
+  struct bfd_section *section;
   struct partial_symtab *pst;
   struct symbol *f;
   struct minimal_symbol *msymbol;
@@ -349,6 +330,21 @@ find_pc_sect_partial_function (CORE_ADDR pc, asection *section, char **name,
   int i;
   CORE_ADDR mapped_pc;
 
+  /* To ensure that the symbol returned belongs to the correct setion
+     (and that the last [random] symbol from the previous section
+     isn't returned) try to find the section containing PC.  First try
+     the overlay code (which by default returns NULL); and second try
+     the normal section code (which almost always succeeds).  */
+  section = find_pc_overlay (pc);
+  if (section == NULL)
+    {
+      struct obj_section *obj_section = find_pc_section (pc);
+      if (obj_section == NULL)
+       section = NULL;
+      else
+       section = obj_section->the_bfd_section;
+    }
+
   mapped_pc = overlay_mapped_address (pc, section);
 
   if (mapped_pc >= cache_pc_function_low
@@ -356,17 +352,6 @@ find_pc_sect_partial_function (CORE_ADDR pc, asection *section, char **name,
       && section == cache_pc_function_section)
     goto return_cached_value;
 
-  /* If sigtramp is in the u area, it counts as a function (especially
-     important for step_1).  */
-  if (SIGTRAMP_START_P () && PC_IN_SIGTRAMP (mapped_pc, (char *) NULL))
-    {
-      cache_pc_function_low = SIGTRAMP_START (mapped_pc);
-      cache_pc_function_high = SIGTRAMP_END (mapped_pc);
-      cache_pc_function_name = "<sigtramp>";
-      cache_pc_function_section = section;
-      goto return_cached_value;
-    }
-
   msymbol = lookup_minimal_symbol_by_pc_section (mapped_pc, section);
   pst = find_pc_sect_psymtab (mapped_pc, section);
   if (pst)
@@ -501,18 +486,6 @@ find_pc_sect_partial_function (CORE_ADDR pc, asection *section, char **name,
   return 1;
 }
 
-/* Backward compatibility, no section argument.  */
-
-int
-find_pc_partial_function (CORE_ADDR pc, char **name, CORE_ADDR *address,
-                         CORE_ADDR *endaddr)
-{
-  asection *section;
-
-  section = find_pc_overlay (pc);
-  return find_pc_sect_partial_function (pc, section, name, address, endaddr);
-}
-
 /* Return the innermost stack frame executing inside of BLOCK,
    or NULL if there is no such frame.  If BLOCK is NULL, just return NULL.  */
 
@@ -546,43 +519,6 @@ block_innermost_frame (struct block *block)
    below is for infrun.c, which may give the macro a pc without that
    subtracted out.  */
 
-/* Is the PC in a call dummy?  SP and FRAME_ADDRESS are the bottom and
-   top of the stack frame which we are checking, where "bottom" and
-   "top" refer to some section of memory which contains the code for
-   the call dummy.  Calls to this macro assume that the contents of
-   SP_REGNUM and DEPRECATED_FP_REGNUM (or the saved values thereof),
-   respectively, are the things to pass.
-
-   This won't work on the 29k, where SP_REGNUM and
-   DEPRECATED_FP_REGNUM don't have that meaning, but the 29k doesn't
-   use ON_STACK.  This could be fixed by generalizing this scheme,
-   perhaps by passing in a frame and adding a few fields, at least on
-   machines which need them for DEPRECATED_PC_IN_CALL_DUMMY.
-
-   Something simpler, like checking for the stack segment, doesn't work,
-   since various programs (threads implementations, gcc nested function
-   stubs, etc) may either allocate stack frames in another segment, or
-   allocate other kinds of code on the stack.  */
-
-int
-deprecated_pc_in_call_dummy_on_stack (CORE_ADDR pc, CORE_ADDR sp,
-                                     CORE_ADDR frame_address)
-{
-  return (INNER_THAN ((sp), (pc))
-         && (frame_address != 0)
-         && INNER_THAN ((pc), (frame_address)));
-}
-
-int
-deprecated_pc_in_call_dummy_at_entry_point (CORE_ADDR pc, CORE_ADDR sp,
-                                           CORE_ADDR frame_address)
-{
-  CORE_ADDR addr = entry_point_address ();
-  if (DEPRECATED_CALL_DUMMY_ADDRESS_P ())
-    addr = DEPRECATED_CALL_DUMMY_ADDRESS ();
-  return ((pc) >= addr && (pc) <= (addr + DECR_PC_AFTER_BREAK));
-}
-
 /* Returns true for a user frame or a call_function_by_hand dummy
    frame, and false for the CRT0 start-up frame.  Purpose is to
    terminate backtrace.  */
@@ -591,8 +527,7 @@ int
 legacy_frame_chain_valid (CORE_ADDR fp, struct frame_info *fi)
 {
   /* Don't prune CALL_DUMMY frames.  */
-  if (DEPRECATED_USE_GENERIC_DUMMY_FRAMES
-      && DEPRECATED_PC_IN_CALL_DUMMY (get_frame_pc (fi), 0, 0))
+  if (DEPRECATED_PC_IN_CALL_DUMMY (get_frame_pc (fi), 0, 0))
     return 1;
 
   /* If the new frame pointer is zero, then it isn't valid.  */
@@ -614,12 +549,5 @@ legacy_frame_chain_valid (CORE_ADDR fp, struct frame_info *fi)
   if (legacy_inside_entry_func (get_frame_pc (fi)))
     return 0;
 
-  /* If we're inside the entry file, it isn't valid.  */
-  /* 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.  */
-  if (deprecated_inside_entry_file (frame_pc_unwind (fi)))
-      return 0;
-
   return 1;
 }
This page took 0.027697 seconds and 4 git commands to generate.