From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 30122 invoked by alias); 11 Dec 2006 08:03:35 -0000 Received: (qmail 30008 invoked by uid 22791); 11 Dec 2006 08:03:33 -0000 X-Spam-Check-By: sourceware.org Received: from viper.snap.net.nz (HELO viper.snap.net.nz) (202.37.101.8) by sourceware.org (qpsmtpd/0.31) with ESMTP; Mon, 11 Dec 2006 08:03:24 +0000 Received: from kahikatea.snap.net.nz (p202-124-125-222.snap.net.nz [202.124.125.222]) by viper.snap.net.nz (Postfix) with ESMTP id B64EC3D8250; Mon, 11 Dec 2006 21:04:30 +1300 (NZDT) Received: by kahikatea.snap.net.nz (Postfix, from userid 500) id B6EB8BE38A; Mon, 11 Dec 2006 20:58:52 +1300 (NZDT) From: Nick Roberts MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Message-ID: <17789.4026.692612.610695@kahikatea.snap.net.nz> Date: Mon, 11 Dec 2006 08:03:00 -0000 To: Vladimir Prus Cc: Daniel Jacobowitz , gdb-patches@sources.redhat.com Subject: Re: MI: fix base members in references In-Reply-To: <200612111021.24255.ghost@cs.msu.su> References: <17787.10504.215397.177658@kahikatea.snap.net.nz> <20061211023534.GA11761@nevyn.them.org> <17788.62054.684436.820815@kahikatea.snap.net.nz> <200612111021.24255.ghost@cs.msu.su> X-Mailer: VM 7.19 under Emacs 22.0.91.16 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2006-12/txt/msg00163.txt.bz2 > > All my patch does is add an extra level of dereferencing to the relevant > > cplus_* functions. Presumably you could also have references to > > references to > > Fortnately, references to references do no exist. > > > pointers, pointers to references to pointers etc > > Likewise, pointers to references do not exist either. OK, thats good. It keeps things simple. > > so maybe the change should > > look something like: > > > > while (TYPE_CODE (type) == TYPE_CODE_PTR) > > || TYPE_CODE (type) == TYPE_CODE_REF) > > type = get_target_type (type); > > > > but I suspect the business of fake children would make this awkward. > > Then, if you have a pointer to pointer to pointer to struct, you'll collapse > the inner pointers, which might not be good idea. But as you point out, its not necessary anyway. > I think the best short time fix might be to modify get_type_deref to first > check for reference, and after that check for pointer. That would do what my patch already does, but putting it all once in get_type_deref would be cleaner, of course. > But what irks me most is that we have four functions that encapsulate > knowledge of number of children and how to get to them: > > *_number_of_children > *_name_of_child > *_value_of_child > *_type_of_child > > and all those functions are present for C and for C++. I'm thinking we can > collapse the last three functions into one, seriously cutting down on code > duplication. Yes but this is a separate issue and IMO should be a separate patch. -- Nick http://www.inet.net.nz/~nickrob