From 00272ec4b0cc22c1b9d60d39ce7bf5b2d5512582 Mon Sep 17 00:00:00 2001 From: Tom Tromey Date: Tue, 26 Apr 2016 16:45:21 -0600 Subject: Add array start and end strings to generic_val_print_decorations For Rust value-printing, I wanted to use generic_val_print_array, but I also wanted to control the starting and ending strings. This patch adds new strings to generic_val_print_decorations, updates generic_val_print_array to use them, and updates all the existing instances of generic_val_print_decorations. 2016-05-17 Tom Tromey * valprint.h (struct generic_val_print_array) : New fields. * valprint.c (generic_val_print_array): Add "decorations" parameter. Use "array_start", "array_end". (generic_val_print) : Update. * p-valprint.c (p_decorations): Update. * m2-valprint.c (m2_decorations): Update. * f-valprint.c (f_decorations): Update. * c-valprint.c (c_decorations): Update. --- gdb/valprint.c | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) (limited to 'gdb/valprint.c') diff --git a/gdb/valprint.c b/gdb/valprint.c index 720942b..cea69f3 100644 --- a/gdb/valprint.c +++ b/gdb/valprint.c @@ -407,10 +407,12 @@ print_unpacked_pointer (struct type *type, struct type *elttype, static void generic_val_print_array (struct type *type, const gdb_byte *valaddr, - int embedded_offset, CORE_ADDR address, - struct ui_file *stream, int recurse, - const struct value *original_value, - const struct value_print_options *options) + int embedded_offset, CORE_ADDR address, + struct ui_file *stream, int recurse, + const struct value *original_value, + const struct value_print_options *options, + const struct + generic_val_print_decorations *decorations) { struct type *unresolved_elttype = TYPE_TARGET_TYPE (type); struct type *elttype = check_typedef (unresolved_elttype); @@ -427,11 +429,11 @@ generic_val_print_array (struct type *type, const gdb_byte *valaddr, print_spaces_filtered (2 + 2 * recurse, stream); } - fprintf_filtered (stream, "{"); + fputs_filtered (decorations->array_start, stream); val_print_array_elements (type, valaddr, embedded_offset, address, stream, recurse, original_value, options, 0); - fprintf_filtered (stream, "}"); + fputs_filtered (decorations->array_end, stream); } else { @@ -851,7 +853,7 @@ generic_val_print (struct type *type, const gdb_byte *valaddr, { case TYPE_CODE_ARRAY: generic_val_print_array (type, valaddr, embedded_offset, address, stream, - recurse, original_value, options); + recurse, original_value, options, decorations); break; case TYPE_CODE_MEMBERPTR: -- cgit v1.1