From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 17566 invoked by alias); 21 Aug 2002 17:22: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 17556 invoked from network); 21 Aug 2002 17:22:27 -0000 Received: from unknown (HELO zenia.red-bean.com) (66.244.67.22) by sources.redhat.com with SMTP; 21 Aug 2002 17:22:27 -0000 Received: (from jimb@localhost) by zenia.red-bean.com (8.11.6/8.11.6) id g7LHBkv03741; Wed, 21 Aug 2002 12:11:46 -0500 To: Daniel Jacobowitz Cc: gdb-patches@sources.redhat.com Subject: Re: RFA: static cast from base class to derived class References: <200208210600.g7L60qD29529@zenia.red-bean.com> <20020821122557.GA19505@nevyn.them.org> From: Jim Blandy Date: Wed, 21 Aug 2002 10:22:00 -0000 In-Reply-To: <20020821122557.GA19505@nevyn.them.org> Message-ID: User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.2.90 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-SW-Source: 2002-08/txt/msg00666.txt.bz2 Daniel Jacobowitz writes: > I've got a question... what does VALUE_ADDRESS mean in this context? > If it means what it normally means (ought to mean?), then taking an > address, subtracting an address, and using it as a pointer doesn't make > a lot of sense. > > Answering my own question - it's dereferencing a pointer to a struct at > 0. So we'll actually get an address relative to zero, which makes > everything work out. This looks good to me. Right --- when casting from a base class to a derived class, we use search_struct_field to find the offset the base class has in the derived class by creating an imaginary instance of the derived class at address zero, finding the base class in that, and then using the base class subobject's address as the offset of the base class in the derived class. I wanted to fix the bug in what we did with that offset; beautifying the way we produced it wasn't on my agenda. :) I'll commit this --- thanks.