gdb/
authorJan Kratochvil <jan.kratochvil@redhat.com>
Thu, 31 Mar 2011 19:37:54 +0000 (19:37 +0000)
committerJan Kratochvil <jan.kratochvil@redhat.com>
Thu, 31 Mar 2011 19:37:54 +0000 (19:37 +0000)
* dwarf2read.c (dwarf2_name): Initialize DEMANGLED.  Avoid demangling
struct linkage name twice.

gdb/ChangeLog
gdb/dwarf2read.c

index cae0cd6c0a1da37c35e539033146c027579174fd..2476919b65fc0093b5980186174aec0c7021921e 100644 (file)
@@ -1,3 +1,8 @@
+2011-03-31  Jan Kratochvil  <jan.kratochvil@redhat.com>
+
+       * dwarf2read.c (dwarf2_name): Initialize DEMANGLED.  Avoid demangling
+       struct linkage name twice.
+
 2011-03-31  Tom Tromey  <tromey@redhat.com>
 
        * python/py-prettyprint.c (print_stack_unless_memory_error): Add
index df8f863583afcf9d4f1af1e29a261680ce45c05c..64c9da0feff53d679bc90fc59e9f17c0f1fcd0ed 100644 (file)
@@ -12043,7 +12043,7 @@ dwarf2_name (struct die_info *die, struct dwarf2_cu *cu)
         http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47510.  */
       if (!attr || DW_STRING (attr) == NULL)
        {
-         char *demangled;
+         char *demangled = NULL;
 
          attr = dwarf2_attr (die, DW_AT_linkage_name, cu);
          if (attr == NULL)
@@ -12052,7 +12052,10 @@ dwarf2_name (struct die_info *die, struct dwarf2_cu *cu)
          if (attr == NULL || DW_STRING (attr) == NULL)
            return NULL;
 
-         demangled = cplus_demangle (DW_STRING (attr), DMGL_TYPES);
+         /* Avoid demangling DW_STRING (attr) the second time on a second
+            call for the same DIE.  */
+         if (!DW_STRING_IS_CANONICAL (attr))
+           demangled = cplus_demangle (DW_STRING (attr), DMGL_TYPES);
 
          if (demangled)
            {