From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 31018 invoked by alias); 11 Oct 2005 13:16:29 -0000 Mailing-List: contact gdb-patches-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sources.redhat.com Received: (qmail 31008 invoked by uid 22791); 11 Oct 2005 13:16:27 -0000 Received: from nevyn.them.org (HELO nevyn.them.org) (66.93.172.17) by sourceware.org (qpsmtpd/0.30-dev) with ESMTP; Tue, 11 Oct 2005 13:16:27 +0000 Received: from drow by nevyn.them.org with local (Exim 4.52) id 1EPJzT-00063h-Pp; Tue, 11 Oct 2005 09:16:23 -0400 Date: Tue, 11 Oct 2005 13:16:00 -0000 From: Daniel Jacobowitz To: Wu Zhou 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) Message-ID: <20051011131623.GB23260@nevyn.them.org> Mail-Followup-To: Wu Zhou , gdb-patches@sources.redhat.com References: <1127969598.433b733eedab9@imap.linux.ibm.com> <20051002222103.GA32728@nevyn.them.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.8i X-SW-Source: 2005-10/txt/msg00100.txt.bz2 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