Gate the displaying of non-debug sections in separate debuginfo files.
[deliverable/binutils-gdb.git] / gdb / blockframe.c
index a3f82ef5a9c76cc36ed810a0af2f9284d89a0a69..4d4e50e1a1b4e218e769bc428d37fd48f201c5e3 100644 (file)
@@ -1,7 +1,7 @@
 /* Get info from stack frames; convert between frames, blocks,
    functions and pc values.
 
-   Copyright (C) 1986-2019 Free Software Foundation, Inc.
+   Copyright (C) 1986-2021 Free Software Foundation, Inc.
 
    This file is part of GDB.
 
@@ -191,7 +191,7 @@ find_pc_sect_containing_function (CORE_ADDR pc, struct obj_section *section)
 
 static CORE_ADDR cache_pc_function_low = 0;
 static CORE_ADDR cache_pc_function_high = 0;
-static const char *cache_pc_function_name = 0;
+static const general_symbol_info *cache_pc_function_sym = nullptr;
 static struct obj_section *cache_pc_function_section = NULL;
 static const struct block *cache_pc_function_block = nullptr;
 
@@ -202,7 +202,7 @@ clear_pc_function_cache (void)
 {
   cache_pc_function_low = 0;
   cache_pc_function_high = 0;
-  cache_pc_function_name = (char *) 0;
+  cache_pc_function_sym = nullptr;
   cache_pc_function_section = NULL;
   cache_pc_function_block = nullptr;
 }
@@ -210,8 +210,10 @@ clear_pc_function_cache (void)
 /* See symtab.h.  */
 
 bool
