linux-nat: Remove unused parameter
[deliverable/binutils-gdb.git] / gdb / block.c
index 79a8f195db80602d65fee17ef44dcc331707215a..2f444605ff23ec42e331033061685c38e826e80d 100644 (file)
@@ -1,6 +1,6 @@
 /* Block-related functions for the GNU debugger, GDB.
 
-   Copyright (C) 2003-2015 Free Software Foundation, Inc.
+   Copyright (C) 2003-2017 Free Software Foundation, Inc.
 
    This file is part of GDB.
 
@@ -140,7 +140,7 @@ find_block_in_blockvector (const struct blockvector *bl, CORE_ADDR pc)
   /* If we have an addrmap mapping code addresses to blocks, then use
      that.  */
   if (BLOCKVECTOR_MAP (bl))
-    return addrmap_find (BLOCKVECTOR_MAP (bl), pc);
+    return (struct block *) addrmap_find (BLOCKVECTOR_MAP (bl), pc);
 
   /* Otherwise, use binary search to find the last block that starts
      before PC.
@@ -239,14 +239,14 @@ call_site_for_pc (struct gdbarch *gdbarch, CORE_ADDR pc)
       /* DW_TAG_gnu_call_site will be missing just if GCC could not determine
         the call target.  */
       throw_error (NO_ENTRY_VALUE_ERROR,
-                  _("DW_OP_GNU_entry_value resolving cannot find "
-                    "DW_TAG_GNU_call_site %s in %s"),
+                  _("DW_OP_entry_value resolving cannot find "
+                    "DW_TAG_call_site %s in %s"),
                   paddress (gdbarch, pc),
                   (msym.minsym == NULL ? "???"
                    : MSYMBOL_PRINT_NAME (msym.minsym)));
     }
 
-  return *slot;
+  return (struct call_site *) *slot;
 }
 
 /* Return the blockvector immediately containing the innermost lexical block
@@ -351,8 +351,7 @@ block_initialize_namespace (struct block *block, struct obstack *obstack)
 {
   if (BLOCK_NAMESPACE (block) == NULL)
     {
-      BLOCK_NAMESPACE (block)
-       = obstack_alloc (obstack, sizeof (struct block_namespace_info));
+      BLOCK_NAMESPACE (block) = XOBNEW (obstack, struct block_namespace_info);
       BLOCK_NAMESPACE (block)->scope = NULL;
       BLOCK_NAMESPACE (block)->using_decl = NULL;
     }
@@ -428,6 +427,21 @@ set_block_compunit_symtab (struct block *block, struct compunit_symtab *cu)
   gb->compunit_symtab = cu;
 }
 
+/* See block.h.  */
+
+struct dynamic_prop *
+block_static_link (const struct block *block)
+{
+  struct objfile *objfile = block_objfile (block);
+
+  /* Only objfile-owned blocks that materialize top function scopes can have
+     static links.  */
+  if (objfile == NULL || BLOCK_FUNCTION (block) == NULL)
+    return NULL;
+
+  return (struct dynamic_prop *) objfile_lookup_static_link (objfile, block);
+}
+
 /* Return the compunit of the global block.  */
 
 static struct compunit_symtab *
@@ -739,13 +753,21 @@ block_lookup_symbol (const struct block *block, const char *name,
 
   if (!BLOCK_FUNCTION (block))
     {
+      struct symbol *other = NULL;
+
       ALL_BLOCK_SYMBOLS_WITH_NAME (block, name, iter, sym)
        {
+         if (SYMBOL_DOMAIN (sym) == domain)
+           return sym;
+         /* This is a bit of a hack, but symbol_matches_domain might ignore
+            STRUCT vs VAR domain symbols.  So if a matching symbol is found,
+            make sure there is no "better" matching symbol, i.e., one with
+            exactly the same domain.  PR 16253.  */
          if (symbol_matches_domain (SYMBOL_LANGUAGE (sym),
                                     SYMBOL_DOMAIN (sym), domain))
-           return sym;
+           other = sym;
        }
-      return NULL;
+      return other;
     }
   else
     {
@@ -753,7 +775,10 @@ block_lookup_symbol (const struct block *block, const char *name,
         list; this loop makes sure to take anything else other than
         parameter symbols first; it only uses parameter symbols as a
         last resort.  Note that this only takes up extra computation
-        time on a match.  */
+        time on a match.
+        It's hard to define types in the parameter list (at least in
+        C/C++) so we don't do the same PR 16253 hack here that is done
+        for the !BLOCK_FUNCTION case.  */
 
       struct symbol *sym_found = NULL;
 
@@ -779,23 +804,31 @@ struct symbol *
 block_lookup_symbol_primary (const struct block *block, const char *name,
                             const domain_enum domain)
 {
-  struct symbol *sym;
+  struct symbol *sym, *other;
   struct dict_iterator dict_iter;
 
   /* Verify BLOCK is STATIC_BLOCK or GLOBAL_BLOCK.  */
   gdb_assert (BLOCK_SUPERBLOCK (block) == NULL
              || BLOCK_SUPERBLOCK (BLOCK_SUPERBLOCK (block)) == NULL);
 
+  other = NULL;
   for (sym = dict_iter_name_first (block->dict, name, &dict_iter);
        sym != NULL;
        sym = dict_iter_name_next (name, &dict_iter))
     {
+      if (SYMBOL_DOMAIN (sym) == domain)
+       return sym;
+
+      /* This is a bit of a hack, but symbol_matches_domain might ignore
+        STRUCT vs VAR domain symbols.  So if a matching symbol is found,
+        make sure there is no "better" matching symbol, i.e., one with
+        exactly the same domain.  PR 16253.  */
       if (symbol_matches_domain (SYMBOL_LANGUAGE (sym),
                                 SYMBOL_DOMAIN (sym), domain))
-       return sym;
+       other = sym;
     }
 
-  return NULL;
+  return other;
 }
 
 /* See block.h.  */
@@ -837,7 +870,7 @@ block_find_non_opaque_type (struct symbol *sym, void *data)
 int
 block_find_non_opaque_type_preferred (struct symbol *sym, void *data)
 {
-  struct symbol **best = data;
+  struct symbol **best = (struct symbol **) data;
 
   if (!TYPE_IS_OPAQUE (SYMBOL_TYPE (sym)))
     return 1;
This page took 0.025767 seconds and 4 git commands to generate.