From: Jim Kingdon Date: Thu, 30 Sep 1993 22:14:03 +0000 (+0000) Subject: * c-typeprint.c (c_type_print_base, TYPE_FN_FIELD_STUB code): X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=4f9bddb4fc74a08b07269dac12bd279984c94d1c;p=binutils-gdb.git * c-typeprint.c (c_type_print_base, TYPE_FN_FIELD_STUB code): If demangled name lacks a colon, don't dump core. --- diff --git a/gdb/c-typeprint.c b/gdb/c-typeprint.c index c51e6078b01..fa4035b00ac 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);