This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [PATCH v2 1/3] Add zero-padded hexadecimal format support for varobj's
- From: Joel Brobecker <brobecker at adacore dot com>
- To: Luis Machado <lgustavo at codesourcery dot com>
- Cc: gdb-patches at sourceware dot org
- Date: Fri, 8 May 2015 10:28:31 -0700
- Subject: Re: [PATCH v2 1/3] Add zero-padded hexadecimal format support for varobj's
- Authentication-results: sourceware.org; auth=none
- References: <1431020207-14371-1-git-send-email-lgustavo at codesourcery dot com> <1431020207-14371-2-git-send-email-lgustavo at codesourcery dot com>
> gdb/ChangeLog:
>
> 2015-05-07 Luis Machado <lgustavo@codesourcery.com>
>
> * gdb/mi/mi-cmd-var.c (mi_parse_format): Handle new "zero-hexadecimal"
> format.
> * gdb/varobj.c (varobj_format_string): Add "zero-hexadecimal" entry.
> (format_code): Add 'z' entry.
> (varobj_set_display_format): Handle FORMAT_ZHEXADECIMAL.
> * gdb/varobj.h (varobj_display_formats) <FORMAT_ZHEXADECIMAL>: New enum
> field.
I don't normally have authority to approve, but the patch looks
sufficiently mechanical that I think I can provide approval if
the area maintainer isn't available.
In the meantime, I noticed a few nits (formatting, mostly).
> error (_("Must specify the format as: \"natural\", "
> - "\"binary\", \"decimal\", \"hexadecimal\", or \"octal\""));
> + "\"binary\", \"decimal\", \"hexadecimal\", \"octal\" or \"zero-hexadecimal\""));
The last line is too long. Can you split it?
> @@ -50,7 +50,7 @@ show_varobjdebug (struct ui_file *file, int from_tty,
>
> /* String representations of gdb's format codes. */
> char *varobj_format_string[] =
> - { "natural", "binary", "decimal", "hexadecimal", "octal" };
> + { "natural", "binary", "decimal", "hexadecimal", "octal", "zero-hexadecimal" };
Same here.
> --- a/gdb/varobj.h
> +++ b/gdb/varobj.h
> @@ -28,7 +28,8 @@ enum varobj_display_formats
> FORMAT_BINARY, /* Binary display */
> FORMAT_DECIMAL, /* Decimal display */
> FORMAT_HEXADECIMAL, /* Hex display */
> - FORMAT_OCTAL /* Octal display */
> + FORMAT_OCTAL, /* Octal display */
> + FORMAT_ZHEXADECIMAL /* Zero padded hexadecimal */
> };
I suggest adding a ',' at the end of FORMAT_ZHEXADECIMAL.
That way, next time we add a new enum, we can just add it
without touching the rest of the definition.
--
Joel