-find_pc_partial_function (CORE_ADDR pc, const char **name, CORE_ADDR *address,
-                         CORE_ADDR *endaddr, const struct block **block)
+find_pc_partial_function_sym (CORE_ADDR pc,
+                             const struct general_symbol_info **sym,
+                             CORE_ADDR *address, CORE_ADDR *endaddr,
+                             const struct block **block)
 {
   struct obj_section *section;
   struct symbol *f;
@@ -219,7 +221,7 @@ find_pc_partial_function (CORE_ADDR pc, const char **name, CORE_ADDR *address,
   struct compunit_symtab *compunit_symtab = NULL;
   CORE_ADDR mapped_pc;
 
-  /* To ensure that the symbol returned belongs to the correct setion
+  /* To ensure that the symbol returned belongs to the correct section
      (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
@@ -236,19 +238,7 @@ find_pc_partial_function (CORE_ADDR pc, const char **name, CORE_ADDR *address,
     goto return_cached_value;
 
   msymbol = lookup_minimal_symbol_by_pc_section (mapped_pc, section);
-  for (objfile *objfile : current_program_space->objfiles ())
-    {
-      if (objfile->sf)
-       {
-         compunit_symtab
-           = objfile->sf->qf->find_pc_sect_compunit_symtab (objfile, msymbol,
-                                                            mapped_pc,
-                                                            section,
-                                                            0);
-       }
-      if (compunit_symtab != NULL)
-       break;
-    }
+  compunit_symtab = find_pc_sect_compunit_symtab (mapped_pc, section);
 
   if (compunit_symtab != NULL)
     {
@@ -269,7 +259,7 @@ find_pc_partial_function (CORE_ADDR pc, const char **name, CORE_ADDR *address,
        {
          const struct block *b = SYMBOL_BLOCK_VALUE (f);
 
-         cache_pc_function_name = SYMBOL_LINKAGE_NAME (f);
+         cache_pc_function_sym = f;
          cache_pc_function_section = section;
          cache_pc_function_block = b;
 
@@ -295,7 +285,7 @@ find_pc_partial_function (CORE_ADDR pc, const char **name, CORE_ADDR *address,
            {
              int i;
              for (i = 0; i < BLOCK_NRANGES (b); i++)
-               {
+               {
                  if (BLOCK_RANGE_START (b, i) <= mapped_pc
                      && mapped_pc < BLOCK_RANGE_END (b, i))
                    {
@@ -325,8 +315,8 @@ find_pc_partial_function (CORE_ADDR pc, const char **name, CORE_ADDR *address,
   if (msymbol.minsym == NULL)
     {
       /* No available symbol.  */
-      if (name != NULL)
-       *name = 0;
+      if (sym != nullptr)
+       *sym = 0;
       if (address != NULL)
        *address = 0;
       if (endaddr != NULL)
@@ -337,7 +327,7 @@ find_pc_partial_function (CORE_ADDR pc, const char **name, CORE_ADDR *address,
     }
 
   cache_pc_function_low = BMSYMBOL_VALUE_ADDRESS (msymbol);
-  cache_pc_function_name = MSYMBOL_LINKAGE_NAME (msymbol.minsym);
+  cache_pc_function_sym = msymbol.minsym;
   cache_pc_function_section = section;
   cache_pc_function_high = minimal_symbol_upper_bound (msymbol);
   cache_pc_function_block = nullptr;
@@ -352,8 +342,8 @@ find_pc_partial_function (CORE_ADDR pc, const char **name, CORE_ADDR *address,
        *address = cache_pc_function_low;
     }
 
-  if (name)
-    *name = cache_pc_function_name;
+  if (sym != nullptr)
+    *sym = cache_pc_function_sym;
 
   if (endaddr)
     {
@@ -377,6 +367,20 @@ find_pc_partial_function (CORE_ADDR pc, const char **name, CORE_ADDR *address,
   return true;
 }
 
+/* See symtab.h.  */
+
+bool
+find_pc_partial_function (CORE_ADDR pc, const char **name, CORE_ADDR *address,
+                         CORE_ADDR *endaddr, const struct block **block)
+{
+  const general_symbol_info *gsi;
+  bool r = find_pc_partial_function_sym (pc, &gsi, address, endaddr, block);
+  if (name != nullptr)
+    *name = r ? gsi->linkage_name () : nullptr;
+  return r;
+}
+
+
 /* See symtab.h.  */
 
 bool
@@ -391,24 +395,24 @@ find_function_entry_range_from_pc (CORE_ADDR pc, const char **name,
       CORE_ADDR entry_pc = BLOCK_ENTRY_PC (block);
 
       for (int i = 0; i < BLOCK_NRANGES (block); i++)
-        {
+       {
          if (BLOCK_RANGE_START (block, i) <= entry_pc
              && entry_pc < BLOCK_RANGE_END (block, i))
            {
              if (address != nullptr)
-               *address = BLOCK_RANGE_START (block, i);
+               *address = BLOCK_RANGE_START (block, i);
 
              if (endaddr != nullptr)
-               *endaddr = BLOCK_RANGE_END (block, i);
+               *endaddr = BLOCK_RANGE_END (block, i);
 
              return status;
            }
        }
 
       /* It's an internal error if we exit the above loop without finding
-         the range.  */
+        the range.  */
       internal_error (__FILE__, __LINE__,
-                      _("Entry block not found in find_function_entry_range_from_pc"));
+                     _("Entry block not found in find_function_entry_range_from_pc"));
     }
 
   return status;
@@ -441,11 +445,11 @@ find_gnu_ifunc_target_type (CORE_ADDR resolver_funaddr)
 
       /* If we found a pointer to function, then the resolved type
         is the type of the pointed-to function.  */
-      if (TYPE_CODE (resolver_ret_type) == TYPE_CODE_PTR)
+      if (resolver_ret_type->code () == TYPE_CODE_PTR)
        {
          struct type *resolved_type
            = TYPE_TARGET_TYPE (resolver_ret_type);
-         if (TYPE_CODE (check_typedef (resolved_type)) == TYPE_CODE_FUNC)
+         if (check_typedef (resolved_type)->code () == TYPE_CODE_FUNC)
            return resolved_type;
        }
     }
@@ -460,14 +464,10 @@ find_gnu_ifunc_target_type (CORE_ADDR resolver_funaddr)
 struct frame_info *
 block_innermost_frame (const struct block *block)
 {
-  struct frame_info *frame;
-
   if (block == NULL)
     return NULL;
 
-  frame = get_selected_frame_if_set ();
-  if (frame == NULL)
-    frame = get_current_frame ();
+  frame_info *frame = get_selected_frame ();
   while (frame != NULL)
     {
       const struct block *frame_block = get_frame_block (frame, NULL);
This page took 0.052417 seconds and 4 git commands to generate.