/* 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.
% 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;
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
/* 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
{
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;