From c2a44efee1cbe5321a850c53f34e9c205a1d6ca0 Mon Sep 17 00:00:00 2001 From: Tom Tromey Date: Fri, 13 Mar 2020 17:39:52 -0600 Subject: Introduce common_val_print_checked A (much) later patch will remove the call to value_check_printable from common_val_print. This will needed to preserve some details of how optimized-out structures are printed. However, doing this will also break dw2-op-out-param.exp. Making the change causes "bt" to print: However, the test wants to see: ... operand2= That is, a wholly-optimized out structure should not print its fields. So, this patch introduces a new common_val_print_checked, which calls value_check_printable first, and then arranges to use it in the one spot that affects the test suite. I was not completely sure if it would be preferable to change the test. However, I reasoned that, assuming this output was intentional in the first place, in a backtrace space is at a premium and so this is a reasonable approach. In other spots calling common_val_print, this behavior is probably unintended, or at least a "don't care". gdb/ChangeLog 2020-03-13 Tom Tromey * valprint.h (common_val_print_checked): Declare. * valprint.c (common_val_print_checked): New function. * stack.c (print_frame_arg): Use common_val_print_checked. --- gdb/valprint.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'gdb/valprint.c') diff --git a/gdb/valprint.c b/gdb/valprint.c index 66da0e6..aab43d4 100644 --- a/gdb/valprint.c +++ b/gdb/valprint.c @@ -1236,6 +1236,19 @@ common_val_print (struct value *val, struct ui_file *stream, int recurse, val, options, language); } +/* See valprint.h. */ + +void +common_val_print_checked (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, options)) + return; + common_val_print (val, stream, recurse, options, language); +} + /* Print on stream STREAM the value VAL according to OPTIONS. The value is printed using the current_language syntax. */ -- cgit v1.1