From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 88267 invoked by alias); 4 Mar 2016 23:07:26 -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 88256 invoked by uid 89); 4 Mar 2016 23:07:25 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-0.9 required=5.0 tests=AWL,BAYES_00,KAM_LAZY_DOMAIN_SECURITY,RCVD_IN_DNSWL_NONE autolearn=no version=3.3.2 spammy=neat, news X-HELO: rock.gnat.com Received: from rock.gnat.com (HELO rock.gnat.com) (205.232.38.15) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-SHA encrypted) ESMTPS; Fri, 04 Mar 2016 23:07:24 +0000 Received: from localhost (localhost.localdomain [127.0.0.1]) by filtered-rock.gnat.com (Postfix) with ESMTP id A67B7116656; Fri, 4 Mar 2016 18:07:22 -0500 (EST) 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 lTudAVaGtGiS; Fri, 4 Mar 2016 18:07:22 -0500 (EST) Received: from joel.gnat.com (localhost.localdomain [127.0.0.1]) by rock.gnat.com (Postfix) with ESMTP id 8BDC911664B; Fri, 4 Mar 2016 18:07:22 -0500 (EST) Received: by joel.gnat.com (Postfix, from userid 1000) id 32E77408EF; Fri, 4 Mar 2016 18:07:22 -0500 (EST) Date: Fri, 04 Mar 2016 23:07:00 -0000 From: Joel Brobecker To: Simon Marchi Cc: gdb-patches@sourceware.org Subject: Re: [PATCH] Add $_as_string convenience function Message-ID: <20160304230722.GB4291@adacore.com> References: <1457124218-22342-1-git-send-email-simon.marchi@polymtl.ca> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1457124218-22342-1-git-send-email-simon.marchi@polymtl.ca> User-Agent: Mutt/1.5.23 (2014-03-12) X-SW-Source: 2016-03/txt/msg00085.txt.bz2 > This patch is a follow-up to "Add printf format specifier for printing > enumerator": > > https://sourceware.org/ml/gdb-patches/2016-02/msg00144.html > > Instead of having a solution specific to the printf command, Pedro > suggested adding a general purpose function $_as_string() that would > cover this use case and more. > > So, in order to print the textual label of an enum, one can use: > > (gdb) printf "Visiting node of type %s\n", $_as_string(node) > Visiting node of type NODE_INTEGER > > gdb/ChangeLog: > > * data-directory/Makefile.in (PYTHON_FILE_LIST): Install > gdb/function/as_string.py. > * python/lib/gdb/function/as_string.py: New file. Neat. I think this deserves a NEWS entry!