summaryrefslogtreecommitdiff
path: root/gdb/gnu-v3-abi.c
diff options
context:
space:
mode:
authorDaniel Jacobowitz <dan@debian.org>2003-08-22 20:45:55 +0000
committerDaniel Jacobowitz <dan@debian.org>2003-08-22 20:45:55 +0000
commitd29e2a3e49349fbc90d921c1be66f85d0b9eb3f0 (patch)
tree003dd6f21a1823f519b985a425a337533dfbcb90 /gdb/gnu-v3-abi.c
parent135f7b15b07ae60167e1d561666c6531f8c69e80 (diff)
downloadgdb-d29e2a3e49349fbc90d921c1be66f85d0b9eb3f0.tar.gz
* gnu-v3-abi.c (gnuv3_baseclass_offset): Check whether
TYPE_VPTR_FIELDNO is valid.
Diffstat (limited to 'gdb/gnu-v3-abi.c')
-rw-r--r--gdb/gnu-v3-abi.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/gdb/gnu-v3-abi.c b/gdb/gnu-v3-abi.c
index d9947f9f87d..b18e644796e 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) : "<unknown>");