This is the mail archive of the gdb-patches@sources.redhat.com mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: [RFA] testsuite/gdb.c++/ref-types.exp: use runto


Daniel Berlin writes:

> I think I can come up with a better heuristic.
> How bout i do a minimal symbol lookup on the address we think the
> virtual function is at, and make sure it's the start of some real
> function (and if you really want to go a bit further, i'll make sure
> it's a function in the class, or it's base classes)

That sounds good to me.

In the virtfunc.cc case, the test script calls pAe->f(), but gdb actually
calls VB::vvb, because it's using the wrong vtable.

When gdb goes off the wire, it winds up reading out of some memory
that's near the right memory.  The vtables appear close to each other
in memory so I think it will often pick a random word out of a random
nearby vtable.

Instead of, or in addition to, looking at the class membership, you
could look at the function name.  If the user calls "f", but gdb
wants to call "vvb", then it's always wrong.

Michael


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]