From mboxrd@z Thu Jan 1 00:00:00 1970 From: ahaas@neosoft.com To: gdb-patches@cygnus.com Subject: [PATCH] Demangling fixes Date: Mon, 15 Mar 1999 09:25:00 -0000 Message-ID: <19990315112522.A22156@localhost.neosoft.com> X-SW-Source: 1999-03/msg00047.html Message-ID: <19990315092500.L22O2rTXzShh2pU5XMYvb7ZFyAN0eUnOtIebjqhsydk@z> 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); }