From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 26441 invoked by alias); 5 Feb 2016 15:03:03 -0000 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 Received: (qmail 26043 invoked by uid 89); 5 Feb 2016 15:03:02 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.2 required=5.0 tests=BAYES_00,SPF_HELO_PASS,SPF_SOFTFAIL autolearn=no version=3.3.2 spammy=H*UA:Webmail, 2016-02-05 X-HELO: simark.ca Received: from simark.ca (HELO simark.ca) (158.69.221.121) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-GCM-SHA384 encrypted) ESMTPS; Fri, 05 Feb 2016 15:02:58 +0000 Received: by simark.ca (Postfix, from userid 112) id BE1361E172; Fri, 5 Feb 2016 10:02:55 -0500 (EST) Received: from simark.ca (localhost [127.0.0.1]) by simark.ca (Postfix) with ESMTP id A6AD51E11A; Fri, 5 Feb 2016 10:02:54 -0500 (EST) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit Date: Fri, 05 Feb 2016 15:03:00 -0000 From: Simon Marchi To: Pedro Alves Cc: gdb-patches@sourceware.org Subject: Re: [PATCH] Add printf format specifier for printing enumerator In-Reply-To: <56B4B6DC.1020508@redhat.com> References: <1454681876-17628-1-git-send-email-simon.marchi@polymtl.ca> <56B4B6DC.1020508@redhat.com> Message-ID: X-Sender: simon.marchi@polymtl.ca User-Agent: Roundcube Webmail/1.1.3 X-SW-Source: 2016-02/txt/msg00150.txt.bz2 On 2016-02-05 09:51, Pedro Alves wrote: > Did you consider a convenience function to convert a value > to string, instead? Then you'd write: > > (gdb) printf "Visiting node of type %s\n", $_as_string(node) > > And maybe do other things with it. > > Thanks, > Pedro Alves No, but I think it's a good idea. Do you see _as_string as applicable to any type, a bit like str() in Python, or just to some specific types that we chose and make sense (like enum)?