From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 2628 invoked by alias); 4 May 2006 06:08:08 -0000 Received: (qmail 2619 invoked by uid 22791); 4 May 2006 06:08:08 -0000 X-Spam-Check-By: sourceware.org Received: from wx-out-0102.google.com (HELO wx-out-0102.google.com) (66.249.82.201) by sourceware.org (qpsmtpd/0.31) with ESMTP; Thu, 04 May 2006 06:08:03 +0000 Received: by wx-out-0102.google.com with SMTP id h30so273963wxd for ; Wed, 03 May 2006 23:08:01 -0700 (PDT) Received: by 10.70.113.11 with SMTP id l11mr328656wxc; Wed, 03 May 2006 23:08:01 -0700 (PDT) Received: by 10.70.129.13 with HTTP; Wed, 3 May 2006 23:08:01 -0700 (PDT) Message-ID: <8f2776cb0605032308r7645469di45fda7e57ae5718c@mail.gmail.com> Date: Thu, 04 May 2006 06:08:00 -0000 From: "Jim Blandy" To: "Vladimir Prus" Subject: Re: Variable objects: references formatting Cc: gdb-patches@sources.redhat.com In-Reply-To: <200605040918.33856.ghost@cs.msu.su> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: quoted-printable Content-Disposition: inline References: <8f2776cb0605031050q6b9f1b2ale98d0734d4dec3f9@mail.gmail.com> <8f2776cb0605031108j2371fd7dodcc9f6cecf305c5d@mail.gmail.com> <200605040918.33856.ghost@cs.msu.su> X-Google-Sender-Auth: 4b62d031552d89f1 X-IsSubscribed: yes Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2006-05/txt/msg00031.txt.bz2 On 5/3/06, Vladimir Prus wrote: > > - In GDB, when traversing types, remember to call check_typedef to > > avoid having your traversal stopped by typedef nodes. > > Thanks, noted. So, in this case I should have called check_typedef before > checking if type is reference, right? Well, the get_type function is taking care of that one for you. So it's enough to check the new types you uncover with TYPE_TARGET_TYPE. > Would you like me to resend the patch adjusted per your comments, or you'= ve > already done those changes locally? I've already done them. Here's the patch I actually committed (which I should have posted when I did so): gdb/ChangeLog: 2006-05-03 Vladimir Prus * varobj.c (c_value_of_variable): Ignore top-level references. (Committed by Jim Blandy.) Index: gdb/varobj.c =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D RCS file: /cvs/src/src/gdb/varobj.c,v retrieving revision 1.59 diff -u -p -r1.59 varobj.c --- gdb/varobj.c 27 Mar 2006 00:15:22 -0000 1.59 +++ gdb/varobj.c 3 May 2006 18:07:43 -0000 @@ -2054,10 +2054,16 @@ c_variable_editable (struct varobj *var) static char * c_value_of_variable (struct varobj *var) { - /* BOGUS: if val_print sees a struct/class, it will print out its - children instead of "{...}" */ + /* BOGUS: if val_print sees a struct/class, or a reference to one, + it will print out its children instead of "{...}". So we need to + catch that case explicitly. */ + struct type *type =3D get_type (var); + + /* Strip top-level references. */ + while (TYPE_CODE (type) =3D=3D TYPE_CODE_REF) + type =3D check_typedef (TYPE_TARGET_TYPE (type)); - switch (TYPE_CODE (get_type (var))) + switch (TYPE_CODE (type)) { case TYPE_CODE_STRUCT: case TYPE_CODE_UNION: