From 6501578cfe95e4a0db9f37305c7f25c1fd383929 Mon Sep 17 00:00:00 2001 From: Yao Qi Date: Mon, 10 Oct 2011 02:50:48 +0000 Subject: [PATCH] gdb/ * valprint.c (value_check_printable): Add one parameter OPTIONS. Honor OPTIONS and VAL's type. (common_val_print, value_print): Update to pass one more parameter. --- gdb/ChangeLog | 6 ++++++ gdb/valprint.c | 16 ++++++++++------ 2 files changed, 16 insertions(+), 6 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 47c815eab4..7534495bbf 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,9 @@ +2011-10-09 Yao Qi + + * valprint.c (value_check_printable): Add one parameter OPTIONS. + Honor OPTIONS and VAL's type. + (common_val_print, value_print): Update to pass one more parameter. + 2011-10-09 Doug Evans Add new "alias" command. diff --git a/gdb/valprint.c b/gdb/valprint.c index b26924a6ef..b4ac4ec466 100644 --- a/gdb/valprint.c +++ b/gdb/valprint.c @@ -399,11 +399,12 @@ val_print (struct type *type, const gdb_byte *valaddr, int embedded_offset, } /* Check whether the value VAL is printable. Return 1 if it is; - return 0 and print an appropriate error message to STREAM if it - is not. */ + return 0 and print an appropriate error message to STREAM according to + OPTIONS if it is not. */ static int -value_check_printable (struct value *val, struct ui_file *stream) +value_check_printable (struct value *val, struct ui_file *stream, + const struct value_print_options *options) { if (val == 0) { @@ -413,7 +414,10 @@ value_check_printable (struct value *val, struct ui_file *stream) if (value_entirely_optimized_out (val)) { - val_print_optimized_out (stream); + if (options->summary && !scalar_type_p (value_type (val))) + fprintf_filtered (stream, "..."); + else + val_print_optimized_out (stream); return 0; } @@ -441,7 +445,7 @@ common_val_print (struct value *val, struct ui_file *stream, int recurse, const struct value_print_options *options, const struct language_defn *language) { - if (!value_check_printable (val, stream)) + if (!value_check_printable (val, stream, options)) return 0; if (language->la_language == language_ada) @@ -467,7 +471,7 @@ int value_print (struct value *val, struct ui_file *stream, const struct value_print_options *options) { - if (!value_check_printable (val, stream)) + if (!value_check_printable (val, stream, options)) return 0; if (!options->raw)