From: Daniel Jacobowitz <drow@mvista.com>
To: gdb-patches@sources.redhat.com
Subject: [commit/6.0?] Sanity check in baseclass_offset
Date: Fri, 22 Aug 2003 20:48:00 -0000 [thread overview]
Message-ID: <20030822204825.GA11440@nevyn.them.org> (raw)
If we don't have, for whatever reason, debugging information for a base
class, TYPE_VPTR_FIELDNO may be -1. TYPE_FIELDS may also be NULL. When we
access 0[-1], we segfault. This patch conditionalizes the sanity check with
another sanity check.
OK to move this onto the 6.0 branch, given schedule? Checked into HEAD, no
regressions.
--
Daniel Jacobowitz
MontaVista Software Debian GNU/Linux Developer
2003-08-22 Daniel Jacobowitz <drow@mvista.com>
* gnu-v3-abi.c (gnuv3_baseclass_offset): Check whether
TYPE_VPTR_FIELDNO is valid.
--- gdb-6.0/gdb/gnu-v3-abi.c.orig 2003-08-22 10:51:25.000000000 -0400
+++ gdb-6.0/gdb/gnu-v3-abi.c 2003-08-22 10:53:13.000000000 -0400
@@ -412,10 +412,15 @@ gnuv3_baseclass_offset (struct type *typ
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>");
next reply other threads:[~2003-08-22 20:48 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-08-22 20:48 Daniel Jacobowitz [this message]
2003-08-24 13:58 ` Andrew Cagney
2003-08-24 16:53 ` Daniel Jacobowitz
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20030822204825.GA11440@nevyn.them.org \
--to=drow@mvista.com \
--cc=gdb-patches@sources.redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox