This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: Removing TYPE_VPTR_FIELDNO uses (was: Re: [patch ping] Set TYPE_VPTR_BASETYPE/TYPE_VPTR_FIELDNO of XL C++ virtual class)
- From: Daniel Jacobowitz <drow at false dot org>
- To: Wu Zhou <woodzltc at cn dot ibm dot com>
- Cc: gdb-patches at sources dot redhat dot com
- Date: Sun, 9 Oct 2005 16:09:31 -0400
- Subject: Re: Removing TYPE_VPTR_FIELDNO uses (was: Re: [patch ping] Set TYPE_VPTR_BASETYPE/TYPE_VPTR_FIELDNO of XL C++ virtual class)
- References: <1127969598.433b733eedab9@imap.linux.ibm.com> <20051002222103.GA32728@nevyn.them.org> <Pine.LNX.4.63.0510091140320.4391@linux.site>
On Sun, Oct 09, 2005 at 12:02:16PM +0800, Wu Zhou wrote:
> > > - gdbtypes.c/gdbtype.h: to initialize VPTR_FIELDNO (in alloc_type and
> > > create_array_type), fill VPTRs (in fill_in_vptr_fieldno), and dump VPTRs
> > > (in recursive_dump_type). Maybe some change to the type dumping is
> > > needed.
> >
> > Not if we leave them for older ABIs and stabs.
>
> Maybe we need to add some code to dump VPTRs for gnu-v3 ABI after removing
> TYPE_VPTR_FIELDNO?
I wouldn't even bother unless you need it for debugging; this code
doesn't see much use lately.
> > > - eval.c (evaluate_subexp_standard): TYPE_VPTR_BASETYPE is used to iterate
> > > the baseclasses to find the real address of the virtual function.
> >
> > This code needs to be (A) read and thought about, so that we can figure
> > out what it used to do, and (B) replaced with something less broken.
> > It hasn't worked in forever. Take a look at what METHOD_PTR_IS_VIRTUAL
> > expands to!
>
> It seems that the definition for METHOD_PTR_IS_VIRTUAL is at least error
> for 64-bit arch. Seen from the changelogs I found it was introduced in
> gdb since 1992. Will this still stands after more than ten years?
>
> #define METHOD_PTR_IS_VIRTUAL(ADDR) ((ADDR) & 0x80000000)
>
> Didn't all these different compilers reached an agreement on how to
> predicate a pointer-to-method is virtual?
I don't know what the v3 ABI does for this; but it certainly does not
do it that way.
> > Unless of course there isn't one. We may need to figure out what the
> > field at offset 0 is to see whether it's a vptr or a user variable. I
> > haven't thought about that in a while; maybe we can assume that there
> > is one by the time we get into this file.
>
> Do you have any clues on how to determine whether this assumption stands?
I don't know, I'm afraid; some experimentation is in order.
--
Daniel Jacobowitz
CodeSourcery, LLC