diff options
author | Pedro Alves <palves@redhat.com> | 2011-01-25 17:59:00 +0000 |
---|---|---|
committer | Pedro Alves <palves@redhat.com> | 2011-01-25 17:59:00 +0000 |
commit | ab2188aa2a7958d3954f98229002036867278636 (patch) | |
tree | decbfba60b0a7e0f21b6b3f5362675a349aad13b /gdb/valprint.c | |
parent | 66d61a4cabfc231963c2d901d345198498d9aa21 (diff) | |
download | gdb-ab2188aa2a7958d3954f98229002036867278636.zip gdb-ab2188aa2a7958d3954f98229002036867278636.tar.gz gdb-ab2188aa2a7958d3954f98229002036867278636.tar.bz2 |
* printcmd.c (print_formatted): Use val_print_scalar_formatted
instead of print_scalar_formatted.
(print_scalar_formatted): Don't handle 's' format strings here,
and add an assertion that we never see such format here.
* valprint.h (val_print_scalar_formatted): Declare.
* valprint.c (val_print_scalar_formatted): New.
* c-valprint.c (c_val_print): Use val_print_scalar_formatted
instead of print_scalar_formatted.
* jv-valprint.c (java_val_print): Ditto.
* p-valprint.c (pascal_val_print): Ditto.
* ada-valprint.c (ada_val_print_1): Ditto.
* f-valprint.c (f_val_print): Ditto.
* infcmd.c (registers_info): Ditto.
* m2-valprint.c (m2_val_print): Ditto.
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. |