Re: [PATCH] [1/2] Add new 'z' format for print command

Andrew Burgess
2013-07-11T15:20:56Z

On 10/07/2013 6:30 PM, Tom Tromey wrote:
>>>>>> "Andrew" == Andrew Burgess <aburgess@broadcom.com> writes:
>
> Andrew> Pedro pointed out that I could do better, so, this patch
> Andrew> introduces a new 'z' format within the core value printing
> Andrew> code that displays scalars using zero padded hexadecimal.
> Andrew> I've mentioned this in the docs and added a test for the
> Andrew> new format.
>
> Andrew> In patch [2/2] I'll change the MI code to make use of this
> Andrew> new 'z' formatter.
>
> Andrew> OK to apply?
>
> It looks good to me. However, it needs a doc review, and also, I think,
> a NEWS entry.

Thanks for looking through this patch.

I've included a proposed NEWS entry below.

It also occurred to me that the 'z' formatter should be mentioned in the
help text for the 'x' command, I've included a small patch below that
makes this change.

> Plus, I think we should wait a little bit in case anyone has an issue
> with the choice of 'z'.

I'll wait a while to see if there's any feedback on the choice of
letter, and for a docs review.

Thanks,
Andrew

gdb/NEWS

* New 'z' formatter for print and examine memory commands, displays the
value as hexadecimal zero padded to the size of the type.

gdb/ChangeLog

2013-07-08 Andrew Burgess <aburgess@broadcom.com>

* printcmd.c (_initialize_printcmd): Mention 'z' formatter in
help text of the 'x' command.

diff --git a/gdb/printcmd.c b/gdb/printcmd.c
index f34d18b..0862f86 100644
--- a/gdb/printcmd.c
+++ b/gdb/printcmd.c
@@ -2500,7 +2500,8 @@ Examine memory: x/FMT ADDRESS.\n\
ADDRESS is an expression for the memory address to examine.\n\
FMT is a repeat count followed by a format letter and a size letter.\n\
Format letters are o(octal), x(hex), d(decimal), u(unsigned decimal),\n\
- t(binary), f(float), a(address), i(instruction), c(char) and s(string).\n\
+ t(binary), f(float), a(address), i(instruction), c(char), s(string)\n\
+ and z(zero padded hex).\n\
Size letters are b(byte), h(halfword), w(word), g(giant, 8 bytes).\n\
The specified number of objects of the specified size are printed\n\
according to the format.\n\n\