From: Daniel Jacobowitz Date: Sun, 24 Aug 2003 16:45:31 +0000 (+0000) Subject: * gnu-v3-abi.c (gnuv3_baseclass_offset): Check whether X-Git-Tag: gdb_6_0-2003-10-04-release~86 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=75438a9c325c3520fcbadb9988dd2f0c98982d19;p=thirdparty%2Fbinutils-gdb.git * gnu-v3-abi.c (gnuv3_baseclass_offset): Check whether TYPE_VPTR_FIELDNO is valid. --- diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 9bae5a7723b..f3eee087c1e 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,8 @@ +2003-08-22 Daniel Jacobowitz + + * gnu-v3-abi.c (gnuv3_baseclass_offset): Check whether + TYPE_VPTR_FIELDNO is valid. + 2003-08-22 Daniel Jacobowitz From mainline: diff --git a/gdb/gnu-v3-abi.c b/gdb/gnu-v3-abi.c index bbfd1185201..36e98923233 100644 --- a/gdb/gnu-v3-abi.c +++ b/gdb/gnu-v3-abi.c @@ -412,10 +412,15 @@ gnuv3_baseclass_offset (struct type *type, int index, char *valaddr, v3 C++ ABI Section 2.4.I.2.b. Fortunately the ABI guarantees that the vtable pointer will be located at the beginning of the object, so we can bypass the casting. Verify that the TYPE_VPTR_FIELDNO is in fact at the - start of whichever baseclass it resides in, as a sanity measure. */ + start of whichever baseclass it resides in, as a sanity measure - iff + we have debugging information for that baseclass. */ vbasetype = TYPE_VPTR_BASETYPE (type); - if (TYPE_FIELD_BITPOS (vbasetype, TYPE_VPTR_FIELDNO (vbasetype)) != 0) + if (TYPE_VPTR_FIELDNO (vbasetype) < 0) + fill_in_vptr_fieldno (vbasetype); + + if (TYPE_VPTR_FIELDNO (vbasetype) >= 0 + && TYPE_FIELD_BITPOS (vbasetype, TYPE_VPTR_FIELDNO (vbasetype)) != 0) error ("Illegal vptr offset in class %s", TYPE_NAME (vbasetype) ? TYPE_NAME (vbasetype) : "");