[PATCH 11/55] Introduce generic_value_print
Christian Biesinger via gdb-patches
gdb-patches@sourceware.org
Mon Dec 9 04:05:00 GMT 2019
On Sun, Dec 8, 2019 at 1:33 PM Tom Tromey <tom@tromey.com> wrote:
>
> This introduces generic_value_print, which is a value-based analogue
> to generic_val_print. For now this is unused and simply calls
> generic_val_print, but subsequent patches will both change this
> function to work using the value API directly, and convert callers of
> generic_val_print to call this instead.
I'm really not familiar with this code at all, but since this is new,
should this be a member function on struct value?
Christian
> gdb/ChangeLog
> 2019-12-08 Tom Tromey <tom@tromey.com>
>
> * valprint.h (generic_value_print): Declare.
> * valprint.c (generic_value_print): New function.
>
> Change-Id: I00b9ef91c1f3bf351b0e13e9873b849e80dfd944
> ---
> gdb/ChangeLog | 5 +++++
> gdb/valprint.c | 12 ++++++++++++
> gdb/valprint.h | 11 +++++++++++
> 3 files changed, 28 insertions(+)
>
> diff --git a/gdb/valprint.c b/gdb/valprint.c
> index d595a1d54e6..0e13e2b2d62 100644
> --- a/gdb/valprint.c
> +++ b/gdb/valprint.c
> @@ -1007,6 +1007,18 @@ generic_val_print (struct type *type,
> }
> }
>
> +/* See valprint.h. */
> +
> +void
> +generic_value_print (struct value *val, struct ui_file *stream, int recurse,
> + const struct value_print_options *options,
> + const struct generic_val_print_decorations *decorations)
> +{
> + generic_val_print (value_type (val), value_embedded_offset (val),
> + value_address (val), stream, recurse, val, options,
> + decorations);
> +}
> +
> /* Helper function for val_print and common_val_print that does the
> work. Arguments are as to val_print, but FULL_VALUE, if given, is
> the value to be printed. */
> diff --git a/gdb/valprint.h b/gdb/valprint.h
> index c63ac8de19b..e4b90404fa2 100644
> --- a/gdb/valprint.h
> +++ b/gdb/valprint.h
> @@ -211,6 +211,17 @@ extern void generic_val_print (struct type *type,
> const struct value_print_options *options,
> const struct generic_val_print_decorations *);
>
> +/* Print a value in a generic way. VAL is the value, STREAM is where
> + to print it, RECURSE is the recursion depth, OPTIONS describe how
> + the printing should be done, and D is the language-specific
> + decorations object. Note that structs and unions cannot be printed
> + by this function. */
> +
> +extern void generic_value_print (struct value *val, struct ui_file *stream,
> + int recurse,
> + const struct value_print_options *options,
> + const struct generic_val_print_decorations *d);
> +
> extern void generic_emit_char (int c, struct type *type, struct ui_file *stream,
> int quoter, const char *encoding);
>
> --
> 2.17.2
>
More information about the Gdb-patches
mailing list