Fix crash in "run" on macOS when gdb is not signed
[external/binutils.git] / gdb / block.h
index d8ad343..ff12725 100644 (file)
@@ -1,6 +1,6 @@
 /* Code dealing with blocks for GDB.
 
-   Copyright (C) 2003-2015 Free Software Foundation, Inc.
+   Copyright (C) 2003-2018 Free Software Foundation, Inc.
 
    This file is part of GDB.
 
@@ -82,21 +82,10 @@ struct block
 
   struct dictionary *dict;
 
-  /* Used for language-specific info.  */
+  /* Contains information about namespace-related info relevant to this block:
+     using directives and the current namespace scope.  */
 
-  union
-  {
-    struct
-    {
-      /* Contains information about namespace-related info relevant to
-        this block: using directives and the current namespace
-        scope.  */
-      
-      struct block_namespace_info *the_namespace;
-    }
-    cplus_specific;
-  }
-  language_specific;
+  struct block_namespace_info *namespace_info;
 };
 
 /* The global block is singled out so that we can provide a back-link
@@ -118,7 +107,7 @@ struct global_block
 #define BLOCK_FUNCTION(bl)     (bl)->function
 #define BLOCK_SUPERBLOCK(bl)   (bl)->superblock
 #define BLOCK_DICT(bl)         (bl)->dict
-#define BLOCK_NAMESPACE(bl)   (bl)->language_specific.cplus_specific.the_namespace
+#define BLOCK_NAMESPACE(bl)    (bl)->namespace_info
 
 struct blockvector
 {
@@ -190,6 +179,17 @@ extern struct block *allocate_global_block (struct obstack *obstack);
 extern void set_block_compunit_symtab (struct block *,
                                       struct compunit_symtab *);
 
+/* Return a property to evaluate the static link associated to BLOCK.
+
+   In the context of nested functions (available in Pascal, Ada and GNU C, for
+   instance), a static link (as in DWARF's DW_AT_static_link attribute) for a
+   function is a way to get the frame corresponding to the enclosing function.
+
+   Note that only objfile-owned and function-level blocks can have a static
+   link.  Return NULL if there is no such property.  */
+
+extern struct dynamic_prop *block_static_link (const struct block *block);
+
 /* A block iterator.  This structure should be treated as though it
    were opaque; it is only defined here because we want to support
    stack allocation of iterators.  */
@@ -237,51 +237,28 @@ extern struct symbol *block_iterator_first (const struct block *block,
 extern struct symbol *block_iterator_next (struct block_iterator *iterator);
 
 /* Initialize ITERATOR to point at the first symbol in BLOCK whose
-   SYMBOL_SEARCH_NAME is NAME (as tested using strcmp_iw), and return
-   that first symbol, or NULL if there are no such symbols.  */
-
-extern struct symbol *block_iter_name_first (const struct block *block,
-                                            const char *name,
-                                            struct block_iterator *iterator);
-
-/* Advance ITERATOR to point at the next symbol in BLOCK whose
-   SYMBOL_SEARCH_NAME is NAME (as tested using strcmp_iw), or NULL if
-   there are no more such symbols.  Don't call this if you've
-   previously received NULL from block_iterator_first or
-   block_iterator_next on this iteration.  And don't call it unless
-   ITERATOR was created by a previous call to block_iter_name_first
-   with the same NAME.  */
-
-extern struct symbol *block_iter_name_next (const char *name,
-                                           struct block_iterator *iterator);
-
-/* Initialize ITERATOR to point at the first symbol in BLOCK whose
-   SYMBOL_SEARCH_NAME is NAME, as tested using COMPARE (which must use
-   the same conventions as strcmp_iw and be compatible with any
-   block hashing function), and return that first symbol, or NULL
-   if there are no such symbols.  */
+   SYMBOL_SEARCH_NAME matches NAME, and return that first symbol, or
+   NULL if there are no such symbols.  */
 
 extern struct symbol *block_iter_match_first (const struct block *block,
-                                             const char *name,
-                                             symbol_compare_ftype *compare,
+                                             const lookup_name_info &name,
                                              struct block_iterator *iterator);
 
 /* Advance ITERATOR to point at the next symbol in BLOCK whose
-   SYMBOL_SEARCH_NAME is NAME, as tested using COMPARE (see
-   block_iter_match_first), or NULL if there are no more such symbols.
-   Don't call this if you've previously received NULL from 
+   SYMBOL_SEARCH_NAME matches NAME, or NULL if there are no more such
+   symbols.  Don't call this if you've previously received NULL from
    block_iterator_match_first or block_iterator_match_next on this
    iteration.  And don't call it unless ITERATOR was created by a
-   previous call to block_iter_match_first with the same NAME and COMPARE.  */
+   previous call to block_iter_match_first with the same NAME.  */
 
-extern struct symbol *block_iter_match_next (const char *name,
-                                            symbol_compare_ftype *compare,
-                                            struct block_iterator *iterator);
+extern struct symbol *block_iter_match_next
+  (const lookup_name_info &name, struct block_iterator *iterator);
 
 /* Search BLOCK for symbol NAME in DOMAIN.  */
 
 extern struct symbol *block_lookup_symbol (const struct block *block,
                                           const char *name,
+                                          symbol_name_match_type match_type,
                                           const domain_enum domain);
 
 /* Search BLOCK for symbol NAME in DOMAIN but only in primary symbol table of
@@ -335,13 +312,14 @@ extern int block_find_non_opaque_type_preferred (struct symbol *sym,
        (sym);                                          \
        (sym) = block_iterator_next (&(iter)))
 
-/* Macro to loop through all symbols with name NAME in BLOCK,
-   in no particular order.  ITER helps keep track of the iteration, and
-   must be a struct block_iterator.  SYM points to the current symbol.  */
+/* Macro to loop through all symbols in BLOCK with a name that matches
+   NAME, in no particular order.  ITER helps keep track of the
+   iteration, and must be a struct block_iterator.  SYM points to the
+   current symbol.  */
 
 #define ALL_BLOCK_SYMBOLS_WITH_NAME(block, name, iter, sym)            \
-  for ((sym) = block_iter_name_first ((block), (name), &(iter));       \
+  for ((sym) = block_iter_match_first ((block), (name), &(iter));      \
        (sym) != NULL;                                                  \
-       (sym) = block_iter_name_next ((name), &(iter)))
+       (sym) = block_iter_match_next ((name), &(iter)))
 
 #endif /* BLOCK_H */