Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: mec.gnu@mindspring.com (Michael Elizabeth Chastain)
To: drow@mvista.com, gdb-patches@sources.redhat.com
Subject: Re: [patch/testsuite/c++] test script for PR c++/186
Date: Sun, 23 Nov 2003 23:00:00 -0000	[thread overview]
Message-ID: <20031123230016.C6B614B409@berman.michael-chastain.com> (raw)

Well, you have a point.  The gdb user is attempting to look at an object
after its last access from the source code.  A C++ compiler has always
had the right to fool around with such memory (so does a C compiler;
gcc optimizes away local variables often).

A test script can only observe behavior.  When gdb prints
"b1 = 12345678", the test script doesn't know if it's dealing with a
conforming compiler that scribbled on the memory, or a gdb bug that
causes gdb to print a value that is not in memory.

We kinda rely on compilers being simple.  As compilers grow
more optimizations we get breakages like store.exp and have to fix them.
Imagine a bug-catching compiler that scribbles bait-patterns into dead
memory -- that would break this script.

Hmmm, my test would be more clear if I made B::~B write something into
the data fields.  I will do that.  And write some more comments about
this.

I will also add some tests like this:

  A alpha;
  ...
  (gdb) print (B *) &alpha;

I think that's actually the heart and these issues with destructors
and scope are peripheral.  (But the destructor issue is interesting
because the program is doing something important in memory that is not
obvious to the programmer).

Michael C


             reply	other threads:[~2003-11-23 23:00 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-11-23 23:00 Michael Elizabeth Chastain [this message]
2003-11-24 17:25 ` David Carlton
  -- strict thread matches above, loose matches on Subject: below --
2003-11-24 18:13 Michael Elizabeth Chastain
2003-11-24 20:02 ` David Carlton
2003-11-24 16:41 Michael Elizabeth Chastain
2003-11-24 17:27 ` David Carlton
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

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=20031123230016.C6B614B409@berman.michael-chastain.com \
    --to=mec.gnu@mindspring.com \
    --cc=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