From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 4772 invoked by alias); 29 Aug 2007 18:32:23 -0000 Received: (qmail 4745 invoked by uid 22791); 29 Aug 2007 18:32:23 -0000 X-Spam-Check-By: sourceware.org Received: from rock.gnat.com (HELO rock.gnat.com) (205.232.38.15) by sourceware.org (qpsmtpd/0.31) with ESMTP; Wed, 29 Aug 2007 18:32:19 +0000 Received: from localhost (localhost.localdomain [127.0.0.1]) by filtered-rock.gnat.com (Postfix) with ESMTP id D7C202AA785; Wed, 29 Aug 2007 14:32:17 -0400 (EDT) Received: from rock.gnat.com ([127.0.0.1]) by localhost (rock.gnat.com [127.0.0.1]) (amavisd-new, port 10024) with LMTP id MVdEZTVw89ed; Wed, 29 Aug 2007 14:32:17 -0400 (EDT) Received: from joel.gnat.com (localhost.localdomain [127.0.0.1]) by rock.gnat.com (Postfix) with ESMTP id 7A7EE2AA000; Wed, 29 Aug 2007 14:32:17 -0400 (EDT) Received: by joel.gnat.com (Postfix, from userid 1000) id 5982CE7B58; Wed, 29 Aug 2007 11:32:15 -0700 (PDT) Date: Wed, 29 Aug 2007 18:32:00 -0000 From: Joel Brobecker To: Carlos Eduardo Seo , Luis Machado , gdb-patches@sourceware.org Subject: Re: [patch] ptype: show members of an unnamed struct inside an union Message-ID: <20070829183215.GF3795@adacore.com> References: <46C4D20E.1010703@linux.vnet.ibm.com> <20070828171422.GB3874@adacore.com> <46D47155.5000403@linux.vnet.ibm.com> <20070828200356.GA3795@adacore.com> <46D4818C.1030001@linux.vnet.ibm.com> <20070828203420.GB3795@adacore.com> <20070829025618.GA26311@caradoc.them.org> <20070829043633.GD3795@adacore.com> <20070829163021.GA32337@caradoc.them.org> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="zhXaljGHf11kAtnf" Content-Disposition: inline In-Reply-To: <20070829163021.GA32337@caradoc.them.org> User-Agent: Mutt/1.4.2.2i 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-08/txt/msg00517.txt.bz2 --zhXaljGHf11kAtnf Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-length: 868 > In C, it would be "my_page_var.mapping". The union is transparent. Oh, I see. (love to learn new things :). Back to the issue at hand, it therefore seems pretty desirable to enhance the debugger in that case. Unfortunately, I don't think the proposed patch is correct, because it bases the logic on the size of the union/struct instead of whether the field is anonymous or not. Do you agree? Just for easier reference, the patch was: 2007-08-16 Carlos Eduardo Seo gdb/c-typeprint.c (c_type_print_base): check value of TYPE_NFIELDS (type) when displaying members of an unnamed struct inside an union. This patch breaks the tests that I just posted for RFA: http://www.sourceware.org/ml/gdb-patches/2007-08/msg00498.html But otherwise is reported to not cause any other regression on the testsuite. -- Joel --zhXaljGHf11kAtnf Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="ptype_issue.diff" Content-length: 715 2007-08-16 Carlos Eduardo Seo gdb/c-typeprint.c (c_type_print_base): check value of TYPE_NFIELDS (type) when displaying members of an unnamed struct inside an union. Index: src-git/gdb/c-typeprint.c =================================================================== --- src-git.orig/gdb/c-typeprint.c 2007-08-16 15:28:04.000000000 -0700 +++ src-git/gdb/c-typeprint.c 2007-08-16 15:29:07.000000000 -0700 @@ -735,7 +735,7 @@ fputs_filtered (" ", stream); } wrap_here (" "); - if (show < 0) + if ((show < 0) && (TYPE_NFIELDS (type) == 0)) { /* If we just printed a tag name, no need to print anything else. */ if (TYPE_TAG_NAME (type) == NULL) --zhXaljGHf11kAtnf--