From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 16266 invoked by alias); 3 Jan 2007 22:32:16 -0000 Received: (qmail 16251 invoked by uid 22791); 3 Jan 2007 22:32:15 -0000 X-Spam-Check-By: sourceware.org Received: from nevyn.them.org (HELO nevyn.them.org) (66.93.172.17) by sourceware.org (qpsmtpd/0.31.1) with ESMTP; Wed, 03 Jan 2007 22:32:10 +0000 Received: from drow by nevyn.them.org with local (Exim 4.63) (envelope-from ) id 1H2EeV-000710-7M; Wed, 03 Jan 2007 17:32:07 -0500 Date: Wed, 03 Jan 2007 22:32:00 -0000 From: Daniel Jacobowitz To: Vladimir Prus Cc: gdb-patches@sources.redhat.com Subject: Re: Simpify varobj children handling for C++ Message-ID: <20070103223207.GM17935@nevyn.them.org> Mail-Followup-To: Vladimir Prus , gdb-patches@sources.redhat.com References: <200612240050.30172.ghost@cs.msu.su> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.13 (2006-08-11) X-IsSubscribed: yes 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: 2007-01/txt/msg00088.txt.bz2 On Mon, Dec 25, 2006 at 11:16:15AM +0300, Vladimir Prus wrote: > * value.c (value_as_address): Use coerce_array_proper > instead of coerce_array so that not fail for references. > (coerce_array_proper): New function. > (coerce_array): Use the above. I definitely need more information on this. What fails beforehand, and how did you get there? > @@ -950,7 +950,8 @@ value_ind (struct value *arg1) > if (TYPE_CODE (base_type) == TYPE_CODE_INT) > return value_at_lazy (builtin_type_int, > (CORE_ADDR) value_as_long (arg1)); > - else if (TYPE_CODE (base_type) == TYPE_CODE_PTR) > + else if (TYPE_CODE (base_type) == TYPE_CODE_PTR > + || TYPE_CODE (base_type) == TYPE_CODE_PTR) > { > struct type *enc_type; > /* We may be pointing to something embedded in a larger object */ Something tells me you didn't actually need value_ind to handle references... :-) > +/* Given a value and a type of a variable object, "the value and the type of a variable object", because the value is the property of some specific variable object. > + adjust those value and type to those necessary "adjust the" > + for getting childrens of the variable object. "children" > + This includes dereferencing top-level reference > + to all types and dereferencing pointers to > + structures. "references" to match "all types" > +static void > +adjust_value_for_children_access (struct value **value, > + struct type **type) "adjust_value_for_child_access", also. > +{ > + gdb_assert (type && *type); > + > + *type = check_typedef (*type); > + > + /* If the parent is reference, we always strip the > + reference when getting children, since in C++, > + reference is basically undistinguishable in > + usage from a plain variable. */ "is a reference", "in C++, a reference". > + /* The 'get_target_type' function call check_typedef on "calls" > @@ -1876,6 +1886,10 @@ c_describe_child (struct varobj *parent, > if (cvalue && value) > gdb_value_ind (value, cvalue); > > + /* The get_target_type function calls check_typedef > + on the result. I'm not sure if showing check_typedefed > + type for the child as opposed to the declared type is > + right. */ > if (ctype) > *ctype = get_target_type (type); > It'd be nice if we didn't do that. We go to some effort to show typedefs in the CLI for ptype. > + /* This is baseclass. */ "is a" -- Daniel Jacobowitz CodeSourcery