From e045712fa8d45749a371373646842eff87240163 Mon Sep 17 00:00:00 2001 From: Brendan Kehoe Date: Wed, 6 Dec 1995 02:34:53 +0000 Subject: [PATCH] * gdbtypes.c (check_stub_method): Make sure we get back a function string in the demangled name before we try to use it. fixes gdb/8306 (Mentor, ser/med) --- gdb/ChangeLog | 5 +++++ gdb/gdbtypes.c | 14 ++++++++------ 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 192996faf5a..fc9535be505 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,8 @@ +Tue Dec 5 18:33:43 1995 Brendan Kehoe + + * gdbtypes.c (check_stub_method): Make sure we get back a function + string in the demangled name before we try to use it. + Tue Dec 5 18:08:29 1995 Stu Grossman (grossman@cygnus.com) * monitor.c (monitor_expect_regexp): Make static, add prototype. diff --git a/gdb/gdbtypes.c b/gdb/gdbtypes.c index d023eede078..3cde087c861 100644 --- a/gdb/gdbtypes.c +++ b/gdb/gdbtypes.c @@ -974,14 +974,16 @@ check_stub_method (type, i, j) struct type **argtypes; struct type *mtype; - if (demangled_name == NULL) - { - error ("Internal: Cannot demangle mangled name `%s'.", mangled_name); - } + /* Make sure we got back a function string that we can use. */ + if (demangled_name) + p = strchr (demangled_name, '('); + + if (demangled_name == NULL || p == NULL) + error ("Internal: Cannot demangle mangled name `%s'.", mangled_name); /* Now, read in the parameters that define this type. */ - argtypetext = strchr (demangled_name, '(') + 1; - p = argtypetext; + p += 1; + argtypetext = p; while (*p) { if (*p == '(') -- 2.30.2