From 4f9bddb4fc74a08b07269dac12bd279984c94d1c Mon Sep 17 00:00:00 2001 From: Jim Kingdon Date: Thu, 30 Sep 1993 22:14:03 +0000 Subject: [PATCH] * c-typeprint.c (c_type_print_base, TYPE_FN_FIELD_STUB code): If demangled name lacks a colon, don't dump core. --- gdb/c-typeprint.c | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/gdb/c-typeprint.c b/gdb/c-typeprint.c index c51e607..fa4035b 100644 --- a/gdb/c-typeprint.c +++ b/gdb/c-typeprint.c @@ -680,15 +680,24 @@ c_type_print_base (type, stream, show, level) /* Build something we can demangle. */ mangled_name = gdb_mangle_name (type, i, j); demangled_name = - cplus_demangle (mangled_name, - DMGL_ANSI | DMGL_PARAMS); + cplus_demangle (mangled_name, + DMGL_ANSI | DMGL_PARAMS); if (demangled_name == NULL) fprintf_filtered (stream, "", - mangled_name); - else + mangled_name); + else { - fprintf_filtered (stream, "%s", - strchr (demangled_name, ':') + 2); + char *demangled_no_class = + strchr (demangled_name, ':'); + + if (demangled_no_class == NULL) + demangled_no_class = demangled_name; + else + { + if (*++demangled_no_class == ':') + ++demangled_no_class; + } + fputs_filtered (demangled_no_class, stream); free (demangled_name); } free (mangled_name); -- 2.7.4