opcodes error messages
[deliverable/binutils-gdb.git] / gdb / minsyms.c
index 123d466869dc9d5987a8c5169cd079c197042fc3..a55c0718fcb09720bf8c6e4a12499a99ee8811a6 100644 (file)
@@ -1,5 +1,5 @@
 /* GDB routines for manipulating the minimal symbol tables.
-   Copyright (C) 1992-2017 Free Software Foundation, Inc.
+   Copyright (C) 1992-2018 Free Software Foundation, Inc.
    Contributed by Cygnus Support, using pieces from other GDB modules.
 
    This file is part of GDB.
@@ -359,8 +359,8 @@ lookup_minimal_symbol (const char *name, const char *sfile,
                       % MINIMAL_SYMBOL_HASH_SIZE);
 
                  symbol_name_matcher_ftype *match
-                   = language_get_symbol_name_matcher (language_def (lang),
-                                                       lookup_name);
+                   = get_symbol_name_matcher (language_def (lang),
+                                              lookup_name);
                  struct minimal_symbol **msymbol_demangled_hash
                    = objfile->per_bfd->msymbol_demangled_hash;
 
@@ -447,6 +447,25 @@ find_minimal_symbol_address (const char *name, CORE_ADDR *addr,
   return sym.minsym == NULL;
 }
 
+/* Get the lookup name form best suitable for linkage name
+   matching.  */
+
+static const char *
+linkage_name_str (const lookup_name_info &lookup_name)
+{
+  /* Unlike most languages (including C++), Ada uses the
+     encoded/linkage name as the search name recorded in symbols.  So
+     if debugging in Ada mode, prefer the Ada-encoded name.  This also
+     makes Ada's verbatim match syntax ("<...>") work, because
+     "lookup_name.name()" includes the "<>"s, while
+     "lookup_name.ada().lookup_name()" is the encoded name with "<>"s
+     stripped.  */
+  if (current_language->la_language == language_ada)
+    return lookup_name.ada ().lookup_name ().c_str ();
+
+  return lookup_name.name ().c_str ();
+}
+
 /* See minsyms.h.  */
 
 void
@@ -459,7 +478,7 @@ iterate_over_minimal_symbols (struct objfile *objf,
 
   /* The first pass is over the ordinary hash table.  */
     {
-      const char *name = lookup_name.name ().c_str ();
+      const char *name = linkage_name_str (lookup_name);
       unsigned int hash = msymbol_hash (name) % MINIMAL_SYMBOL_HASH_SIZE;
       auto *mangled_cmp
        = (case_sensitivity == case_sensitive_on
@@ -482,7 +501,7 @@ iterate_over_minimal_symbols (struct objfile *objf,
     {
       const language_defn *lang_def = language_def (lang);
       symbol_name_matcher_ftype *name_match
-       = language_get_symbol_name_matcher (lang_def, lookup_name);
+       = get_symbol_name_matcher (lang_def, lookup_name);
 
       unsigned int hash
        = lookup_name.search_name_hash (lang) % MINIMAL_SYMBOL_HASH_SIZE;
This page took 0.024111 seconds and 4 git commands to generate.