From: David Carlton <carlton@kealia.com>
To: mec.gnu@mindspring.com (Michael Elizabeth Chastain)
Cc: gdb-patches@sources.redhat.com
Subject: Re: [patch/testsuite/c++] test script for PR c++/186
Date: Mon, 24 Nov 2003 17:23:00 -0000 [thread overview]
Message-ID: <yf2isl91y0p.fsf@hawaii.kealia.com> (raw)
In-Reply-To: <20031123220445.1F77C4B409@berman.michael-chastain.com> (Michael Elizabeth Chastain's message of "Sun, 23 Nov 2003 17:04:45 -0500 (EST)")
On Sun, 23 Nov 2003 17:04:45 -0500 (EST), mec.gnu@mindspring.com (Michael Elizabeth Chastain) said:
> The issue is that the user is accessing a destroyed object through a
> pointer. Because the object has been destroyed, its vptr has been
> degraded to its most primitive base class. gdb gets confused and
> prints incorrect data, which is always wrong.
I wouldn't necessarily call this incorrect/wrong, but it is somewhat
unfortunate. I confess, though, that the correct fix isn't at all
obvious to me, given that normally the dynamic type is more useful
than the static type. Should GDB try to somehow take the supremum of
the static type and the dynamic type? (And what if there is no
supremum?) Should GDB try to remember when the user explicitly casts?
(If so, exactly how do we want to remember that?) Should there be an
option to turn of RTTI usage? (But users won't know about that.)
Maybe the best thing to do would be as follows, if A is the dynamic
type and B is the static type, then we check to make sure that A is
more specialized than B. If so, we use A; otherwise, we print a
warning and use B. I can't remember offhand if we have a way to
calculate whether or not A is more specialized with B, but it
shouldn't be too hard to do.
David Carlton
carlton@kealia.com
next prev parent reply other threads:[~2003-11-24 17:23 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-11-23 22:05 Michael Elizabeth Chastain
2003-11-23 22:08 ` Daniel Jacobowitz
2003-11-23 22:22 ` Daniel Jacobowitz
2003-11-24 17:23 ` David Carlton [this message]
2003-11-23 23:00 Michael Elizabeth Chastain
2003-11-24 17:25 ` David Carlton
2003-11-24 16:41 Michael Elizabeth Chastain
2003-11-24 17:27 ` David Carlton
2003-11-24 18:13 Michael Elizabeth Chastain
2003-11-24 20:02 ` David Carlton
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=yf2isl91y0p.fsf@hawaii.kealia.com \
--to=carlton@kealia.com \
--cc=gdb-patches@sources.redhat.com \
--cc=mec.gnu@mindspring.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