This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [PATCH] Add printf format specifier for printing enumerator
- From: Pedro Alves <palves at redhat dot com>
- To: Simon Marchi <simon dot marchi at polymtl dot ca>
- Cc: gdb-patches at sourceware dot org
- Date: Fri, 05 Feb 2016 15:08:22 +0000
- Subject: Re: [PATCH] Add printf format specifier for printing enumerator
- Authentication-results: sourceware.org; auth=none
- References: <1454681876-17628-1-git-send-email-simon dot marchi at polymtl dot ca> <56B4B6DC dot 1020508 at redhat dot com> <c32c3fc895ed2dd7e84353a21e99cddc at simark dot ca>
On 02/05/2016 03:02 PM, Simon Marchi wrote:
> 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.
>
> 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)?
I was thinking the former. Maybe even implement it in Python, in
gdb/python/lib/gdb/function/?
Thanks,
Pedro Alves