This is the mail archive of the gdb-patches@sourceware.cygnus.com mailing list for the GDB project. See the GDB home page for more information.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

[PATCH] Demangling fixes


Hi.

The latest gdb snapshot gdb-4.17.86 has numerous failures in the
demangling tests. The enclosed patch fixes all but one demangle test failure
for me.

The problem was in libiberty/cplus-dem.c - the function 'demangle_prefix'
was being to greedy when working on a mangled name like
"__dt__11T5__pt__2_iFv" when demangling in 'arm' or 'hp' style. A simple
'if' block fixes the problem.

Enjoy.

Art Haas
==========================================
--- gdb-4.17.86/libiberty/cplus-dem.c.orig	Wed Feb 10 19:49:17 1999
+++ gdb-4.17.86/libiberty/cplus-dem.c	Mon Mar 15 10:45:43 1999
@@ -2237,13 +2237,16 @@
 	    }
 	  else
 	    {
-              const char *tmp;
               /* Look for the LAST occurrence of __, allowing names to have
                  the '__' sequence embedded in them.*/
-              while ((tmp = mystrstr (scan+2, "__")) != NULL)
-                scan = tmp;
-              if (*(scan + 2) == '\0')
-                success = 0;
+	      if (!(ARM_DEMANGLING || HP_DEMANGLING))
+		{
+		  const char *tmp;
+		  while ((tmp = mystrstr (scan+2, "__")) != NULL)
+		    scan = tmp;
+		}
+	      if (*(scan + 2) == '\0')
+		success = 0;
               else
                 demangle_function_name (work, mangled, declp, scan);
 	    }