From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 31012 invoked by alias); 18 Sep 2010 14:13:03 -0000 Received: (qmail 30999 invoked by uid 22791); 18 Sep 2010 14:13:03 -0000 X-SWARE-Spam-Status: No, hits=-2.1 required=5.0 tests=AWL,BAYES_00 X-Spam-Check-By: sourceware.org Received: from rock.gnat.com (HELO rock.gnat.com) (205.232.38.15) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Sat, 18 Sep 2010 14:12:57 +0000 Received: from localhost (localhost.localdomain [127.0.0.1]) by filtered-rock.gnat.com (Postfix) with ESMTP id 14D822BAC85; Sat, 18 Sep 2010 10:12:56 -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 GLtkFKExYF0e; Sat, 18 Sep 2010 10:12:56 -0400 (EDT) Received: from joel.gnat.com (localhost.localdomain [127.0.0.1]) by rock.gnat.com (Postfix) with ESMTP id CC20D2BAC81; Sat, 18 Sep 2010 10:12:55 -0400 (EDT) Received: by joel.gnat.com (Postfix, from userid 1000) id 2E4FDF59A0; Sat, 18 Sep 2010 10:12:53 -0400 (EDT) Date: Sun, 19 Sep 2010 16:35:00 -0000 From: Joel Brobecker To: Paul Bolle Cc: gdb-patches@sourceware.org Subject: Re: [PATCH] [RFC] python: gdb.Type: strip typedefs past pointers too Message-ID: <20100918141253.GM3845@adacore.com> References: <1284753356.21566.10.camel@localhost.localdomain> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1284753356.21566.10.camel@localhost.localdomain> User-Agent: Mutt/1.5.20 (2009-06-14) 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: 2010-09/txt/msg00329.txt.bz2 > 1) I drafted a patch (pasted below this message) that works around this > limitation: Personally, I think that the current behavior is correct. But I did not participate in the design of the API, so others will probably have a more informed opinion. If we want to support the behavior you are looking for, I think it should be done either through the control of a parameter (defaulted to current behavior), or another method (recursive_strip_typedef). > + while (TYPE_CODE (real_type) == TYPE_CODE_PTR || > + TYPE_CODE (real_type) == TYPE_CODE_TYPEDEF) Small nit on the coding style: the `||' should be at the beginning of the next line: while (TYPE_CODE (real_type) == TYPE_CODE_PTR || TYPE_CODE (real_type) == TYPE_CODE_TYPEDEF) (how about references?) > + if (TYPE_CODE (real_type) == TYPE_CODE_TYPEDEF) > + { > + CHECK_TYPEDEF (real_type); > + } When there is only one statement in the block, the prefered style in GDB is to omit the curly braces: if (TYPE_CODE (real_type) == TYPE_CODE_TYPEDEF) CHECK_TYPEDEF (real_type); -- Joel