aboutsummaryrefslogtreecommitdiff
path: root/gdb/valprint.h
diff options
context:
space:
mode:
authorEnze Li <enze.li@hotmail.com>2022-06-12 13:22:25 +0800
committerEnze Li <enze.li@hotmail.com>2022-06-18 11:23:06 +0800
commit21a527dfc85d62c9e90c65ac4076f517a6b76a48 (patch)
treeead0bfa6f75933bf50a82b62d692d08504ab5e2a /gdb/valprint.h
parent40d4cb8bccb0f46f34826564ea3502717ca8f0ce (diff)
downloadfsf-binutils-gdb-21a527dfc85d62c9e90c65ac4076f517a6b76a48.zip
fsf-binutils-gdb-21a527dfc85d62c9e90c65ac4076f517a6b76a48.tar.gz
fsf-binutils-gdb-21a527dfc85d62c9e90c65ac4076f517a6b76a48.tar.bz2
gdb: Add new 'print nibbles' feature
Make an introduction of a new print setting that can be set by 'set print nibbles [on|off]'. The default value if OFF, which can be changed by user manually. Of course, 'show print nibbles' is also included in the patch. The new feature displays binary values by group, with four bits per group. The motivation for this work is to enhance the readability of binary values. Here's a GDB session before this patch is applied. (gdb) print var_a $1 = 1230 (gdb) print/t var_a $2 = 10011001110 With this patch applied, we can use the new print setting to display the new form of the binary values. (gdb) print var_a $1 = 1230 (gdb) print/t var_a $2 = 10011001110 (gdb) set print nibbles on (gdb) print/t var_a $3 = 0100 1100 1110 Tested on x86_64 openSUSE Tumbleweed.
Diffstat (limited to 'gdb/valprint.h')
-rw-r--r--gdb/valprint.h6
1 files changed, 5 insertions, 1 deletions
diff --git a/gdb/valprint.h b/gdb/valprint.h
index ff536fb..d6ad45d 100644
--- a/gdb/valprint.h
+++ b/gdb/valprint.h
@@ -44,6 +44,9 @@ struct value_print_options
/* Controls printing of addresses. */
bool addressprint;
+ /* Controls printing of nibbles. */
+ bool nibblesprint;
+
/* Controls looking up an object's derived type using what we find
in its vtables. */
bool objectprint;
@@ -149,7 +152,8 @@ extern void value_print_scalar_formatted
int size, struct ui_file *stream);
extern void print_binary_chars (struct ui_file *, const gdb_byte *,
- unsigned int, enum bfd_endian, bool);
+ unsigned int, enum bfd_endian, bool,
+ const struct value_print_options *options);
extern void print_octal_chars (struct ui_file *, const gdb_byte *,
unsigned int, enum bfd_endian);