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 patch #2


Hi.

After a bit of poking around, I was able to find and fix the remaining
error in the demangling tests. The test that failed was trying to
demangle

add__XTPfTFPd_f_FcT1

into

add<float *,float (double *)>(char, char)

The problem was the 'forgetting_types' field in the work structure was
never decremented, causing problems when remember_types() was called.

I'm resending the entire patch to 'cplus-dem.c' which cured the
demangling problems. The first part of it was sent earlier today (Mar 15),
the little bit on the end cures the bug above.

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 13:59:59 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);
 	    }
@@ -3893,6 +3896,7 @@
   if (work->previous_argument)
     string_delete (work->previous_argument);
   work->previous_argument = saved_previous_argument;
+  --work->forgetting_types;
   work->nrepeats = saved_nrepeats;
 
   return result;