diff options
Diffstat (limited to 'gdb/valprint.c')
-rw-r--r-- | gdb/valprint.c | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/gdb/valprint.c b/gdb/valprint.c index 6ddbed8..b6b96d4 100644 --- a/gdb/valprint.c +++ b/gdb/valprint.c @@ -514,6 +514,47 @@ val_print_type_code_flags (struct type *type, const gdb_byte *valaddr, } } fputs_filtered ("]", stream); + +/* Print a scalar of data of type TYPE, pointed to in GDB by VALADDR, + according to OPTIONS and SIZE on STREAM. Format i is not supported + at this level. + + This is how the elements of an array or structure are printed + with a format. */ +} + +void +val_print_scalar_formatted (struct type *type, + const gdb_byte *valaddr, int embedded_offset, + const struct value *val, + const struct value_print_options *options, + int size, + struct ui_file *stream) +{ + gdb_assert (val != NULL); + gdb_assert (valaddr == value_contents_for_printing_const (val)); + + /* If we get here with a string format, try again without it. Go + all the way back to the language printers, which may call us + again. */ + if (options->format == 's') + { + struct value_print_options opts = *options; + opts.format = 0; + opts.deref_ref = 0; + val_print (type, valaddr, embedded_offset, 0, stream, 0, val, &opts, + current_language); + return; + } + + /* A scalar object that does not have all bits available can't be + printed, because all bits contribute to its representation. */ + if (!value_bits_valid (val, TARGET_CHAR_BIT * embedded_offset, + TARGET_CHAR_BIT * TYPE_LENGTH (type))) + val_print_optimized_out (stream); + else + print_scalar_formatted (valaddr + embedded_offset, type, + options, size, stream); } /* Print a number according to FORMAT which is one of d,u,x,o,b,h,w,g. |