From: Daniel Jacobowitz <drow@false.org>
To: Wu Zhou <woodzltc@cn.ibm.com>
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: Tue, 11 Oct 2005 13:16:00 -0000 [thread overview]
Message-ID: <20051011131623.GB23260@nevyn.them.org> (raw)
In-Reply-To: <Pine.LNX.4.63.0510111343240.7264@linux.site>
On Tue, Oct 11, 2005 at 01:52:12PM +0800, Wu Zhou wrote:
> Hi Daniel,
>
> I have one more question about the offset of vptr.
>
> On Sun, 2 Oct 2005, Daniel Jacobowitz wrote:
> > > - 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.
>
> By saying above, do you means that the pointer to the vtable is always at
> the beginning of the fields, so we can calculate the vtable_address using
> the following code?
>
> vtable_address
> = value_as_address (value_field (value, 0 /* TYPE_VPTR_FIELDNO (values_type) */));
>
> But I found that in some testcase (such as class A in gdb.cp/virtfunc.cc),
> the offset is 1. Did I misunderstand something? If so, please help me
> point out. Thanks a bunch!
No. I mean that the physical offset of the vtable in the structure is
0; the address of the vtable is the same as the address of the
structure, if there is a vtable.
--
Daniel Jacobowitz
CodeSourcery, LLC
prev parent reply other threads:[~2005-10-11 13:16 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
2005-10-09 20:09 ` Daniel Jacobowitz
2005-10-11 5:49 ` Wu Zhou
2005-10-11 13:16 ` Daniel Jacobowitz [this message]
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=20051011131623.GB23260@nevyn.them.org \
--to=drow@false.org \
--cc=gdb-patches@sources.redhat.com \
--cc=woodzltc@cn.ibm.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