[rfc/testsuite/c++] c2.exp, new script for class lookup

Michael Elizabeth Chastain mec.gnu@mindspring.com
Tue Nov 25 04:22:00 GMT 2003

dc> What else are you going to add?  How about cast-classes or subclasses
dc> or something like that?

Well, I started out by picking up PR gdb/186, because it was in my
big directory of incomplete gdb stuff that I'm working on.

The issue with gdb/186 is:

  . program has base class "A", derived class "B"
  . program has an object of type "B"
  . program has "A *" and "B *" pointers to the "B" object
  . user puts breakpoint on closing "}" of function
    . this is after the destructors are called!
  . "print *b_p" does bad things after the destructor happens
     . because, as we figured out, B::~B changes the vptr

This PR is several years old so it's not something you broke.  :)

So I reproduced the PR and I was writing a test case, gdb186.exp.
I figured that I should put in some simple tests before the
destructor happens to show that gdb is working fine in that instance.

And, well, the simple tests revealed a simpler problem,
without any of the destructor-changes-vptr issues.

So once the immediate problem gets fixed, I can get back to worrying
about "print *b_p" after B::~B is called.

Also virtfunc.exp has another regression since 6.0 (PR gdb/1405, virtual
baseclass botch).  I wish it was related, but the dates don't match up
-- it manifested on 2003-10-02.  When I crack open gdb/1405 I might find
that class2.exp is a good place for an explicit test.

And I'll probably throw in any other class-related stuff that I come
across because it's easier to work with gdb_test_multiple, kfail,
test_compiler_info, and all that good stuff.

Michael C

More information about the Gdb-patches mailing list