DWARF-5: .debug_names index consumer
[deliverable/binutils-gdb.git] / gdb / dictionary.h
index 75edd7fb67a374ff41fb3874b9cd1f7abff76c50..e65026b6090bd2a2e7130e907cb97bf97e3932e8 100644 (file)
@@ -1,6 +1,6 @@
 /* Routines for name->symbol lookups in GDB.
    
-   Copyright 2003 Free Software Foundation, Inc.
+   Copyright (C) 2003-2017 Free Software Foundation, Inc.
 
    Contributed by David Carlton <carlton@bactrian.org> and by Kealia,
    Inc.
@@ -9,22 +9,22 @@
 
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
-   the Free Software Foundation; either version 2 of the License, or (at
-   your option) any later version.
+   the Free Software Foundation; either version 3 of the License, or
+   (at your option) any later version.
 
-   This program is distributed in the hope that it will be useful, but
-   WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   General Public License for more details.
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
 
    You should have received a copy of the GNU General Public License
-   along with this program; if not, write to the Free Software
-   Foundation, Inc., 59 Temple Place - Suite 330,
-   Boston, MA 02111-1307, USA.  */
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
 #ifndef DICTIONARY_H
 #define DICTIONARY_H
 
+#include "symfile.h"
+
 /* An opaque type for dictionaries; only dictionary.c should know
    about its innards.  */
 
@@ -35,42 +35,46 @@ struct dictionary;
 struct symbol;
 struct obstack;
 struct pending;
-
+struct language_defn;
 
 /* The creation functions for various implementations of
    dictionaries.  */
 
-/* Create a dictionary implemented via a fixed-size hashtable.  All
-   memory it uses is allocated on OBSTACK; the environment is
-   initialized from SYMBOL_LIST.  */
+/* Create a dictionary of symbols of language LANGUAGE implemented via
+   a fixed-size hashtable.  All memory it uses is allocated on
+   OBSTACK; the environment is initialized from SYMBOL_LIST.  */
 
 extern struct dictionary *dict_create_hashed (struct obstack *obstack,
+                                             enum language language,
                                              const struct pending
                                              *symbol_list);
 
-/* Create a dictionary implemented via a hashtable that grows as
-   necessary.  The dictionary is initially empty; to add symbols to
-   it, call dict_add_symbol().  Call dict_free() when you're done with
-   it.  */
+/* Create a dictionary of symbols of language LANGUAGE, implemented
+   via a hashtable that grows as necessary.  The dictionary is
+   initially empty; to add symbols to it, call dict_add_symbol().
+   Call dict_free() when you're done with it.  */
 
-extern struct dictionary *dict_create_hashed_expandable (void);
+extern struct dictionary *
+  dict_create_hashed_expandable (enum language language);
 
-/* Create a dictionary implemented via a fixed-size array.  All memory
-   it uses is allocated on OBSTACK; the environment is initialized
-   from the SYMBOL_LIST.  The symbols are ordered in the same order
-   that they're found in SYMBOL_LIST.  */
+/* Create a dictionary of symbols of language LANGUAGE, implemented
+   via a fixed-size array.  All memory it uses is allocated on
+   OBSTACK; the environment is initialized from the SYMBOL_LIST.  The
+   symbols are ordered in the same order that they're found in
+   SYMBOL_LIST.  */
 
 extern struct dictionary *dict_create_linear (struct obstack *obstack,
+                                             enum language language,
                                              const struct pending
                                              *symbol_list);
 
-/* Create a dictionary implemented via an array that grows as
-   necessary.  The dictionary is initially empty; to add symbols to
-   it, call dict_add_symbol().  Call dict_free() when you're done with
-   it.  */
-
-extern struct dictionary *dict_create_linear_expandable (void);
+/* Create a dictionary of symbols of language LANGUAGE, implemented
+   via an array that grows as necessary.  The dictionary is initially
+   empty; to add symbols to it, call dict_add_symbol().  Call
+   dict_free() when you're done with it.  */
 
+extern struct dictionary *
+  dict_create_linear_expandable (enum language language);
 
 /* The functions providing the interface to dictionaries.  Note that
    the most common parts of the interface, namely symbol lookup, are
@@ -85,6 +89,11 @@ extern void dict_free (struct dictionary *dict);
 
 extern void dict_add_symbol (struct dictionary *dict, struct symbol *sym);
 
+/* Utility to add a list of symbols to a dictionary.  */
+
+extern void dict_add_pending (struct dictionary *dict,
+                             const struct pending *symbol_list);
+
 /* Is the dictionary empty?  */
 
 extern int dict_empty (struct dictionary *dict);
@@ -118,23 +127,25 @@ extern struct symbol *dict_iterator_first (const struct dictionary *dict,
 extern struct symbol *dict_iterator_next (struct dict_iterator *iterator);
 
 /* Initialize ITERATOR to point at the first symbol in DICT whose
-   SYMBOL_BEST_NAME is NAME (as tested using strcmp_iw), and return
-   that first symbol, or NULL if there are no such symbols.  */
+   SYMBOL_SEARCH_NAME is NAME, as tested using COMPARE (which must use
+   the same conventions as strcmp_iw and be compatible with any
+   dictionary hashing function), and return that first symbol, or NULL
+   if there are no such symbols.  */
 
-extern struct symbol *dict_iter_name_first (const struct dictionary *dict,
-                                           const char *name,
-                                           struct dict_iterator *iterator);
+extern struct symbol *dict_iter_match_first (const struct dictionary *dict,
+                                            const lookup_name_info &name,
+                                            struct dict_iterator *iterator);
 
 /* Advance ITERATOR to point at the next symbol in DICT whose
-   SYMBOL_BEST_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 dict_iterator_first or
-   dict_iterator_next on this iteration.  And don't call it unless
-   ITERATOR was created by a previous call to dict_iter_name_first
-   with the same NAME.  */
-
-extern struct symbol *dict_iter_name_next (const char *name,
-                                          struct dict_iterator *iterator);
+   SYMBOL_SEARCH_NAME is NAME, as tested using COMPARE (see
+   dict_iter_match_first), or NULL if there are no more such symbols.
+   Don't call this if you've previously received NULL from 
+   dict_iterator_match_first or dict_iterator_match_next on this
+   iteration.  And don't call it unless ITERATOR was created by a
+   previous call to dict_iter_match_first with the same NAME and COMPARE.  */
+
+extern struct symbol *dict_iter_match_next (const lookup_name_info &name,
+                                           struct dict_iterator *iterator);
 
 /* Return some notion of the size of the dictionary: the number of
    symbols if we have that, the number of hash buckets otherwise.  */
This page took 0.028434 seconds and 4 git commands to generate.