From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 18440 invoked by alias); 11 Dec 2006 07:22:28 -0000 Received: (qmail 18428 invoked by uid 22791); 11 Dec 2006 07:22:27 -0000 X-Spam-Check-By: sourceware.org Received: from zigzag.lvk.cs.msu.su (HELO zigzag.lvk.cs.msu.su) (158.250.17.23) by sourceware.org (qpsmtpd/0.31) with ESMTP; Mon, 11 Dec 2006 07:22:23 +0000 Received: from Debian-exim by zigzag.lvk.cs.msu.su with spam-scanned (Exim 4.50) id 1GtfUO-0005Ab-AG for gdb-patches@sources.redhat.com; Mon, 11 Dec 2006 10:22:17 +0300 Received: from localhost ([127.0.0.1] helo=ip6-localhost) by zigzag.lvk.cs.msu.su with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA:32) (Exim 4.50) id 1GtfTp-00059l-VX; Mon, 11 Dec 2006 10:21:42 +0300 From: Vladimir Prus To: Nick Roberts Subject: Re: MI: fix base members in references Date: Mon, 11 Dec 2006 07:22:00 -0000 User-Agent: KMail/1.9.1 Cc: Daniel Jacobowitz , gdb-patches@sources.redhat.com References: <17787.10504.215397.177658@kahikatea.snap.net.nz> <20061211023534.GA11761@nevyn.them.org> <17788.62054.684436.820815@kahikatea.snap.net.nz> In-Reply-To: <17788.62054.684436.820815@kahikatea.snap.net.nz> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200612111021.24255.ghost@cs.msu.su> 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/msg00162.txt.bz2 On Monday 11 December 2006 08:53, Nick Roberts wrote: > > that's > > the important thing here. What does not happen that you want to make > > happen, and why doesn't it happen? The explanation in my previous > > message _should_ answer those questions, if I've understood the > > discussion right, but maybe it doesn't. > > What doesn't work: references to pointers to structs/unions. > > 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. > 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. 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. 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. - Volodya