Replace clear_hook_in_cleanup with scoped_restore_hook_in
[deliverable/binutils-gdb.git] / gdb / block.c
index f4b8e4f234e080544292611abe7ab9359b42c7f8..1c343aade73aea255d5f642e52dd1f89dba22b69 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;
     }
@@ -590,75 +589,6 @@ block_iterator_next (struct block_iterator *iterator)
   return block_iterator_step (iterator, 0);
 }
 
-/* Perform a single step for a "name" block iterator, iterating across
-   symbol tables as needed.  Returns the next symbol, or NULL when
-   iteration is complete.  */
-
-static struct symbol *
-block_iter_name_step (struct block_iterator *iterator, const char *name,
-                     int first)
-{
-  struct symbol *sym;
-
-  gdb_assert (iterator->which != FIRST_LOCAL_BLOCK);
-
-  while (1)
-    {
-      if (first)
-       {
-         struct compunit_symtab *cust
-           = find_iterator_compunit_symtab (iterator);
-         const struct block *block;
-
-         /* Iteration is complete.  */
-         if (cust == NULL)
-           return  NULL;
-
-         block = BLOCKVECTOR_BLOCK (COMPUNIT_BLOCKVECTOR (cust),
-                                    iterator->which);
-         sym = dict_iter_name_first (BLOCK_DICT (block), name,
-                                     &iterator->dict_iter);
-       }
-      else
-       sym = dict_iter_name_next (name, &iterator->dict_iter);
-
-      if (sym != NULL)
-       return sym;
-
-      /* We have finished iterating the appropriate block of one
-        symtab.  Now advance to the next symtab and begin iteration
-        there.  */
-      ++iterator->idx;
-      first = 1;
-    }
-}
-
-/* See block.h.  */
-
-struct symbol *
-block_iter_name_first (const struct block *block,
-                      const char *name,
-                      struct block_iterator *iterator)
-{
-  initialize_block_iterator (block, iterator);
-
-  if (iterator->which == FIRST_LOCAL_BLOCK)
-    return dict_iter_name_first (block->dict, name, &iterator->dict_iter);
-
-  return block_iter_name_step (iterator, name, 1);
-}
-
-/* See block.h.  */
-
-struct symbol *
-block_iter_name_next (const char *name, struct block_iterator *iterator)
-{
-  if (iterator->which == FIRST_LOCAL_BLOCK)
-    return dict_iter_name_next (name, &iterator->dict_iter);
-
-  return block_iter_name_step (iterator, name, 0);
-}
-
 /* Perform a single step for a "match" block iterator, iterating
    across symbol tables as needed.  Returns the next symbol, or NULL
    when iteration is complete.  */
@@ -813,9 +743,9 @@ block_lookup_symbol_primary (const struct block *block, const char *name,
              || BLOCK_SUPERBLOCK (BLOCK_SUPERBLOCK (block)) == NULL);
 
   other = NULL;
-  for (sym = dict_iter_name_first (block->dict, name, &dict_iter);
+  for (sym = dict_iter_match_first (block->dict, name, strcmp_iw, &dict_iter);
        sym != NULL;
-       sym = dict_iter_name_next (name, &dict_iter))
+       sym = dict_iter_match_next (name, strcmp_iw, &dict_iter))
     {
       if (SYMBOL_DOMAIN (sym) == domain)
        return sym;
@@ -871,7 +801,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.026513 seconds and 4 git commands to generate.