From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 28291 invoked by alias); 8 Feb 2010 22:32:46 -0000 Received: (qmail 28283 invoked by uid 22791); 8 Feb 2010 22:32:45 -0000 X-SWARE-Spam-Status: No, hits=-2.5 required=5.0 tests=AWL,BAYES_00,SPF_PASS X-Spam-Check-By: sourceware.org Received: from mail.codesourcery.com (HELO mail.codesourcery.com) (38.113.113.100) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Mon, 08 Feb 2010 22:32:41 +0000 Received: (qmail 1398 invoked from network); 8 Feb 2010 22:32:39 -0000 Received: from unknown (HELO orlando) (pedro@127.0.0.2) by mail.codesourcery.com with ESMTPA; 8 Feb 2010 22:32:39 -0000 From: Pedro Alves To: gdb-patches@sourceware.org, tromey@redhat.com Subject: Re: PR11067 patch Date: Mon, 08 Feb 2010 22:32:00 -0000 User-Agent: KMail/1.9.10 Cc: Chris Moller References: <4B6D70A3.2090208@redhat.com> In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <201002082232.39279.pedro@codesourcery.com> X-IsSubscribed: yes 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-02/txt/msg00235.txt.bz2 On Monday 08 February 2010 21:54:22, Tom Tromey wrote: > >>>>> "Chris" == Chris Moller writes: > > Chris> The attached patch fixes bug 11067 "p should print the > Chris> constant's value" by providing a means of setting a format string to > Chris> be used in printing enums. The string is set with > > Chris> set enum-fmt > > I would rather not introduce a new option for this, particularly a > formatting option. We don't have this sort of thing elsewhere in gdb -- > we just pick a printing format or two. Ditto. > I re-read the thread on the archer list. I propose having it print > like: > > $2 = ENUMERATOR = (enum tag) 23 > > However, i would suppress the extra stuff in structs and when printing > in summary mode. I seriously don't want to start a bikeshed, but, IMO, I don't think it's a good idea to to invent new output syntax for this. There's no need to print the type of the enum, that's what ptype is for. And we don't do it for any other type. We can look at enum's as having both a numeric facet, and a symbolic facet, just like "char"s, and those we print as (gdb) p 'a' $1 = 97 'a' If I had a choice, I would make printing enums exactly like: $2 = 23 'ENUMERATOR' This is short, concise, and models existing output. It should look obvious what that output means. And then users don't have to learn to recognize/identify different outputs depending on where the type is embedded or printed. That sounds important usability wise to me. Has this option seriously been discarded? -- Pedro Alves