summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Jacobowitz <dan@debian.org>2002-07-30 15:42:07 +0000
committerDaniel Jacobowitz <dan@debian.org>2002-07-30 15:42:07 +0000
commitf24e4ecfabbf2b6738c935d835cb7eb9f4b98d80 (patch)
treeb9288f080f2e28775aa3b2c3dc3226ee5b028a76
parent5e87bf63a95d5ff7099d265d1076b56dbdbf6622 (diff)
downloadgdb-f24e4ecfabbf2b6738c935d835cb7eb9f4b98d80.tar.gz
* symtab.c (lookup_symbol): Demangle before lowercasing.
-rw-r--r--gdb/ChangeLog4
-rw-r--r--gdb/symtab.c36
2 files changed, 22 insertions, 18 deletions
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 <drow@mvista.com>
+
+ * symtab.c (lookup_symbol): Demangle before lowercasing.
+
2002-07-30 Andrew Cagney <ac131313@redhat.com>
* 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;
}