|
|
190f2a |
From FEDORA_PATCHES Mon Sep 17 00:00:00 2001
|
|
|
190f2a |
From: Sergio Durigan Junior <sergiodj@redhat.com>
|
|
|
190f2a |
Date: Fri, 11 Jan 2019 11:25:11 -0500
|
|
|
190f2a |
Subject:
|
|
|
190f2a |
gdb-rhbz1560010-fix-assertion-symbol-language-dict-language-2of5.patch
|
|
|
190f2a |
|
|
|
190f2a |
;; Fix 'Assertion `SYMBOL_LANGUAGE (sym) == DICT_LANGUAGE (dict)->la_language' failed.'
|
|
|
190f2a |
;; Keith Seitz, RHBZ#1560010.
|
|
|
190f2a |
|
|
|
190f2a |
gdb/23712: Use new multidictionary API
|
|
|
190f2a |
|
|
|
190f2a |
This patch builds on the previous by enabling the `new' multidictionary
|
|
|
190f2a |
API. A lot of the hunks are simply textual replacements of "dict_"
|
|
|
190f2a |
with "mdict_" and similar transformations.
|
|
|
190f2a |
|
|
|
190f2a |
A word of warning, even with the use of multidictionaries, the code
|
|
|
190f2a |
still does not satisfactorily fix the reported problems with gdb/23712
|
|
|
190f2a |
(or gdb/23010). We still have additional changes to make before that
|
|
|
190f2a |
happens.
|
|
|
190f2a |
|
|
|
190f2a |
gdb/ChangeLog:
|
|
|
190f2a |
|
|
|
190f2a |
PR gdb/23712
|
|
|
190f2a |
PR symtab/23010
|
|
|
190f2a |
* dictionary.h (struct dictionary): Replace declaration with
|
|
|
190f2a |
multidictionary.
|
|
|
190f2a |
(dict_create_hashed, dict_create_hashed_expandable)
|
|
|
190f2a |
(dict_create_linear, dict_create_linear_expandable)
|
|
|
190f2a |
(dict_free, dict_add_symbol, dict_add_pending, dict_empty)
|
|
|
190f2a |
(dict_iterator_first, dict_iterator_next, dict_iter_match_first)
|
|
|
190f2a |
(dict_iter_match_next, dict_size): Rename to "mdict_" versions
|
|
|
190f2a |
taking multidictionary argument.
|
|
|
190f2a |
[ALL_DICT_SYMBOLS]: Update for multidictionary.
|
|
|
190f2a |
* block.h (struct block) <dict>: Change to multidictionary
|
|
|
190f2a |
and rename `multidict'.
|
|
|
190f2a |
* block.c, buildsym.c, jit.c, mdebugread.c, objfiles.c,
|
|
|
190f2a |
symmisc.c: Update all dictionary references to multidictionary.
|
|
|
190f2a |
|
|
|
190f2a |
diff --git a/gdb/block.c b/gdb/block.c
|
|
|
190f2a |
--- a/gdb/block.c
|
|
|
190f2a |
+++ b/gdb/block.c
|
|
|
190f2a |
@@ -387,9 +387,9 @@ block_global_block (const struct block *block)
|
|
|
190f2a |
zero/NULL. This is useful for creating "dummy" blocks that don't
|
|
|
190f2a |
correspond to actual source files.
|
|
|
190f2a |
|
|
|
190f2a |
- Warning: it sets the block's BLOCK_DICT to NULL, which isn't a
|
|
|
190f2a |
+ Warning: it sets the block's BLOCK_MULTIDICT to NULL, which isn't a
|
|
|
190f2a |
valid value. If you really don't want the block to have a
|
|
|
190f2a |
- dictionary, then you should subsequently set its BLOCK_DICT to
|
|
|
190f2a |
+ dictionary, then you should subsequently set its BLOCK_MULTIDICT to
|
|
|
190f2a |
dict_create_linear (obstack, NULL). */
|
|
|
190f2a |
|
|
|
190f2a |
struct block *
|
|
|
190f2a |
@@ -544,10 +544,11 @@ block_iterator_step (struct block_iterator *iterator, int first)
|
|
|
190f2a |
|
|
|
190f2a |
block = BLOCKVECTOR_BLOCK (COMPUNIT_BLOCKVECTOR (cust),
|
|
|
190f2a |
iterator->which);
|
|
|
190f2a |
- sym = dict_iterator_first (BLOCK_DICT (block), &iterator->dict_iter);
|
|
|
190f2a |
+ sym = mdict_iterator_first (BLOCK_MULTIDICT (block),
|
|
|
190f2a |
+ &iterator->mdict_iter);
|
|
|
190f2a |
}
|
|
|
190f2a |
else
|
|
|
190f2a |
- sym = dict_iterator_next (&iterator->dict_iter);
|
|
|
190f2a |
+ sym = mdict_iterator_next (&iterator->mdict_iter);
|
|
|
190f2a |
|
|
|
190f2a |
if (sym != NULL)
|
|
|
190f2a |
return sym;
|
|
|
190f2a |
@@ -569,7 +570,7 @@ block_iterator_first (const struct block *block,
|
|
|
190f2a |
initialize_block_iterator (block, iterator);
|
|
|
190f2a |
|
|
|
190f2a |
if (iterator->which == FIRST_LOCAL_BLOCK)
|
|
|
190f2a |
- return dict_iterator_first (block->dict, &iterator->dict_iter);
|
|
|
190f2a |
+ return mdict_iterator_first (block->multidict, &iterator->mdict_iter);
|
|
|
190f2a |
|
|
|
190f2a |
return block_iterator_step (iterator, 1);
|
|
|
190f2a |
}
|
|
|
190f2a |
@@ -580,7 +581,7 @@ struct symbol *
|
|
|
190f2a |
block_iterator_next (struct block_iterator *iterator)
|
|
|
190f2a |
{
|
|
|
190f2a |
if (iterator->which == FIRST_LOCAL_BLOCK)
|
|
|
190f2a |
- return dict_iterator_next (&iterator->dict_iter);
|
|
|
190f2a |
+ return mdict_iterator_next (&iterator->mdict_iter);
|
|
|
190f2a |
|
|
|
190f2a |
return block_iterator_step (iterator, 0);
|
|
|
190f2a |
}
|
|
|
190f2a |
@@ -612,11 +613,11 @@ block_iter_match_step (struct block_iterator *iterator,
|
|
|
190f2a |
|
|
|
190f2a |
block = BLOCKVECTOR_BLOCK (COMPUNIT_BLOCKVECTOR (cust),
|
|
|
190f2a |
iterator->which);
|
|
|
190f2a |
- sym = dict_iter_match_first (BLOCK_DICT (block), name,
|
|
|
190f2a |
- &iterator->dict_iter);
|
|
|
190f2a |
+ sym = mdict_iter_match_first (BLOCK_MULTIDICT (block), name,
|
|
|
190f2a |
+ &iterator->mdict_iter);
|
|
|
190f2a |
}
|
|
|
190f2a |
else
|
|
|
190f2a |
- sym = dict_iter_match_next (name, &iterator->dict_iter);
|
|
|
190f2a |
+ sym = mdict_iter_match_next (name, &iterator->mdict_iter);
|
|
|
190f2a |
|
|
|
190f2a |
if (sym != NULL)
|
|
|
190f2a |
return sym;
|
|
|
190f2a |
@@ -639,7 +640,8 @@ block_iter_match_first (const struct block *block,
|
|
|
190f2a |
initialize_block_iterator (block, iterator);
|
|
|
190f2a |
|
|
|
190f2a |
if (iterator->which == FIRST_LOCAL_BLOCK)
|
|
|
190f2a |
- return dict_iter_match_first (block->dict, name, &iterator->dict_iter);
|
|
|
190f2a |
+ return mdict_iter_match_first (block->multidict, name,
|
|
|
190f2a |
+ &iterator->mdict_iter);
|
|
|
190f2a |
|
|
|
190f2a |
return block_iter_match_step (iterator, name, 1);
|
|
|
190f2a |
}
|
|
|
190f2a |
@@ -651,7 +653,7 @@ block_iter_match_next (const lookup_name_info &name,
|
|
|
190f2a |
struct block_iterator *iterator)
|
|
|
190f2a |
{
|
|
|
190f2a |
if (iterator->which == FIRST_LOCAL_BLOCK)
|
|
|
190f2a |
- return dict_iter_match_next (name, &iterator->dict_iter);
|
|
|
190f2a |
+ return mdict_iter_match_next (name, &iterator->mdict_iter);
|
|
|
190f2a |
|
|
|
190f2a |
return block_iter_match_step (iterator, name, 0);
|
|
|
190f2a |
}
|
|
|
190f2a |
@@ -731,7 +733,7 @@ block_lookup_symbol_primary (const struct block *block, const char *name,
|
|
|
190f2a |
const domain_enum domain)
|
|
|
190f2a |
{
|
|
|
190f2a |
struct symbol *sym, *other;
|
|
|
190f2a |
- struct dict_iterator dict_iter;
|
|
|
190f2a |
+ struct mdict_iterator mdict_iter;
|
|
|
190f2a |
|
|
|
190f2a |
lookup_name_info lookup_name (name, symbol_name_match_type::FULL);
|
|
|
190f2a |
|
|
|
190f2a |
@@ -740,9 +742,10 @@ block_lookup_symbol_primary (const struct block *block, const char *name,
|
|
|
190f2a |
|| BLOCK_SUPERBLOCK (BLOCK_SUPERBLOCK (block)) == NULL);
|
|
|
190f2a |
|
|
|
190f2a |
other = NULL;
|
|
|
190f2a |
- for (sym = dict_iter_match_first (block->dict, lookup_name, &dict_iter);
|
|
|
190f2a |
+ for (sym
|
|
|
190f2a |
+ = mdict_iter_match_first (block->multidict, lookup_name, &mdict_iter);
|
|
|
190f2a |
sym != NULL;
|
|
|
190f2a |
- sym = dict_iter_match_next (lookup_name, &dict_iter))
|
|
|
190f2a |
+ sym = mdict_iter_match_next (lookup_name, &mdict_iter))
|
|
|
190f2a |
{
|
|
|
190f2a |
if (SYMBOL_DOMAIN (sym) == domain)
|
|
|
190f2a |
return sym;
|
|
|
190f2a |
diff --git a/gdb/block.h b/gdb/block.h
|
|
|
190f2a |
--- a/gdb/block.h
|
|
|
190f2a |
+++ b/gdb/block.h
|
|
|
190f2a |
@@ -111,7 +111,7 @@ struct block
|
|
|
190f2a |
|
|
|
190f2a |
/* This is used to store the symbols in the block. */
|
|
|
190f2a |
|
|
|
190f2a |
- struct dictionary *dict;
|
|
|
190f2a |
+ struct multidictionary *multidict;
|
|
|
190f2a |
|
|
|
190f2a |
/* Contains information about namespace-related info relevant to this block:
|
|
|
190f2a |
using directives and the current namespace scope. */
|
|
|
190f2a |
@@ -143,7 +143,7 @@ struct global_block
|
|
|
190f2a |
#define BLOCK_END(bl) (bl)->endaddr
|
|
|
190f2a |
#define BLOCK_FUNCTION(bl) (bl)->function
|
|
|
190f2a |
#define BLOCK_SUPERBLOCK(bl) (bl)->superblock
|
|
|
190f2a |
-#define BLOCK_DICT(bl) (bl)->dict
|
|
|
190f2a |
+#define BLOCK_MULTIDICT(bl) (bl)->multidict
|
|
|
190f2a |
#define BLOCK_NAMESPACE(bl) (bl)->namespace_info
|
|
|
190f2a |
|
|
|
190f2a |
/* Accessor for ranges field within block BL. */
|
|
|
190f2a |
@@ -298,9 +298,9 @@ struct block_iterator
|
|
|
190f2a |
|
|
|
190f2a |
enum block_enum which;
|
|
|
190f2a |
|
|
|
190f2a |
- /* The underlying dictionary iterator. */
|
|
|
190f2a |
+ /* The underlying multidictionary iterator. */
|
|
|
190f2a |
|
|
|
190f2a |
- struct dict_iterator dict_iter;
|
|
|
190f2a |
+ struct mdict_iterator mdict_iter;
|
|
|
190f2a |
};
|
|
|
190f2a |
|
|
|
190f2a |
/* Initialize ITERATOR to point at the first symbol in BLOCK, and
|
|
|
190f2a |
diff --git a/gdb/buildsym.c b/gdb/buildsym.c
|
|
|
190f2a |
--- a/gdb/buildsym.c
|
|
|
190f2a |
+++ b/gdb/buildsym.c
|
|
|
190f2a |
@@ -349,23 +349,21 @@ finish_block_internal (struct symbol *symbol,
|
|
|
190f2a |
|
|
|
190f2a |
if (symbol)
|
|
|
190f2a |
{
|
|
|
190f2a |
- BLOCK_DICT (block)
|
|
|
190f2a |
- = dict_create_linear (&objfile->objfile_obstack,
|
|
|
190f2a |
- buildsym_compunit->language, *listhead);
|
|
|
190f2a |
+ BLOCK_MULTIDICT (block)
|
|
|
190f2a |
+ = mdict_create_linear (&objfile->objfile_obstack, *listhead);
|
|
|
190f2a |
}
|
|
|
190f2a |
else
|
|
|
190f2a |
{
|
|
|
190f2a |
if (expandable)
|
|
|
190f2a |
{
|
|
|
190f2a |
- BLOCK_DICT (block)
|
|
|
190f2a |
- = dict_create_hashed_expandable (buildsym_compunit->language);
|
|
|
190f2a |
- dict_add_pending (BLOCK_DICT (block), *listhead);
|
|
|
190f2a |
+ BLOCK_MULTIDICT (block)
|
|
|
190f2a |
+ = mdict_create_hashed_expandable (buildsym_compunit->language);
|
|
|
190f2a |
+ mdict_add_pending (BLOCK_MULTIDICT (block), *listhead);
|
|
|
190f2a |
}
|
|
|
190f2a |
else
|
|
|
190f2a |
{
|
|
|
190f2a |
- BLOCK_DICT (block) =
|
|
|
190f2a |
- dict_create_hashed (&objfile->objfile_obstack,
|
|
|
190f2a |
- buildsym_compunit->language, *listhead);
|
|
|
190f2a |
+ BLOCK_MULTIDICT (block) =
|
|
|
190f2a |
+ mdict_create_hashed (&objfile->objfile_obstack, *listhead);
|
|
|
190f2a |
}
|
|
|
190f2a |
}
|
|
|
190f2a |
|
|
|
190f2a |
@@ -377,7 +375,7 @@ finish_block_internal (struct symbol *symbol,
|
|
|
190f2a |
if (symbol)
|
|
|
190f2a |
{
|
|
|
190f2a |
struct type *ftype = SYMBOL_TYPE (symbol);
|
|
|
190f2a |
- struct dict_iterator iter;
|
|
|
190f2a |
+ struct mdict_iterator miter;
|
|
|
190f2a |
SYMBOL_BLOCK_VALUE (symbol) = block;
|
|
|
190f2a |
BLOCK_FUNCTION (block) = symbol;
|
|
|
190f2a |
|
|
|
190f2a |
@@ -391,7 +389,7 @@ finish_block_internal (struct symbol *symbol,
|
|
|
190f2a |
|
|
|
190f2a |
/* Here we want to directly access the dictionary, because
|
|
|
190f2a |
we haven't fully initialized the block yet. */
|
|
|
190f2a |
- ALL_DICT_SYMBOLS (BLOCK_DICT (block), iter, sym)
|
|
|
190f2a |
+ ALL_DICT_SYMBOLS (BLOCK_MULTIDICT (block), miter, sym)
|
|
|
190f2a |
{
|
|
|
190f2a |
if (SYMBOL_IS_ARGUMENT (sym))
|
|
|
190f2a |
nparams++;
|
|
|
190f2a |
@@ -405,7 +403,7 @@ finish_block_internal (struct symbol *symbol,
|
|
|
190f2a |
iparams = 0;
|
|
|
190f2a |
/* Here we want to directly access the dictionary, because
|
|
|
190f2a |
we haven't fully initialized the block yet. */
|
|
|
190f2a |
- ALL_DICT_SYMBOLS (BLOCK_DICT (block), iter, sym)
|
|
|
190f2a |
+ ALL_DICT_SYMBOLS (BLOCK_MULTIDICT (block), miter, sym)
|
|
|
190f2a |
{
|
|
|
190f2a |
if (iparams == nparams)
|
|
|
190f2a |
break;
|
|
|
190f2a |
@@ -1448,7 +1446,7 @@ end_symtab_with_blockvector (struct block *static_block,
|
|
|
190f2a |
{
|
|
|
190f2a |
struct block *block = BLOCKVECTOR_BLOCK (blockvector, block_i);
|
|
|
190f2a |
struct symbol *sym;
|
|
|
190f2a |
- struct dict_iterator iter;
|
|
|
190f2a |
+ struct mdict_iterator miter;
|
|
|
190f2a |
|
|
|
190f2a |
/* Inlined functions may have symbols not in the global or
|
|
|
190f2a |
static symbol lists. */
|
|
|
190f2a |
@@ -1459,7 +1457,7 @@ end_symtab_with_blockvector (struct block *static_block,
|
|
|
190f2a |
/* Note that we only want to fix up symbols from the local
|
|
|
190f2a |
blocks, not blocks coming from included symtabs. That is why
|
|
|
190f2a |
we use ALL_DICT_SYMBOLS here and not ALL_BLOCK_SYMBOLS. */
|
|
|
190f2a |
- ALL_DICT_SYMBOLS (BLOCK_DICT (block), iter, sym)
|
|
|
190f2a |
+ ALL_DICT_SYMBOLS (BLOCK_MULTIDICT (block), miter, sym)
|
|
|
190f2a |
if (symbol_symtab (sym) == NULL)
|
|
|
190f2a |
symbol_set_symtab (sym, symtab);
|
|
|
190f2a |
}
|
|
|
190f2a |
@@ -1598,7 +1596,7 @@ augment_type_symtab (void)
|
|
|
190f2a |
to the primary symtab. */
|
|
|
190f2a |
set_missing_symtab (file_symbols, cust);
|
|
|
190f2a |
|
|
|
190f2a |
- dict_add_pending (BLOCK_DICT (block), file_symbols);
|
|
|
190f2a |
+ mdict_add_pending (BLOCK_MULTIDICT (block), file_symbols);
|
|
|
190f2a |
}
|
|
|
190f2a |
|
|
|
190f2a |
if (global_symbols != NULL)
|
|
|
190f2a |
@@ -1609,7 +1607,7 @@ augment_type_symtab (void)
|
|
|
190f2a |
to the primary symtab. */
|
|
|
190f2a |
set_missing_symtab (global_symbols, cust);
|
|
|
190f2a |
|
|
|
190f2a |
- dict_add_pending (BLOCK_DICT (block), global_symbols);
|
|
|
190f2a |
+ mdict_add_pending (BLOCK_MULTIDICT (block), global_symbols);
|
|
|
190f2a |
}
|
|
|
190f2a |
|
|
|
190f2a |
reset_symtab_globals ();
|
|
|
190f2a |
diff --git a/gdb/dictionary.h b/gdb/dictionary.h
|
|
|
190f2a |
--- a/gdb/dictionary.h
|
|
|
190f2a |
+++ b/gdb/dictionary.h
|
|
|
190f2a |
@@ -25,10 +25,10 @@
|
|
|
190f2a |
|
|
|
190f2a |
#include "symfile.h"
|
|
|
190f2a |
|
|
|
190f2a |
-/* An opaque type for dictionaries; only dictionary.c should know
|
|
|
190f2a |
- about its innards. */
|
|
|
190f2a |
+/* An opaque type for multi-language dictionaries; only dictionary.c should
|
|
|
190f2a |
+ know about its innards. */
|
|
|
190f2a |
|
|
|
190f2a |
-struct dictionary;
|
|
|
190f2a |
+struct multidictionary;
|
|
|
190f2a |
|
|
|
190f2a |
/* Other types needed for declarations. */
|
|
|
190f2a |
|
|
|
190f2a |
@@ -38,65 +38,64 @@ struct pending;
|
|
|
190f2a |
struct language_defn;
|
|
|
190f2a |
|
|
|
190f2a |
/* The creation functions for various implementations of
|
|
|
190f2a |
- dictionaries. */
|
|
|
190f2a |
+ multi-language dictionaries. */
|
|
|
190f2a |
|
|
|
190f2a |
-/* Create a dictionary of symbols of language LANGUAGE implemented via
|
|
|
190f2a |
+/* Create a multi-language dictionary of symbols implemented via
|
|
|
190f2a |
a fixed-size hashtable. All memory it uses is allocated on
|
|
|
190f2a |
OBSTACK; the environment is initialized from SYMBOL_LIST. */
|
|
|
190f2a |
|
|
|
190f2a |
-extern struct dictionary *dict_create_hashed (struct obstack *obstack,
|
|
|
190f2a |
- enum language language,
|
|
|
190f2a |
- const struct pending
|
|
|
190f2a |
- *symbol_list);
|
|
|
190f2a |
+extern struct multidictionary *
|
|
|
190f2a |
+ mdict_create_hashed (struct obstack *obstack,
|
|
|
190f2a |
+ const struct pending *symbol_list);
|
|
|
190f2a |
|
|
|
190f2a |
-/* Create a dictionary of symbols of language LANGUAGE, implemented
|
|
|
190f2a |
- via a hashtable that grows as necessary. The dictionary is
|
|
|
190f2a |
- initially empty; to add symbols to it, call dict_add_symbol().
|
|
|
190f2a |
- Call dict_free() when you're done with it. */
|
|
|
190f2a |
+/* Create a multi-language dictionary of symbols, implemented
|
|
|
190f2a |
+ via a hashtable that grows as necessary. The initial dictionary of
|
|
|
190f2a |
+ LANGUAGE is empty; to add symbols to it, call mdict_add_symbol().
|
|
|
190f2a |
+ Call mdict_free() when you're done with it. */
|
|
|
190f2a |
|
|
|
190f2a |
-extern struct dictionary *
|
|
|
190f2a |
- dict_create_hashed_expandable (enum language language);
|
|
|
190f2a |
+extern struct multidictionary *
|
|
|
190f2a |
+ mdict_create_hashed_expandable (enum language language);
|
|
|
190f2a |
|
|
|
190f2a |
-/* Create a dictionary of symbols of language LANGUAGE, implemented
|
|
|
190f2a |
+/* Create a multi-language dictionary of symbols, implemented
|
|
|
190f2a |
via a fixed-size array. All memory it uses is allocated on
|
|
|
190f2a |
OBSTACK; the environment is initialized from the SYMBOL_LIST. The
|
|
|
190f2a |
symbols are ordered in the same order that they're found in
|
|
|
190f2a |
SYMBOL_LIST. */
|
|
|
190f2a |
|
|
|
190f2a |
-extern struct dictionary *dict_create_linear (struct obstack *obstack,
|
|
|
190f2a |
- enum language language,
|
|
|
190f2a |
- const struct pending
|
|
|
190f2a |
- *symbol_list);
|
|
|
190f2a |
+extern struct multidictionary *
|
|
|
190f2a |
+ mdict_create_linear (struct obstack *obstack,
|
|
|
190f2a |
+ const struct pending *symbol_list);
|
|
|
190f2a |
|
|
|
190f2a |
-/* Create a dictionary of symbols of language LANGUAGE, implemented
|
|
|
190f2a |
- via an array that grows as necessary. The dictionary is initially
|
|
|
190f2a |
- empty; to add symbols to it, call dict_add_symbol(). Call
|
|
|
190f2a |
- dict_free() when you're done with it. */
|
|
|
190f2a |
+/* Create a multi-language dictionary of symbols, implemented
|
|
|
190f2a |
+ via an array that grows as necessary. The multidictionary initially
|
|
|
190f2a |
+ contains a single empty dictionary of LANGUAGE; to add symbols to it,
|
|
|
190f2a |
+ call mdict_add_symbol(). Call mdict_free() when you're done with it. */
|
|
|
190f2a |
|
|
|
190f2a |
-extern struct dictionary *
|
|
|
190f2a |
- dict_create_linear_expandable (enum language language);
|
|
|
190f2a |
+extern struct multidictionary *
|
|
|
190f2a |
+ mdict_create_linear_expandable (enum language language);
|
|
|
190f2a |
|
|
|
190f2a |
-/* The functions providing the interface to dictionaries. Note that
|
|
|
190f2a |
- the most common parts of the interface, namely symbol lookup, are
|
|
|
190f2a |
- only provided via iterator functions. */
|
|
|
190f2a |
+/* The functions providing the interface to multi-language dictionaries.
|
|
|
190f2a |
+ Note that the most common parts of the interface, namely symbol lookup,
|
|
|
190f2a |
+ are only provided via iterator functions. */
|
|
|
190f2a |
|
|
|
190f2a |
-/* Free the memory used by a dictionary that's not on an obstack. (If
|
|
|
190f2a |
+/* Free the memory used by a multidictionary that's not on an obstack. (If
|
|
|
190f2a |
any.) */
|
|
|
190f2a |
|
|
|
190f2a |
-extern void dict_free (struct dictionary *dict);
|
|
|
190f2a |
+extern void mdict_free (struct multidictionary *mdict);
|
|
|
190f2a |
|
|
|
190f2a |
-/* Add a symbol to an expandable dictionary. */
|
|
|
190f2a |
+/* Add a symbol to an expandable multidictionary. */
|
|
|
190f2a |
|
|
|
190f2a |
-extern void dict_add_symbol (struct dictionary *dict, struct symbol *sym);
|
|
|
190f2a |
+extern void mdict_add_symbol (struct multidictionary *mdict,
|
|
|
190f2a |
+ struct symbol *sym);
|
|
|
190f2a |
|
|
|
190f2a |
-/* Utility to add a list of symbols to a dictionary. */
|
|
|
190f2a |
+/* Utility to add a list of symbols to a multidictionary. */
|
|
|
190f2a |
|
|
|
190f2a |
-extern void dict_add_pending (struct dictionary *dict,
|
|
|
190f2a |
- const struct pending *symbol_list);
|
|
|
190f2a |
+extern void mdict_add_pending (struct multidictionary *mdict,
|
|
|
190f2a |
+ const struct pending *symbol_list);
|
|
|
190f2a |
|
|
|
190f2a |
-/* Is the dictionary empty? */
|
|
|
190f2a |
+/* Is the multidictionary empty? */
|
|
|
190f2a |
|
|
|
190f2a |
-extern int dict_empty (struct dictionary *dict);
|
|
|
190f2a |
+extern int mdict_empty (struct multidictionary *mdict);
|
|
|
190f2a |
|
|
|
190f2a |
/* A type containing data that is used when iterating over all symbols
|
|
|
190f2a |
in a dictionary. Don't ever look at its innards; this type would
|
|
|
190f2a |
@@ -128,44 +127,46 @@ struct mdict_iterator
|
|
|
190f2a |
unsigned short current_idx;
|
|
|
190f2a |
};
|
|
|
190f2a |
|
|
|
190f2a |
-/* Initialize ITERATOR to point at the first symbol in DICT, and
|
|
|
190f2a |
- return that first symbol, or NULL if DICT is empty. */
|
|
|
190f2a |
+/* Initialize ITERATOR to point at the first symbol in MDICT, and
|
|
|
190f2a |
+ return that first symbol, or NULL if MDICT is empty. */
|
|
|
190f2a |
|
|
|
190f2a |
-extern struct symbol *dict_iterator_first (const struct dictionary *dict,
|
|
|
190f2a |
- struct dict_iterator *iterator);
|
|
|
190f2a |
+extern struct symbol *
|
|
|
190f2a |
+ mdict_iterator_first (const struct multidictionary *mdict,
|
|
|
190f2a |
+ struct mdict_iterator *miterator);
|
|
|
190f2a |
|
|
|
190f2a |
-/* Advance ITERATOR, and return the next symbol, or NULL if there are
|
|
|
190f2a |
+/* Advance MITERATOR, and return the next symbol, or NULL if there are
|
|
|
190f2a |
no more symbols. Don't call this if you've previously received
|
|
|
190f2a |
- NULL from dict_iterator_first or dict_iterator_next on this
|
|
|
190f2a |
+ NULL from mdict_iterator_first or mdict_iterator_next on this
|
|
|
190f2a |
iteration. */
|
|
|
190f2a |
|
|
|
190f2a |
-extern struct symbol *dict_iterator_next (struct dict_iterator *iterator);
|
|
|
190f2a |
+extern struct symbol *mdict_iterator_next (struct mdict_iterator *miterator);
|
|
|
190f2a |
|
|
|
190f2a |
-/* Initialize ITERATOR to point at the first symbol in DICT whose
|
|
|
190f2a |
+/* Initialize MITERATOR to point at the first symbol in MDICT whose
|
|
|
190f2a |
SYMBOL_SEARCH_NAME is NAME, as tested using COMPARE (which must use
|
|
|
190f2a |
the same conventions as strcmp_iw and be compatible with any
|
|
|
190f2a |
dictionary hashing function), and return that first symbol, or NULL
|
|
|
190f2a |
if there are no such symbols. */
|
|
|
190f2a |
|
|
|
190f2a |
-extern struct symbol *dict_iter_match_first (const struct dictionary *dict,
|
|
|
190f2a |
- const lookup_name_info &name,
|
|
|
190f2a |
- struct dict_iterator *iterator);
|
|
|
190f2a |
+extern struct symbol *
|
|
|
190f2a |
+ mdict_iter_match_first (const struct multidictionary *mdict,
|
|
|
190f2a |
+ const lookup_name_info &name,
|
|
|
190f2a |
+ struct mdict_iterator *miterator);
|
|
|
190f2a |
|
|
|
190f2a |
-/* Advance ITERATOR to point at the next symbol in DICT whose
|
|
|
190f2a |
+/* Advance MITERATOR to point at the next symbol in MDICT whose
|
|
|
190f2a |
SYMBOL_SEARCH_NAME is NAME, as tested using COMPARE (see
|
|
|
190f2a |
dict_iter_match_first), or NULL if there are no more such symbols.
|
|
|
190f2a |
Don't call this if you've previously received NULL from
|
|
|
190f2a |
- dict_iterator_match_first or dict_iterator_match_next on this
|
|
|
190f2a |
- iteration. And don't call it unless ITERATOR was created by a
|
|
|
190f2a |
- previous call to dict_iter_match_first with the same NAME and COMPARE. */
|
|
|
190f2a |
+ mdict_iterator_match_first or mdict_iterator_match_next on this
|
|
|
190f2a |
+ iteration. And don't call it unless MITERATOR was created by a
|
|
|
190f2a |
+ previous call to mdict_iter_match_first with the same NAME and COMPARE. */
|
|
|
190f2a |
|
|
|
190f2a |
-extern struct symbol *dict_iter_match_next (const lookup_name_info &name,
|
|
|
190f2a |
- struct dict_iterator *iterator);
|
|
|
190f2a |
+extern struct symbol *mdict_iter_match_next (const lookup_name_info &name,
|
|
|
190f2a |
+ struct mdict_iterator *miterator);
|
|
|
190f2a |
|
|
|
190f2a |
-/* Return some notion of the size of the dictionary: the number of
|
|
|
190f2a |
+/* Return some notion of the size of the multidictionary: the number of
|
|
|
190f2a |
symbols if we have that, the number of hash buckets otherwise. */
|
|
|
190f2a |
|
|
|
190f2a |
-extern int dict_size (const struct dictionary *dict);
|
|
|
190f2a |
+extern int mdict_size (const struct multidictionary *mdict);
|
|
|
190f2a |
|
|
|
190f2a |
/* Macro to loop through all symbols in a dictionary DICT, in no
|
|
|
190f2a |
particular order. ITER is a struct dict_iterator (NOTE: __not__ a
|
|
|
190f2a |
@@ -175,8 +176,8 @@ extern int dict_size (const struct dictionary *dict);
|
|
|
190f2a |
early by a break if you desire. */
|
|
|
190f2a |
|
|
|
190f2a |
#define ALL_DICT_SYMBOLS(dict, iter, sym) \
|
|
|
190f2a |
- for ((sym) = dict_iterator_first ((dict), &(iter)); \
|
|
|
190f2a |
+ for ((sym) = mdict_iterator_first ((dict), &(iter)); \
|
|
|
190f2a |
(sym); \
|
|
|
190f2a |
- (sym) = dict_iterator_next (&(iter)))
|
|
|
190f2a |
+ (sym) = mdict_iterator_next (&(iter)))
|
|
|
190f2a |
|
|
|
190f2a |
#endif /* DICTIONARY_H */
|
|
|
190f2a |
diff --git a/gdb/jit.c b/gdb/jit.c
|
|
|
190f2a |
--- a/gdb/jit.c
|
|
|
190f2a |
+++ b/gdb/jit.c
|
|
|
190f2a |
@@ -651,14 +651,12 @@ finalize_symtab (struct gdb_symtab *stab, struct objfile *objfile)
|
|
|
190f2a |
size_t blockvector_size;
|
|
|
190f2a |
CORE_ADDR begin, end;
|
|
|
190f2a |
struct blockvector *bv;
|
|
|
190f2a |
- enum language language;
|
|
|
190f2a |
|
|
|
190f2a |
actual_nblocks = FIRST_LOCAL_BLOCK + stab->nblocks;
|
|
|
190f2a |
|
|
|
190f2a |
cust = allocate_compunit_symtab (objfile, stab->file_name);
|
|
|
190f2a |
allocate_symtab (cust, stab->file_name);
|
|
|
190f2a |
add_compunit_symtab_to_objfile (cust);
|
|
|
190f2a |
- language = compunit_language (cust);
|
|
|
190f2a |
|
|
|
190f2a |
/* JIT compilers compile in memory. */
|
|
|
190f2a |
COMPUNIT_DIRNAME (cust) = NULL;
|
|
|
190f2a |
@@ -702,8 +700,8 @@ finalize_symtab (struct gdb_symtab *stab, struct objfile *objfile)
|
|
|
190f2a |
TARGET_CHAR_BIT,
|
|
|
190f2a |
"void");
|
|
|
190f2a |
|
|
|
190f2a |
- BLOCK_DICT (new_block) = dict_create_linear (&objfile->objfile_obstack,
|
|
|
190f2a |
- language, NULL);
|
|
|
190f2a |
+ BLOCK_MULTIDICT (new_block)
|
|
|
190f2a |
+ = mdict_create_linear (&objfile->objfile_obstack, NULL);
|
|
|
190f2a |
/* The address range. */
|
|
|
190f2a |
BLOCK_START (new_block) = (CORE_ADDR) gdb_block_iter->begin;
|
|
|
190f2a |
BLOCK_END (new_block) = (CORE_ADDR) gdb_block_iter->end;
|
|
|
190f2a |
@@ -740,8 +738,8 @@ finalize_symtab (struct gdb_symtab *stab, struct objfile *objfile)
|
|
|
190f2a |
new_block = (i == GLOBAL_BLOCK
|
|
|
190f2a |
? allocate_global_block (&objfile->objfile_obstack)
|
|
|
190f2a |
: allocate_block (&objfile->objfile_obstack));
|
|
|
190f2a |
- BLOCK_DICT (new_block) = dict_create_linear (&objfile->objfile_obstack,
|
|
|
190f2a |
- language, NULL);
|
|
|
190f2a |
+ BLOCK_MULTIDICT (new_block)
|
|
|
190f2a |
+ = mdict_create_linear (&objfile->objfile_obstack, NULL);
|
|
|
190f2a |
BLOCK_SUPERBLOCK (new_block) = block_iter;
|
|
|
190f2a |
block_iter = new_block;
|
|
|
190f2a |
|
|
|
190f2a |
diff --git a/gdb/mdebugread.c b/gdb/mdebugread.c
|
|
|
190f2a |
--- a/gdb/mdebugread.c
|
|
|
190f2a |
+++ b/gdb/mdebugread.c
|
|
|
190f2a |
@@ -4534,7 +4534,7 @@ static void
|
|
|
190f2a |
add_symbol (struct symbol *s, struct symtab *symtab, struct block *b)
|
|
|
190f2a |
{
|
|
|
190f2a |
symbol_set_symtab (s, symtab);
|
|
|
190f2a |
- dict_add_symbol (BLOCK_DICT (b), s);
|
|
|
190f2a |
+ mdict_add_symbol (BLOCK_MULTIDICT (b), s);
|
|
|
190f2a |
}
|
|
|
190f2a |
|
|
|
190f2a |
/* Add a new block B to a symtab S. */
|
|
|
190f2a |
@@ -4762,7 +4762,7 @@ new_bvect (int nblocks)
|
|
|
190f2a |
}
|
|
|
190f2a |
|
|
|
190f2a |
/* Allocate and zero a new block of language LANGUAGE, and set its
|
|
|
190f2a |
- BLOCK_DICT. If function is non-zero, assume the block is
|
|
|
190f2a |
+ BLOCK_MULTIDICT. If function is non-zero, assume the block is
|
|
|
190f2a |
associated to a function, and make sure that the symbols are stored
|
|
|
190f2a |
linearly; otherwise, store them hashed. */
|
|
|
190f2a |
|
|
|
190f2a |
@@ -4775,9 +4775,9 @@ new_block (enum block_type type, enum language language)
|
|
|
190f2a |
struct block *retval = XCNEW (struct block);
|
|
|
190f2a |
|
|
|
190f2a |
if (type == FUNCTION_BLOCK)
|
|
|
190f2a |
- BLOCK_DICT (retval) = dict_create_linear_expandable (language);
|
|
|
190f2a |
+ BLOCK_MULTIDICT (retval) = mdict_create_linear_expandable (language);
|
|
|
190f2a |
else
|
|
|
190f2a |
- BLOCK_DICT (retval) = dict_create_hashed_expandable (language);
|
|
|
190f2a |
+ BLOCK_MULTIDICT (retval) = mdict_create_hashed_expandable (language);
|
|
|
190f2a |
|
|
|
190f2a |
return retval;
|
|
|
190f2a |
}
|
|
|
190f2a |
diff --git a/gdb/objfiles.c b/gdb/objfiles.c
|
|
|
190f2a |
--- a/gdb/objfiles.c
|
|
|
190f2a |
+++ b/gdb/objfiles.c
|
|
|
190f2a |
@@ -813,40 +813,40 @@ objfile_relocate1 (struct objfile *objfile,
|
|
|
190f2a |
}
|
|
|
190f2a |
|
|
|
190f2a |
ALL_OBJFILE_COMPUNITS (objfile, cust)
|
|
|
190f2a |
- {
|
|
|
190f2a |
- const struct blockvector *bv = COMPUNIT_BLOCKVECTOR (cust);
|
|
|
190f2a |
- int block_line_section = COMPUNIT_BLOCK_LINE_SECTION (cust);
|
|
|
190f2a |
-
|
|
|
190f2a |
- if (BLOCKVECTOR_MAP (bv))
|
|
|
190f2a |
- addrmap_relocate (BLOCKVECTOR_MAP (bv),
|
|
|
190f2a |
- ANOFFSET (delta, block_line_section));
|
|
|
190f2a |
-
|
|
|
190f2a |
- for (i = 0; i < BLOCKVECTOR_NBLOCKS (bv); ++i)
|
|
|
190f2a |
- {
|
|
|
190f2a |
- struct block *b;
|
|
|
190f2a |
- struct symbol *sym;
|
|
|
190f2a |
- struct dict_iterator iter;
|
|
|
190f2a |
-
|
|
|
190f2a |
- b = BLOCKVECTOR_BLOCK (bv, i);
|
|
|
190f2a |
- BLOCK_START (b) += ANOFFSET (delta, block_line_section);
|
|
|
190f2a |
- BLOCK_END (b) += ANOFFSET (delta, block_line_section);
|
|
|
190f2a |
-
|
|
|
190f2a |
- if (BLOCK_RANGES (b) != nullptr)
|
|
|
190f2a |
- for (int j = 0; j < BLOCK_NRANGES (b); j++)
|
|
|
190f2a |
+ {
|
|
|
190f2a |
+ const struct blockvector *bv = COMPUNIT_BLOCKVECTOR (cust);
|
|
|
190f2a |
+ int block_line_section = COMPUNIT_BLOCK_LINE_SECTION (cust);
|
|
|
190f2a |
+
|
|
|
190f2a |
+ if (BLOCKVECTOR_MAP (bv))
|
|
|
190f2a |
+ addrmap_relocate (BLOCKVECTOR_MAP (bv),
|
|
|
190f2a |
+ ANOFFSET (delta, block_line_section));
|
|
|
190f2a |
+
|
|
|
190f2a |
+ for (int i = 0; i < BLOCKVECTOR_NBLOCKS (bv); ++i)
|
|
|
190f2a |
+ {
|
|
|
190f2a |
+ struct block *b;
|
|
|
190f2a |
+ struct symbol *sym;
|
|
|
190f2a |
+ struct mdict_iterator miter;
|
|
|
190f2a |
+
|
|
|
190f2a |
+ b = BLOCKVECTOR_BLOCK (bv, i);
|
|
|
190f2a |
+ BLOCK_START (b) += ANOFFSET (delta, block_line_section);
|
|
|
190f2a |
+ BLOCK_END (b) += ANOFFSET (delta, block_line_section);
|
|
|
190f2a |
+
|
|
|
190f2a |
+ if (BLOCK_RANGES (b) != nullptr)
|
|
|
190f2a |
+ for (int j = 0; j < BLOCK_NRANGES (b); j++)
|
|
|
190f2a |
+ {
|
|
|
190f2a |
+ BLOCK_RANGE_START (b, j)
|
|
|
190f2a |
+ += ANOFFSET (delta, block_line_section);
|
|
|
190f2a |
+ BLOCK_RANGE_END (b, j) += ANOFFSET (delta, block_line_section);
|
|
|
190f2a |
+ }
|
|
|
190f2a |
+
|
|
|
190f2a |
+ /* We only want to iterate over the local symbols, not any
|
|
|
190f2a |
+ symbols in included symtabs. */
|
|
|
190f2a |
+ ALL_DICT_SYMBOLS (BLOCK_MULTIDICT (b), miter, sym)
|
|
|
190f2a |
{
|
|
|
190f2a |
- BLOCK_RANGE_START (b, j)
|
|
|
190f2a |
- += ANOFFSET (delta, block_line_section);
|
|
|
190f2a |
- BLOCK_RANGE_END (b, j) += ANOFFSET (delta, block_line_section);
|
|
|
190f2a |
+ relocate_one_symbol (sym, objfile, delta);
|
|
|
190f2a |
}
|
|
|
190f2a |
-
|
|
|
190f2a |
- /* We only want to iterate over the local symbols, not any
|
|
|
190f2a |
- symbols in included symtabs. */
|
|
|
190f2a |
- ALL_DICT_SYMBOLS (BLOCK_DICT (b), iter, sym)
|
|
|
190f2a |
- {
|
|
|
190f2a |
- relocate_one_symbol (sym, objfile, delta);
|
|
|
190f2a |
- }
|
|
|
190f2a |
- }
|
|
|
190f2a |
- }
|
|
|
190f2a |
+ }
|
|
|
190f2a |
+ }
|
|
|
190f2a |
}
|
|
|
190f2a |
|
|
|
190f2a |
/* Relocate isolated symbols. */
|
|
|
190f2a |
diff --git a/gdb/symmisc.c b/gdb/symmisc.c
|
|
|
190f2a |
--- a/gdb/symmisc.c
|
|
|
190f2a |
+++ b/gdb/symmisc.c
|
|
|
190f2a |
@@ -275,7 +275,7 @@ dump_symtab_1 (struct symtab *symtab, struct ui_file *outfile)
|
|
|
190f2a |
struct objfile *objfile = SYMTAB_OBJFILE (symtab);
|
|
|
190f2a |
struct gdbarch *gdbarch = get_objfile_arch (objfile);
|
|
|
190f2a |
int i;
|
|
|
190f2a |
- struct dict_iterator iter;
|
|
|
190f2a |
+ struct mdict_iterator miter;
|
|
|
190f2a |
int len;
|
|
|
190f2a |
struct linetable *l;
|
|
|
190f2a |
const struct blockvector *bv;
|
|
|
190f2a |
@@ -331,7 +331,7 @@ dump_symtab_1 (struct symtab *symtab, struct ui_file *outfile)
|
|
|
190f2a |
even if we're using a hashtable, but nothing else but this message
|
|
|
190f2a |
wants it. */
|
|
|
190f2a |
fprintf_filtered (outfile, ", %d syms/buckets in ",
|
|
|
190f2a |
- dict_size (BLOCK_DICT (b)));
|
|
|
190f2a |
+ mdict_size (BLOCK_MULTIDICT (b)));
|
|
|
190f2a |
fputs_filtered (paddress (gdbarch, BLOCK_START (b)), outfile);
|
|
|
190f2a |
fprintf_filtered (outfile, "..");
|
|
|
190f2a |
fputs_filtered (paddress (gdbarch, BLOCK_END (b)), outfile);
|
|
|
190f2a |
@@ -349,7 +349,7 @@ dump_symtab_1 (struct symtab *symtab, struct ui_file *outfile)
|
|
|
190f2a |
/* Now print each symbol in this block (in no particular order, if
|
|
|
190f2a |
we're using a hashtable). Note that we only want this
|
|
|
190f2a |
block, not any blocks from included symtabs. */
|
|
|
190f2a |
- ALL_DICT_SYMBOLS (BLOCK_DICT (b), iter, sym)
|
|
|
190f2a |
+ ALL_DICT_SYMBOLS (BLOCK_MULTIDICT (b), miter, sym)
|
|
|
190f2a |
{
|
|
|
190f2a |
TRY
|
|
|
190f2a |
{
|