aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJim Kingdon <jkingdon@engr.sgi.com>1993-09-30 22:14:03 +0000
committerJim Kingdon <jkingdon@engr.sgi.com>1993-09-30 22:14:03 +0000
commit4f9bddb4fc74a08b07269dac12bd279984c94d1c (patch)
treee10608a75e59b13c6412e0cbd4d5ffcf9e6ee1c9
parent763cfca018ba75dd1775dee33f253223f8bdbda7 (diff)
downloadgdb-4f9bddb4fc74a08b07269dac12bd279984c94d1c.zip
gdb-4f9bddb4fc74a08b07269dac12bd279984c94d1c.tar.gz
gdb-4f9bddb4fc74a08b07269dac12bd279984c94d1c.tar.bz2
* c-typeprint.c (c_type_print_base, TYPE_FN_FIELD_STUB code):
If demangled name lacks a colon, don't dump core.
-rw-r--r--gdb/c-typeprint.c21
1 files 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, "<badly mangled name %s>",
- 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);