]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
Introduce generic_value_print
authorTom Tromey <tom@tromey.com>
Fri, 13 Mar 2020 23:39:52 +0000 (17:39 -0600)
committerTom Tromey <tom@tromey.com>
Sat, 14 Mar 2020 00:03:40 +0000 (18:03 -0600)
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.

gdb/ChangeLog
2020-03-13  Tom Tromey  <tom@tromey.com>

* valprint.h (generic_value_print): Declare.
* valprint.c (generic_value_print): New function.

gdb/ChangeLog
gdb/valprint.c
gdb/valprint.h

index acd5bf0ad69affd184f3032893e39cb7680376a7..48572cb4d2a8e1c0e537969db2542be2d07810f2 100644 (file)
@@ -1,3 +1,8 @@
+2020-03-13  Tom Tromey  <tom@tromey.com>
+
+       * valprint.h (generic_value_print): Declare.
+       * valprint.c (generic_value_print): New function.
+
 2020-03-13  Tom Tromey  <tom@tromey.com>
 
        * valprint.c (do_val_print): Call la_value_print_inner, if
index e0a3424feaea5ff57e2912da4d630ec89ee33f52..7b0365a3ba8321aaae52f378885854a165b904f4 100644 (file)
@@ -1033,6 +1033,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.  */
index 13b2b2d8c8d1175bad7f4456e19d32a86d96ad07..1aca29463f44687af62c556446add9c849935e7a 100644 (file)
@@ -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);