This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] Add $_as_string convenience function


> 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!


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]