aboutsummaryrefslogtreecommitdiff
path: root/gdb/dictionary.h
diff options
context:
space:
mode:
authorKeith Seitz <keiths@redhat.com>2019-01-10 13:57:08 -0800
committerKeith Seitz <keiths@redhat.com>2019-01-10 13:57:08 -0800
commitb026f59345a336cabf74719fce9f96cab7c7ab4d (patch)
tree206e3e42bdc820ddd089ef01bcefb4b73a936460 /gdb/dictionary.h
parentc7748ee9ceb5a394658cd07aeb0445924599e442 (diff)
downloadgdb-b026f59345a336cabf74719fce9f96cab7c7ab4d.zip
gdb-b026f59345a336cabf74719fce9f96cab7c7ab4d.tar.gz
gdb-b026f59345a336cabf74719fce9f96cab7c7ab4d.tar.bz2
gdb/23712: Use new multidictionary API
This patch builds on the previous by enabling the `new' multidictionary API. A lot of the hunks are simply textual replacements of "dict_" with "mdict_" and similar transformations. A word of warning, even with the use of multidictionaries, the code still does not satisfactorily fix the reported problems with gdb/23712 (or gdb/23010). We still have additional changes to make before that happens. gdb/ChangeLog: PR gdb/23712 PR symtab/23010 * dictionary.h (struct dictionary): Replace declaration with multidictionary. (dict_create_hashed, dict_create_hashed_expandable) (dict_create_linear, dict_create_linear_expandable) (dict_free, dict_add_symbol, dict_add_pending, dict_empty) (dict_iterator_first, dict_iterator_next, dict_iter_match_first) (dict_iter_match_next, dict_size): Rename to "mdict_" versions taking multidictionary argument. [ALL_DICT_SYMBOLS]: Update for multidictionary. * block.h (struct block) <dict>: Change to multidictionary and rename `multidict'. * block.c, buildsym.c, jit.c, mdebugread.c, objfiles.c, symmisc.c: Update all dictionary references to multidictionary.
Diffstat (limited to 'gdb/dictionary.h')
-rw-r--r--gdb/dictionary.h119
1 files changed, 60 insertions, 59 deletions
diff --git a/gdb/dictionary.h b/gdb/dictionary.h
index 5e17a8b..5705dbb 100644
--- a/gdb/dictionary.h
+++ b/gdb/dictionary.h
@@ -25,10 +25,10 @@
#include "symfile.h"
-/* An opaque type for dictionaries; only dictionary.c should know
- about its innards. */
+/* An opaque type for multi-language dictionaries; only dictionary.c should
+ know about its innards. */
-struct dictionary;
+struct multidictionary;
/* Other types needed for declarations. */
@@ -38,65 +38,64 @@ struct pending;
struct language_defn;
/* The creation functions for various implementations of
- dictionaries. */
+ multi-language dictionaries. */
-/* Create a dictionary of symbols of language LANGUAGE implemented via
+/* Create a multi-language dictionary of symbols 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);
+extern struct multidictionary *
+ mdict_create_hashed (struct obstack *obstack,
+ const struct pending *symbol_list);
-/* 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. */
+/* Create a multi-language dictionary of symbols, implemented
+ via a hashtable that grows as necessary. The initial dictionary of
+ LANGUAGE is empty; to add symbols to it, call mdict_add_symbol().
+ Call mdict_free() when you're done with it. */
-extern struct dictionary *
- dict_create_hashed_expandable (enum language language);
+extern struct multidictionary *
+ mdict_create_hashed_expandable (enum language language);
-/* Create a dictionary of symbols of language LANGUAGE, implemented
+/* Create a multi-language dictionary of symbols, 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);
+extern struct multidictionary *
+ mdict_create_linear (struct obstack *obstack,
+ const struct pending *symbol_list);
-/* 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. */
+/* Create a multi-language dictionary of symbols, implemented
+ via an array that grows as necessary. The multidictionary initially
+ contains a single empty dictionary of LANGUAGE; to add symbols to it,
+ call mdict_add_symbol(). Call mdict_free() when you're done with it. */
-extern struct dictionary *
- dict_create_linear_expandable (enum language language);
+extern struct multidictionary *
+ mdict_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
- only provided via iterator functions. */
+/* The functions providing the interface to multi-language dictionaries.
+ Note that the most common parts of the interface, namely symbol lookup,
+ are only provided via iterator functions. */
-/* Free the memory used by a dictionary that's not on an obstack. (If
+/* Free the memory used by a multidictionary that's not on an obstack. (If
any.) */
-extern void dict_free (struct dictionary *dict);
+extern void mdict_free (struct multidictionary *mdict);
-/* Add a symbol to an expandable dictionary. */
+/* Add a symbol to an expandable multidictionary. */
-extern void dict_add_symbol (struct dictionary *dict, struct symbol *sym);
+extern void mdict_add_symbol (struct multidictionary *mdict,
+ struct symbol *sym);
-/* Utility to add a list of symbols to a dictionary. */
+/* Utility to add a list of symbols to a multidictionary. */
-extern void dict_add_pending (struct dictionary *dict,
- const struct pending *symbol_list);
+extern void mdict_add_pending (struct multidictionary *mdict,
+ const struct pending *symbol_list);
-/* Is the dictionary empty? */
+/* Is the multidictionary empty? */
-extern int dict_empty (struct dictionary *dict);
+extern int mdict_empty (struct multidictionary *mdict);
/* A type containing data that is used when iterating over all symbols
in a dictionary. Don't ever look at its innards; this type would
@@ -128,44 +127,46 @@ struct mdict_iterator
unsigned short current_idx;
};
-/* Initialize ITERATOR to point at the first symbol in DICT, and
- return that first symbol, or NULL if DICT is empty. */
+/* Initialize ITERATOR to point at the first symbol in MDICT, and
+ return that first symbol, or NULL if MDICT is empty. */
-extern struct symbol *dict_iterator_first (const struct dictionary *dict,
- struct dict_iterator *iterator);
+extern struct symbol *
+ mdict_iterator_first (const struct multidictionary *mdict,
+ struct mdict_iterator *miterator);
-/* Advance ITERATOR, and return the next symbol, or NULL if there are
+/* Advance MITERATOR, and return the next symbol, or NULL if there are
no more symbols. Don't call this if you've previously received
- NULL from dict_iterator_first or dict_iterator_next on this
+ NULL from mdict_iterator_first or mdict_iterator_next on this
iteration. */
-extern struct symbol *dict_iterator_next (struct dict_iterator *iterator);
+extern struct symbol *mdict_iterator_next (struct mdict_iterator *miterator);
-/* Initialize ITERATOR to point at the first symbol in DICT whose
+/* Initialize MITERATOR to point at the first symbol in MDICT whose
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_match_first (const struct dictionary *dict,
- const lookup_name_info &name,
- struct dict_iterator *iterator);
+extern struct symbol *
+ mdict_iter_match_first (const struct multidictionary *mdict,
+ const lookup_name_info &name,
+ struct mdict_iterator *miterator);
-/* Advance ITERATOR to point at the next symbol in DICT whose
+/* Advance MITERATOR to point at the next symbol in MDICT whose
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. */
+ mdict_iterator_match_first or mdict_iterator_match_next on this
+ iteration. And don't call it unless MITERATOR was created by a
+ previous call to mdict_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);
+extern struct symbol *mdict_iter_match_next (const lookup_name_info &name,
+ struct mdict_iterator *miterator);
-/* Return some notion of the size of the dictionary: the number of
+/* Return some notion of the size of the multidictionary: the number of
symbols if we have that, the number of hash buckets otherwise. */
-extern int dict_size (const struct dictionary *dict);
+extern int mdict_size (const struct multidictionary *mdict);
/* Macro to loop through all symbols in a dictionary DICT, in no
particular order. ITER is a struct dict_iterator (NOTE: __not__ a
@@ -175,8 +176,8 @@ extern int dict_size (const struct dictionary *dict);
early by a break if you desire. */
#define ALL_DICT_SYMBOLS(dict, iter, sym) \
- for ((sym) = dict_iterator_first ((dict), &(iter)); \
+ for ((sym) = mdict_iterator_first ((dict), &(iter)); \
(sym); \
- (sym) = dict_iterator_next (&(iter)))
+ (sym) = mdict_iterator_next (&(iter)))
#endif /* DICTIONARY_H */