Fix powerpc-power8.exp test with new mnemonics
[deliverable/binutils-gdb.git] / gdb / dictionary.c
index 939f32b59afb0cf07d3d72dc7669d40115e7a2b3..e18582038c96fc785f45daad3e686666e2437632 100644 (file)
@@ -1,6 +1,6 @@
 /* Routines for name->symbol lookups in GDB.
    
-   Copyright (C) 2003-2019 Free Software Foundation, Inc.
+   Copyright (C) 2003-2021 Free Software Foundation, Inc.
 
    Contributed by David Carlton <carlton@bactrian.org> and by Kealia,
    Inc.
@@ -508,16 +508,6 @@ dict_size (const struct dictionary *dict)
    implemented generically by means of the vtable.  Typically, they're
    rarely used.  */
 
-/* Test to see if DICT is empty.  */
-
-static int
-dict_empty (struct dictionary *dict)
-{
-  struct dict_iterator iter;
-
-  return (dict_iterator_first (dict, &iter) == NULL);
-}
-
 
 /* The functions implementing the dictionary interface.  */
 
@@ -594,7 +584,7 @@ iter_match_first_hashed (const struct dictionary *dict,
   unsigned int hash_index = (name.search_name_hash (lang->la_language)
                             % DICT_HASHED_NBUCKETS (dict));
   symbol_name_matcher_ftype *matches_name
-    = get_symbol_name_matcher (lang, name);
+    = lang->get_symbol_name_matcher (name);
   struct symbol *sym;
 
   DICT_ITERATOR_DICT (iterator) = dict;
@@ -622,7 +612,7 @@ iter_match_next_hashed (const lookup_name_info &name,
 {
   const language_defn *lang = DICT_LANGUAGE (DICT_ITERATOR_DICT (iterator));
   symbol_name_matcher_ftype *matches_name
-    = get_symbol_name_matcher (lang, name);
+    = lang->get_symbol_name_matcher (name);
   struct symbol *next;
 
   for (next = DICT_ITERATOR_CURRENT (iterator)->hash_next;
@@ -650,9 +640,9 @@ insert_symbol_hashed (struct dictionary *dict,
 
   /* We don't want to insert a symbol into a dictionary of a different
      language.  The two may not use the same hashing algorithm.  */
-  gdb_assert (SYMBOL_LANGUAGE (sym) == DICT_LANGUAGE (dict)->la_language);
+  gdb_assert (sym->language () == DICT_LANGUAGE (dict)->la_language);
 
-  hash = search_name_hash (SYMBOL_LANGUAGE (sym), sym->search_name ());
+  hash = search_name_hash (sym->language (), sym->search_name ());
   hash_index = hash % DICT_HASHED_NBUCKETS (dict);
   sym->hash_next = buckets[hash_index];
   buckets[hash_index] = sym;
@@ -729,7 +719,7 @@ expand_hashtable (struct dictionary *dict)
 /* See dictionary.h.  */
 
 unsigned int
-default_search_name_hash (const char *string0)
+language_defn::search_name_hash (const char *string0) const
 {
   /* The Ada-encoded version of a name P1.P2...Pn has either the form
      P1__P2__...Pn<suffix> or _ada_P1__P2__...Pn<suffix> (where the Pi
@@ -771,6 +761,13 @@ default_search_name_hash (const char *string0)
            {
              int c = string[2];
 
+             if (c == 'B' && string[3] == '_')
+               {
+                 for (string += 4; ISDIGIT (*string); ++string)
+                   ;
+                 continue;
+               }
+
              if ((c < 'a' || c > 'z') && c != 'O')
                return hash;
              hash = 0;
@@ -838,7 +835,7 @@ iter_match_next_linear (const lookup_name_info &name,
   const struct dictionary *dict = DICT_ITERATOR_DICT (iterator);
   const language_defn *lang = DICT_LANGUAGE (dict);
   symbol_name_matcher_ftype *matches_name
-    = get_symbol_name_matcher (lang, name);
+    = lang->get_symbol_name_matcher (name);
 
   int i, nsyms = DICT_LINEAR_NSYMS (dict);
   struct symbol *sym, *retval = NULL;
@@ -938,7 +935,7 @@ collate_pending_symbols_by_language (const struct pending *symbol_list)
     {
       for (int i = list_counter->nsyms - 1; i >= 0; --i)
        {
-         enum language language = SYMBOL_LANGUAGE (list_counter->symbol[i]);
+         enum language language = list_counter->symbol[i]->language ();
          nsyms[language].push_back (list_counter->symbol[i]);
        }
     }
@@ -1126,13 +1123,13 @@ void
 mdict_add_symbol (struct multidictionary *mdict, struct symbol *sym)
 {
   struct dictionary *dict
-    = find_language_dictionary (mdict, SYMBOL_LANGUAGE (sym));
+    = find_language_dictionary (mdict, sym->language ());
 
   if (dict == nullptr)
     {
       /* SYM is of a new language that we haven't previously seen.
         Create a new dictionary for it.  */
-      dict = create_new_language_dictionary (mdict, SYMBOL_LANGUAGE (sym));
+      dict = create_new_language_dictionary (mdict, sym->language ());
     }
 
   dict_add_symbol (dict, sym);
@@ -1283,17 +1280,3 @@ mdict_size (const struct multidictionary *mdict)
 
   return size;
 }
-
-/* See dictionary.h.  */
-
-bool
-mdict_empty (const struct multidictionary *mdict)
-{
-  for (unsigned short idx = 0; idx < mdict->n_allocated_dictionaries; ++idx)
-    {
-      if (!dict_empty (mdict->dictionaries[idx]))
-       return false;
-    }
-
-  return true;
-}
This page took 0.025983 seconds and 4 git commands to generate.