aboutsummaryrefslogtreecommitdiff
path: root/gdb/cplus-dem.c
diff options
context:
space:
mode:
Diffstat (limited to 'gdb/cplus-dem.c')
-rw-r--r--gdb/cplus-dem.c17
1 files changed, 13 insertions, 4 deletions
diff --git a/gdb/cplus-dem.c b/gdb/cplus-dem.c
index e58a955..626b756 100644
--- a/gdb/cplus-dem.c
+++ b/gdb/cplus-dem.c
@@ -290,11 +290,20 @@ cplus_demangle (type, arg_mode)
/* destructor */
if (type[0] == '_' && type[1] == CPLUS_MARKER && type[2] == '_')
{
- int n = (strlen (type) - 3)*2 + 3 + 2 + 1;
- char *tem = (char *) xmalloc (n);
- strcpy (tem, type + 3);
+ int n;
+ char *tem;
+
+ type += 3; /* Get past _$_ at front. */
+ while (isdigit (*type))
+ /* If there are digits at the front, it's because
+ of new 2.0 name mangling. Just skip them. */
+ type++;
+
+ n = strlen (type)*2 + 3 + 2 + 1;
+ tem = (char *) xmalloc (n);
+ strcpy (tem, type);
strcat (tem, "::~");
- strcat (tem, type + 3);
+ strcat (tem, type);
if (print_arg_types)
strcat (tem, "()");
return tem;