From edf67bd18137953e9258f07a3474052e595a7524 Mon Sep 17 00:00:00 2001 From: Michael Tiemann Date: Mon, 1 Feb 1993 01:11:17 +0000 Subject: [PATCH] * gdbtypes.c (fill_in_vptr_fieldno): Don't ignore the first baseclass--we don't always inherit its virtual function table pointer. --- gdb/ChangeLog | 4 ++++ gdb/gdbtypes.c | 14 ++++++++++---- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index a23403b324..7cdbd4035f 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,5 +1,9 @@ Sun Jan 31 04:32:48 1993 Michael Tiemann (tiemann@rtl.cygnus.com) + * gdbtypes.c (fill_in_vptr_fieldno): Don't ignore the first + baseclass--we don't always inherit its virtual function table + pointer. + * eval.c (evaluate_subexp): In OP_FUNCALL case, adjust `this' pointer correctly in case value_struct_elt moves it around. diff --git a/gdb/gdbtypes.c b/gdb/gdbtypes.c index 57871796fc..4be115d4fe 100644 --- a/gdb/gdbtypes.c +++ b/gdb/gdbtypes.c @@ -690,9 +690,9 @@ lookup_template_type (name, type, block) return (SYMBOL_TYPE (sym)); } -/* Given a type TYPE, lookup the type of the component of type named - NAME. - If NOERR is nonzero, return zero if NAME is not suitably defined. */ +/* Given a type TYPE, lookup the type of the component of type named NAME. + If NOERR is nonzero, return zero if NAME is not suitably defined. + If NAME is the name of a baseclass type, return that type. */ struct type * lookup_struct_elt_type (type, name, noerr) @@ -718,6 +718,9 @@ lookup_struct_elt_type (type, name, noerr) check_stub_type (type); + if (STREQ (type_name_no_tag (type), name)) + return type; + for (i = TYPE_NFIELDS (type) - 1; i >= TYPE_N_BASECLASSES (type); i--) { char *t_field_name = TYPE_FIELD_NAME (type, i); @@ -765,7 +768,10 @@ fill_in_vptr_fieldno (type) if (TYPE_VPTR_FIELDNO (type) < 0) { int i; - for (i = 1; i < TYPE_N_BASECLASSES (type); i++) + + /* We must start at zero in case the first (and only) baseclass is + virtual (and hence we cannot share the table pointer). */ + for (i = 0; i < TYPE_N_BASECLASSES (type); i++) { fill_in_vptr_fieldno (TYPE_BASECLASS (type, i)); if (TYPE_VPTR_FIELDNO (TYPE_BASECLASS (type, i)) >= 0)