|
|
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:26:59 -0500
|
|
|
190f2a |
Subject:
|
|
|
190f2a |
gdb-rhbz1560010-fix-assertion-symbol-language-dict-language-3of5.patch
|
|
|
190f2a |
|
|
|
190f2a |
;; Fix 'Assertion `SYMBOL_LANGUAGE (sym) == DICT_LANGUAGE (dict)->la_language' failed.'
|
|
|
190f2a |
;; Keith Seitz, RHBZ#1560010.
|
|
|
190f2a |
|
|
|
190f2a |
gdb/23712: Cleanup/Remove temporary dictionary functions
|
|
|
190f2a |
|
|
|
190f2a |
Now that multidictionary's are being used, there is no longer any need
|
|
|
190f2a |
to retain the four temporary functions introduced in the beginning of
|
|
|
190f2a |
this series.
|
|
|
190f2a |
|
|
|
190f2a |
This patch removes them.
|
|
|
190f2a |
|
|
|
190f2a |
As an additional cleanup, since the single-language dictionaries are
|
|
|
190f2a |
no longer used outside dictionary.c, make all of those functions
|
|
|
190f2a |
static.
|
|
|
190f2a |
|
|
|
190f2a |
gdb/ChangeLog:
|
|
|
190f2a |
|
|
|
190f2a |
PR gdb/23712
|
|
|
190f2a |
PR symtab/23010
|
|
|
190f2a |
* dictionary.c (pending_to_vector): Remove.
|
|
|
190f2a |
(dict_create_hashed_1, dict_create_linear_1, dict_add_pending_1):
|
|
|
190f2a |
Remove _1 suffix, replacing functions of the same name. Update
|
|
|
190f2a |
all callers.
|
|
|
190f2a |
(dict_create_hashed, dict_create_hashed_expandable)
|
|
|
190f2a |
(dict_create_linear, dict_create_linear_expandable, dict_free)
|
|
|
190f2a |
(dict_add_symbol, dict_add_pending, dict_size, dict_empty):
|
|
|
190f2a |
Make functions static.
|
|
|
190f2a |
|
|
|
190f2a |
diff --git a/gdb/dictionary.c b/gdb/dictionary.c
|
|
|
190f2a |
--- a/gdb/dictionary.c
|
|
|
190f2a |
+++ b/gdb/dictionary.c
|
|
|
190f2a |
@@ -342,31 +342,14 @@ static void insert_symbol_hashed (struct dictionary *dict,
|
|
|
190f2a |
|
|
|
190f2a |
static void expand_hashtable (struct dictionary *dict);
|
|
|
190f2a |
|
|
|
190f2a |
-/* A function to convert a linked list into a vector. */
|
|
|
190f2a |
-
|
|
|
190f2a |
-static std::vector<symbol *>
|
|
|
190f2a |
-pending_to_vector (const struct pending *symbol_list)
|
|
|
190f2a |
-{
|
|
|
190f2a |
- std::vector<symbol *> symlist;
|
|
|
190f2a |
-
|
|
|
190f2a |
- for (const struct pending *list_counter = symbol_list;
|
|
|
190f2a |
- list_counter != nullptr; list_counter = list_counter->next)
|
|
|
190f2a |
- {
|
|
|
190f2a |
- for (int i = list_counter->nsyms - 1; i >= 0; --i)
|
|
|
190f2a |
- symlist.push_back (list_counter->symbol[i]);
|
|
|
190f2a |
- }
|
|
|
190f2a |
-
|
|
|
190f2a |
- return symlist;
|
|
|
190f2a |
-}
|
|
|
190f2a |
-
|
|
|
190f2a |
/* The creation functions. */
|
|
|
190f2a |
|
|
|
190f2a |
-/* A function to transition dict_create_hashed to new API. */
|
|
|
190f2a |
+/* Create a hashed dictionary of a given language. */
|
|
|
190f2a |
|
|
|
190f2a |
static struct dictionary *
|
|
|
190f2a |
-dict_create_hashed_1 (struct obstack *obstack,
|
|
|
190f2a |
- enum language language,
|
|
|
190f2a |
- const std::vector<symbol *> &symbol_list)
|
|
|
190f2a |
+dict_create_hashed (struct obstack *obstack,
|
|
|
190f2a |
+ enum language language,
|
|
|
190f2a |
+ const std::vector<symbol *> &symbol_list)
|
|
|
190f2a |
{
|
|
|
190f2a |
/* Allocate the dictionary. */
|
|
|
190f2a |
struct dictionary *retval = XOBNEW (obstack, struct dictionary);
|
|
|
190f2a |
@@ -388,21 +371,9 @@ dict_create_hashed_1 (struct obstack *obstack,
|
|
|
190f2a |
return retval;
|
|
|
190f2a |
}
|
|
|
190f2a |
|
|
|
190f2a |
-/* See dictionary.h. */
|
|
|
190f2a |
-
|
|
|
190f2a |
-struct dictionary *
|
|
|
190f2a |
-dict_create_hashed (struct obstack *obstack,
|
|
|
190f2a |
- enum language language,
|
|
|
190f2a |
- const struct pending *symbol_list)
|
|
|
190f2a |
-{
|
|
|
190f2a |
- std::vector<symbol *> symlist = pending_to_vector (symbol_list);
|
|
|
190f2a |
-
|
|
|
190f2a |
- return dict_create_hashed_1 (obstack, language, symlist);
|
|
|
190f2a |
-}
|
|
|
190f2a |
+/* Create an expandable hashed dictionary of a given language. */
|
|
|
190f2a |
|
|
|
190f2a |
-/* See dictionary.h. */
|
|
|
190f2a |
-
|
|
|
190f2a |
-extern struct dictionary *
|
|
|
190f2a |
+static struct dictionary *
|
|
|
190f2a |
dict_create_hashed_expandable (enum language language)
|
|
|
190f2a |
{
|
|
|
190f2a |
struct dictionary *retval = XNEW (struct dictionary);
|
|
|
190f2a |
@@ -417,12 +388,12 @@ dict_create_hashed_expandable (enum language language)
|
|
|
190f2a |
return retval;
|
|
|
190f2a |
}
|
|
|
190f2a |
|
|
|
190f2a |
-/* A function to transition dict_create_linear to new API. */
|
|
|
190f2a |
+/* Create a linear dictionary of a given language. */
|
|
|
190f2a |
|
|
|
190f2a |
static struct dictionary *
|
|
|
190f2a |
-dict_create_linear_1 (struct obstack *obstack,
|
|
|
190f2a |
- enum language language,
|
|
|
190f2a |
- const std::vector<symbol *> &symbol_list)
|
|
|
190f2a |
+dict_create_linear (struct obstack *obstack,
|
|
|
190f2a |
+ enum language language,
|
|
|
190f2a |
+ const std::vector<symbol *> &symbol_list)
|
|
|
190f2a |
{
|
|
|
190f2a |
struct dictionary *retval = XOBNEW (obstack, struct dictionary);
|
|
|
190f2a |
DICT_VECTOR (retval) = &dict_linear_vector;
|
|
|
190f2a |
@@ -442,21 +413,9 @@ dict_create_linear_1 (struct obstack *obstack,
|
|
|
190f2a |
return retval;
|
|
|
190f2a |
}
|
|
|
190f2a |
|
|
|
190f2a |
-/* See dictionary.h. */
|
|
|
190f2a |
-
|
|
|
190f2a |
-struct dictionary *
|
|
|
190f2a |
-dict_create_linear (struct obstack *obstack,
|
|
|
190f2a |
- enum language language,
|
|
|
190f2a |
- const struct pending *symbol_list)
|
|
|
190f2a |
-{
|
|
|
190f2a |
- std::vector<symbol *> symlist = pending_to_vector (symbol_list);
|
|
|
190f2a |
-
|
|
|
190f2a |
- return dict_create_linear_1 (obstack, language, symlist);
|
|
|
190f2a |
-}
|
|
|
190f2a |
-
|
|
|
190f2a |
-/* See dictionary.h. */
|
|
|
190f2a |
+/* Create an expandable linear dictionary of a given language. */
|
|
|
190f2a |
|
|
|
190f2a |
-struct dictionary *
|
|
|
190f2a |
+static struct dictionary *
|
|
|
190f2a |
dict_create_linear_expandable (enum language language)
|
|
|
190f2a |
{
|
|
|
190f2a |
struct dictionary *retval = XNEW (struct dictionary);
|
|
|
190f2a |
@@ -476,7 +435,7 @@ dict_create_linear_expandable (enum language language)
|
|
|
190f2a |
/* Free the memory used by a dictionary that's not on an obstack. (If
|
|
|
190f2a |
any.) */
|
|
|
190f2a |
|
|
|
190f2a |
-void
|
|
|
190f2a |
+static void
|
|
|
190f2a |
dict_free (struct dictionary *dict)
|
|
|
190f2a |
{
|
|
|
190f2a |
(DICT_VECTOR (dict))->free (dict);
|
|
|
190f2a |
@@ -484,34 +443,24 @@ dict_free (struct dictionary *dict)
|
|
|
190f2a |
|
|
|
190f2a |
/* Add SYM to DICT. DICT had better be expandable. */
|
|
|
190f2a |
|
|
|
190f2a |
-void
|
|
|
190f2a |
+static void
|
|
|
190f2a |
dict_add_symbol (struct dictionary *dict, struct symbol *sym)
|
|
|
190f2a |
{
|
|
|
190f2a |
(DICT_VECTOR (dict))->add_symbol (dict, sym);
|
|
|
190f2a |
}
|
|
|
190f2a |
|
|
|
190f2a |
-/* A function to transition dict_add_pending to new API. */
|
|
|
190f2a |
+/* Utility to add a list of symbols to a dictionary.
|
|
|
190f2a |
+ DICT must be an expandable dictionary. */
|
|
|
190f2a |
|
|
|
190f2a |
static void
|
|
|
190f2a |
-dict_add_pending_1 (struct dictionary *dict,
|
|
|
190f2a |
- const std::vector<symbol *> &symbol_list)
|
|
|
190f2a |
+dict_add_pending (struct dictionary *dict,
|
|
|
190f2a |
+ const std::vector<symbol *> &symbol_list)
|
|
|
190f2a |
{
|
|
|
190f2a |
/* Preserve ordering by reversing the list. */
|
|
|
190f2a |
for (auto sym = symbol_list.rbegin (); sym != symbol_list.rend (); ++sym)
|
|
|
190f2a |
dict_add_symbol (dict, *sym);
|
|
|
190f2a |
}
|
|
|
190f2a |
|
|
|
190f2a |
-/* Utility to add a list of symbols to a dictionary.
|
|
|
190f2a |
- DICT must be an expandable dictionary. */
|
|
|
190f2a |
-
|
|
|
190f2a |
-void
|
|
|
190f2a |
-dict_add_pending (struct dictionary *dict, const struct pending *symbol_list)
|
|
|
190f2a |
-{
|
|
|
190f2a |
- std::vector<symbol *> symlist = pending_to_vector (symbol_list);
|
|
|
190f2a |
-
|
|
|
190f2a |
- dict_add_pending_1 (dict, symlist);
|
|
|
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 |
|
|
|
190f2a |
@@ -548,7 +497,7 @@ dict_iter_match_next (const lookup_name_info &name,
|
|
|
190f2a |
->iter_match_next (name, iterator);
|
|
|
190f2a |
}
|
|
|
190f2a |
|
|
|
190f2a |
-int
|
|
|
190f2a |
+static int
|
|
|
190f2a |
dict_size (const struct dictionary *dict)
|
|
|
190f2a |
{
|
|
|
190f2a |
return (DICT_VECTOR (dict))->size (dict);
|
|
|
190f2a |
@@ -560,7 +509,7 @@ dict_size (const struct dictionary *dict)
|
|
|
190f2a |
|
|
|
190f2a |
/* Test to see if DICT is empty. */
|
|
|
190f2a |
|
|
|
190f2a |
-int
|
|
|
190f2a |
+static int
|
|
|
190f2a |
dict_empty (struct dictionary *dict)
|
|
|
190f2a |
{
|
|
|
190f2a |
struct dict_iterator iter;
|
|
|
190f2a |
@@ -1019,7 +968,7 @@ mdict_create_hashed (struct obstack *obstack,
|
|
|
190f2a |
std::vector<symbol *> symlist = pair.second;
|
|
|
190f2a |
|
|
|
190f2a |
retval->dictionaries[idx++]
|
|
|
190f2a |
- = dict_create_hashed_1 (obstack, language, symlist);
|
|
|
190f2a |
+ = dict_create_hashed (obstack, language, symlist);
|
|
|
190f2a |
}
|
|
|
190f2a |
|
|
|
190f2a |
return retval;
|
|
|
190f2a |
@@ -1064,7 +1013,7 @@ mdict_create_linear (struct obstack *obstack,
|
|
|
190f2a |
std::vector<symbol *> symlist = pair.second;
|
|
|
190f2a |
|
|
|
190f2a |
retval->dictionaries[idx++]
|
|
|
190f2a |
- = dict_create_linear_1 (obstack, language, symlist);
|
|
|
190f2a |
+ = dict_create_linear (obstack, language, symlist);
|
|
|
190f2a |
}
|
|
|
190f2a |
|
|
|
190f2a |
return retval;
|
|
|
190f2a |
@@ -1210,7 +1159,7 @@ mdict_add_pending (struct multidictionary *mdict,
|
|
|
190f2a |
dict = create_new_language_dictionary (mdict, language);
|
|
|
190f2a |
}
|
|
|
190f2a |
|
|
|
190f2a |
- dict_add_pending_1 (dict, symlist);
|
|
|
190f2a |
+ dict_add_pending (dict, symlist);
|
|
|
190f2a |
}
|
|
|
190f2a |
}
|
|
|
190f2a |
|