From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 32260 invoked by alias); 9 Dec 2006 22:15:12 -0000 Received: (qmail 32249 invoked by uid 22791); 9 Dec 2006 22:15:12 -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; Sat, 09 Dec 2006 22:15:08 +0000 Received: from Debian-exim by zigzag.lvk.cs.msu.su with spam-scanned (Exim 4.50) id 1GtATH-0002It-NE for gdb-patches@sources.redhat.com; Sun, 10 Dec 2006 01:15:04 +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 1GtATD-0002Ig-Fe; Sun, 10 Dec 2006 01:14:59 +0300 From: Vladimir Prus To: Nick Roberts Subject: Re: MI: fix base members in references Date: Sat, 09 Dec 2006 22:15:00 -0000 User-Agent: KMail/1.9.1 References: <17787.10504.215397.177658@kahikatea.snap.net.nz> <200612100037.24768.ghost@cs.msu.su> <17787.11900.251681.440151@kahikatea.snap.net.nz> In-Reply-To: <17787.11900.251681.440151@kahikatea.snap.net.nz> Cc: gdb-patches@sources.redhat.com MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200612100114.44118.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/msg00146.txt.bz2 On Sunday 10 December 2006 00:45, you wrote: > > > > I would have preferred if instead of adding if, the code was modified to > > > > look at > > > > > > > value_type (var->value) > > > > > > > as opposed to > > > > > > > var->type > > > > > > I'm not sure that I follow your point. The patch just gets the target > > > type, after dereferencing, in the case of a pointer. > > > > > > > The latter is the type of the varobj expression as it is in source > > > > program. The former is the value we're actually showing. It makes sense > > > > to use value_type (var->value) for all presentation purposes. > > > > > > The former appears to be a type also (not a value). > > > > Slight typo: the former is the type of the value we're actually showing. So, > > you don't need to take original type and try to arrived to the type that > > should be shown to the user, you just use value_type (var->value), and don't > > need any further processing. One less thing that can be broken in future. > > I'm still not sure that I follow. My patch doesn't look at var->type directly. Well, get_type does. > Are you saying get_type should use value_type (var->value) instead of > var->type? No. I'm saying that instead of using get_type and then additionally doing something with the type, we should directly use value_type (var->value). If we want to know how many children a value has, and you know the type of the value, it does not make sense to take some other type, do some transformation on it, and the hope you'll get the same type. You can just use the type that's right. - Volodya