Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Wu Zhou <woodzltc@cn.ibm.com>
To: Daniel Jacobowitz <drow@false.org>
Cc: gdb-patches@sources.redhat.com
Subject: Re: Removing TYPE_VPTR_FIELDNO uses (was: Re: [patch ping] Set TYPE_VPTR_BASETYPE/TYPE_VPTR_FIELDNO of XL C++ virtual class)
Date: Sun, 09 Oct 2005 03:58:00 -0000	[thread overview]
Message-ID: <Pine.LNX.4.63.0510091140320.4391@linux.site> (raw)
In-Reply-To: <20051002222103.GA32728@nevyn.them.org>

Hi Daniel,

Thanks for your comments.  Some more questions about these code. 

> > - 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?

> > - 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?

> > - gnu-v3-abi.c: VPTRs is used for rtti, virtual function and virtual base 
> > class offset.
> 
> In this file, I think we can skip all the rigamarole with debug
> information to find the vptr.  It's very easy: it's the size of a
> pointer, and it's at offset 0.  Always.

If so, we can use this to find the vptr.

> 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?

Best Regards
- Wu Zhou


  reply	other threads:[~2005-10-09  3:58 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-09-29  4:53 [patch ping] Set TYPE_VPTR_BASETYPE/TYPE_VPTR_FIELDNO of XL C++ virtual class Wu Zhou
2005-10-02 22:21 ` Removing TYPE_VPTR_FIELDNO uses (was: Re: [patch ping] Set TYPE_VPTR_BASETYPE/TYPE_VPTR_FIELDNO of XL C++ virtual class) Daniel Jacobowitz
2005-10-09  3:58   ` Wu Zhou [this message]
2005-10-09 20:09     ` Daniel Jacobowitz
2005-10-11  5:49   ` Wu Zhou
2005-10-11 13:16     ` Daniel Jacobowitz

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=Pine.LNX.4.63.0510091140320.4391@linux.site \
    --to=woodzltc@cn.ibm.com \
    --cc=drow@false.org \
    --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