OSDN Git Service

* symtab.c (lookup_symbol): Demangle before lowercasing.
authorDaniel Jacobowitz <dan@debian.org>
Tue, 30 Jul 2002 15:42:07 +0000 (15:42 +0000)
committerDaniel Jacobowitz <dan@debian.org>
Tue, 30 Jul 2002 15:42:07 +0000 (15:42 +0000)
gdb/ChangeLog
gdb/symtab.c

index d57c4af..48dc32f 100644 (file)
@@ -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
index c72de44..e712063 100644 (file)
@@ -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;     
 }