From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 4841 invoked by alias); 22 Dec 2009 18:42:52 -0000 Received: (qmail 4822 invoked by uid 22791); 22 Dec 2009 18:42:51 -0000 X-SWARE-Spam-Status: No, hits=-2.5 required=5.0 tests=AWL,BAYES_00,SPF_HELO_PASS,SPF_PASS X-Spam-Check-By: sourceware.org Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 22 Dec 2009 18:42:45 +0000 Received: from int-mx04.intmail.prod.int.phx2.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.17]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id nBMIg2gI027500 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Tue, 22 Dec 2009 13:42:02 -0500 Received: from ns3.rdu.redhat.com (ns3.rdu.redhat.com [10.11.255.199]) by int-mx04.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id nBMIg1S2014490; Tue, 22 Dec 2009 13:42:01 -0500 Received: from opsy.redhat.com (ovpn01.gateway.prod.ext.phx2.redhat.com [10.5.9.1]) by ns3.rdu.redhat.com (8.13.8/8.13.8) with ESMTP id nBMIg0tC025275; Tue, 22 Dec 2009 13:42:01 -0500 Received: by opsy.redhat.com (Postfix, from userid 500) id 774D83781B0; Tue, 22 Dec 2009 11:42:00 -0700 (MST) From: Tom Tromey To: Joel Brobecker Cc: gdb-patches@sourceware.org Subject: Re: [RFC] embryo of type/main_type pretty_printing... References: <20091220074121.GG2804@adacore.com> Reply-To: tromey@redhat.com Date: Tue, 22 Dec 2009 18:42:00 -0000 In-Reply-To: <20091220074121.GG2804@adacore.com> (Joel Brobecker's message of "Sun, 20 Dec 2009 11:41:21 +0400") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii 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: 2009-12/txt/msg00347.txt.bz2 >>>>> "Joel" == Joel Brobecker writes: Joel> As discussed with Daniel and Tom on IRC, I started looking at Joel> writing pretty printers for struct type and struct main_type. Excellent. I like the approach you took; I think it is elegant. Joel> class StructTypePrettyPrinter: [...] Joel> def to_string(self): [...] Joel> return "\n{" + ",\n ".join(fields) + "}" It would be better to have a 'children' method that returns a container (tuple or list, whatever is convenient). See the Pretty Printing node in the manual for details of the contents. This is better for a few reasons. From the CLI, it will mean that the results are printed more nicely: they will respect indentation and "set print pretty". From MI, they will show up as children of the type object. Regardless of whether you decide to change this, I think you should check this in. That will make it simpler for us to improve it. Tom