2003-09-11 Elena Zannoni <ezannoni@redhat.com>
[deliverable/binutils-gdb.git] / gdb / gnu-v3-abi.c
index bbfd118520119b5fd9ff3e5d36a4853cd8b6efdb..b18e644796eda82da58c35be71ffa1c07a09c08f 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>");
 
@@ -433,7 +438,7 @@ gnuv3_baseclass_offset (struct type *type, int index, char *valaddr,
 static void
 init_gnuv3_ops (void)
 {
-  vtable_type_gdbarch_data = register_gdbarch_data (build_gdb_vtable_type, 0);
+  vtable_type_gdbarch_data = register_gdbarch_data (build_gdb_vtable_type);
 
   gnu_v3_abi_ops.shortname = "gnu-v3";
   gnu_v3_abi_ops.longname = "GNU G++ Version 3 ABI";
This page took 0.02419 seconds and 4 git commands to generate.