diff options
author | Tom Tromey <tom@tromey.com> | 2020-03-13 17:39:52 -0600 |
---|---|---|
committer | Tom Tromey <tom@tromey.com> | 2020-03-13 18:03:41 -0600 |
commit | fdddfccba1cc4f70089873441b7e6c38de09ae37 (patch) | |
tree | a4a288e6f8a36917af5533ab1c652bfd3f6d12b7 /gdb | |
parent | 6dde752183769c712eb22f49a5b74bfadad4a6be (diff) | |
download | gdb-fdddfccba1cc4f70089873441b7e6c38de09ae37.zip gdb-fdddfccba1cc4f70089873441b7e6c38de09ae37.tar.gz gdb-fdddfccba1cc4f70089873441b7e6c38de09ae37.tar.bz2 |
Introduce generic_value_print_int
This adds generic_value_print_int, a value-based analogue of
generic_val_print_int.
gdb/ChangeLog
2020-03-13 Tom Tromey <tom@tromey.com>
* valprint.c (generic_value_print_int): New function.
(generic_value_print): Use it.
Diffstat (limited to 'gdb')
-rw-r--r-- | gdb/ChangeLog | 5 | ||||
-rw-r--r-- | gdb/valprint.c | 16 |
2 files changed, 19 insertions, 2 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 1d15ca6..2ca8e66 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,5 +1,10 @@ 2020-03-13 Tom Tromey <tom@tromey.com> + * valprint.c (generic_value_print_int): New function. + (generic_value_print): Use it. + +2020-03-13 Tom Tromey <tom@tromey.com> + * valprint.c (generic_value_print_bool): New function. (generic_value_print): Use it. diff --git a/gdb/valprint.c b/gdb/valprint.c index 56a2e99..c9ad274 100644 --- a/gdb/valprint.c +++ b/gdb/valprint.c @@ -834,6 +834,19 @@ generic_val_print_int (struct type *type, original_value, &opts, 0, stream); } +/* generic_value_print helper for TYPE_CODE_INT. */ + +static void +generic_value_print_int (struct value *val, struct ui_file *stream, + const struct value_print_options *options) +{ + struct value_print_options opts = *options; + + opts.format = (options->format ? options->format + : options->output_format); + value_print_scalar_formatted (val, &opts, 0, stream); +} + /* generic_val_print helper for TYPE_CODE_CHAR. */ static void @@ -1134,8 +1147,7 @@ generic_value_print (struct value *val, struct ui_file *stream, int recurse, /* FALLTHROUGH */ case TYPE_CODE_INT: - generic_val_print_int (type, 0, stream, - val, options); + generic_value_print_int (val, stream, options); break; case TYPE_CODE_CHAR: |