]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
* gnu-v3-abi.c (gnuv3_baseclass_offset): Check whether
authorDaniel Jacobowitz <drow@false.org>
Sun, 24 Aug 2003 16:45:31 +0000 (16:45 +0000)
committerDaniel Jacobowitz <drow@false.org>
Sun, 24 Aug 2003 16:45:31 +0000 (16:45 +0000)
TYPE_VPTR_FIELDNO is valid.

gdb/ChangeLog
gdb/gnu-v3-abi.c

index 9bae5a7723b9f1cf8c816e6bc0672f0aac96961d..f3eee087c1e66ff672a6d55a4a34a9df3e864398 100644 (file)
@@ -1,3 +1,8 @@
+2003-08-22  Daniel Jacobowitz  <drow@mvista.com>
+
+       * gnu-v3-abi.c (gnuv3_baseclass_offset): Check whether
+       TYPE_VPTR_FIELDNO is valid.
+
 2003-08-22  Daniel Jacobowitz  <drow@mvista.com>
 
        From mainline:
index bbfd118520119b5fd9ff3e5d36a4853cd8b6efdb..36e989232333ae1a6af62d9406bab14e4f7758d7 100644 (file)
@@ -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) : "<unknown>");