From: Daniel Jacobowitz Date: Tue, 30 Jul 2002 15:42:07 +0000 (+0000) Subject: * symtab.c (lookup_symbol): Demangle before lowercasing. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=729051e6cb1922c2cd7cd26a7dbf6d649f2f9820;p=binutils-gdb.git * symtab.c (lookup_symbol): Demangle before lowercasing. --- diff --git a/gdb/ChangeLog b/gdb/ChangeLog index d57c4af93cd..48dc32fc690 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,7 @@ +2002-07-30 Daniel Jacobowitz + + * symtab.c (lookup_symbol): Demangle before lowercasing. + 2002-07-30 Andrew Cagney * symtab.h: Replace #include "gdb_obstack.h" with opaque diff --git a/gdb/symtab.c b/gdb/symtab.c index c72de44f368..e7120635208 100644 --- a/gdb/symtab.c +++ b/gdb/symtab.c @@ -679,12 +679,27 @@ lookup_symbol (const char *name, const struct block *block, const namespace_enum namespace, int *is_a_field_of_this, struct symtab **symtab) { - char *modified_name = NULL; - char *modified_name2 = NULL; + char *demangled_name = NULL; + const char *modified_name = NULL; const char *mangled_name = NULL; int needtofreename = 0; struct symbol *returnval; + modified_name = name; + + /* If we are using C++ language, demangle the name before doing a lookup, so + we can always binary search. */ + if (current_language->la_language == language_cplus) + { + demangled_name = cplus_demangle (name, DMGL_ANSI | DMGL_PARAMS); + if (demangled_name) + { + mangled_name = name; + modified_name = demangled_name; + needtofreename = 1; + } + } + if (case_sensitivity == case_sensitive_off) { char *copy; @@ -697,26 +712,11 @@ lookup_symbol (const char *name, const struct block *block, copy[len] = 0; modified_name = copy; } - else - modified_name = (char *) name; - - /* If we are using C++ language, demangle the name before doing a lookup, so - we can always binary search. */ - if (current_language->la_language == language_cplus) - { - modified_name2 = cplus_demangle (modified_name, DMGL_ANSI | DMGL_PARAMS); - if (modified_name2) - { - mangled_name = name; - modified_name = modified_name2; - needtofreename = 1; - } - } returnval = lookup_symbol_aux (modified_name, mangled_name, block, namespace, is_a_field_of_this, symtab); if (needtofreename) - xfree (modified_name2); + xfree (demangled_name); return returnval; }