From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 31364 invoked by alias); 3 May 2006 09:22:13 -0000 Received: (qmail 31130 invoked by uid 22791); 3 May 2006 09:22:12 -0000 X-Spam-Check-By: sourceware.org Received: from main.gmane.org (HELO ciao.gmane.org) (80.91.229.2) by sourceware.org (qpsmtpd/0.31) with ESMTP; Wed, 03 May 2006 09:22:00 +0000 Received: from list by ciao.gmane.org with local (Exim 4.43) id 1FbDYJ-0002Bw-EX for gdb-patches@sources.redhat.com; Wed, 03 May 2006 11:21:47 +0200 Received: from zigzag.lvk.cs.msu.su ([158.250.17.23]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Wed, 03 May 2006 11:21:47 +0200 Received: from ghost by zigzag.lvk.cs.msu.su with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Wed, 03 May 2006 11:21:47 +0200 To: gdb-patches@sources.redhat.com From: Vladimir Prus Subject: Variable objects: references formatting Date: Wed, 03 May 2006 09:22:00 -0000 Message-ID: Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="nextPart2022976.0heXhaS2KB" Content-Transfer-Encoding: 7Bit User-Agent: KNode/0.8.2 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/msg00016.txt.bz2 --nextPart2022976.0heXhaS2KB Content-Type: text/plain; charset=koi8-r Content-Transfer-Encoding: 8Bit Content-length: 504 Hi! At the moment, when using variable objects to display a struct or a class, the result of -data-evaluate-expression is "...". However, when displaying a reference to a class, the result of -data-evaluate-expression is {}-enclosed list of members and their values. This disparity does not seem to be reasonable, the attached patch fixes it: Changelog: 2006-05-03 Vladimir Prus varobj.c (c_value_of_variable): Ignore top-level references. Patch attached. Thanks, Volodya --nextPart2022976.0heXhaS2KB Content-Type: text/x-diff; name="varobj_references_to_classes.diff" Content-Transfer-Encoding: 8Bit Content-Disposition: attachment; filename="varobj_references_to_classes.diff" Content-length: 609 Index: varobj.c =================================================================== RCS file: /cvs/src/src/gdb/varobj.c,v retrieving revision 1.58 diff -u -r1.58 varobj.c @@ -2055,8 +2219,14 @@ { /* BOGUS: if val_print sees a struct/class, it will print out its children instead of "{...}" */ + struct type* type = get_type (var); + /* Strip top-level references. */ + while (TYPE_CODE (type) == TYPE_CODE_REF) + { + type = TYPE_TARGET_TYPE (type); + } - switch (TYPE_CODE (get_type (var))) + switch (TYPE_CODE (type)) { case TYPE_CODE_STRUCT: case TYPE_CODE_UNION: --nextPart2022976.0heXhaS2KB--