From 6fbe845e0c00ca40e98aa23401e0b5490717a646 Mon Sep 17 00:00:00 2001 From: Andrew Burgess Date: Thu, 25 Jul 2013 10:16:08 +0000 Subject: Add new 'z' format for print command. http://sourceware.org/ml/gdb-patches/2013-07/msg00235.html gdb/ChangeLog * NEWS: Mention new 'z' formatter. * printcmd.c (print_scalar_formatted): Add new 'z' formatter. (_initialize_printcmd): Mention 'z' formatter in help text of the 'x' command. gdb/doc/ChangeLog * gdb.texinfo (Output Formats): Mention the new 'z' formatter. gdb/testsuite/ChangeLog * gdb.base/printcmds.exp (test_print_int_arrays): Add tests for x, z, o, and t output formats. * gdb.base/display.exp: Use 'k' as an undefined format now that 'z' is defined. --- gdb/printcmd.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'gdb/printcmd.c') diff --git a/gdb/printcmd.c b/gdb/printcmd.c index 99d4dba3e5c..1cc248d70f6 100644 --- a/gdb/printcmd.c +++ b/gdb/printcmd.c @@ -533,6 +533,10 @@ print_scalar_formatted (const void *valaddr, struct type *type, } break; + case 'z': + print_hex_chars (stream, valaddr, len, byte_order); + break; + default: error (_("Undefined output format \"%c\"."), options->format); } @@ -2496,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(hex, zero padded on the left).\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\ -- cgit v1.2.1