From: Andrew Burgess Date: Tue, 30 Jul 2013 15:36:18 +0000 (+0000) Subject: Don't raise an error for optimized out sub-fields. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=11b4b7cc1fdcc85aeeb79d7bb1cac64542404cd5;p=binutils-gdb.git Don't raise an error for optimized out sub-fields. http://sourceware.org/ml/gdb-patches/2013-07/msg00317.html gdb/ChangeLog * value.c (value_fetch_lazy): Mark optimized out values as such rather than raising an error. gdb/testsuite/ChangeLog * gdb.dwarf2/pieces-optimized-out.exp: Expect "" when printing an optimized out value. Expect an error when using an optimized out value in an expression. --- diff --git a/gdb/ChangeLog b/gdb/ChangeLog index fd02aa4b175..33e7c98b9df 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,8 @@ +2013-07-30 Andrew Burgess + + * value.c (value_fetch_lazy): Mark optimized out values as such + rather than raising an error. + 2013-07-30 Andrew Burgess * value.c (value_fetch_lazy): Ensure parent value is not lazy diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog index 666d0831aa8..58c2dd79db4 100644 --- a/gdb/testsuite/ChangeLog +++ b/gdb/testsuite/ChangeLog @@ -1,3 +1,9 @@ +2013-07-30 Andrew Burgess + + * gdb.dwarf2/pieces-optimized-out.exp: Expect "" + when printing an optimized out value. Expect an error when using + an optimized out value in an expression. + 2013-07-30 Andrew Burgess * gdb.dwarf2/pieces-optimized-out.exp: New file. diff --git a/gdb/testsuite/gdb.dwarf2/pieces-optimized-out.exp b/gdb/testsuite/gdb.dwarf2/pieces-optimized-out.exp index 2e4d028ca09..4effb30db4f 100644 --- a/gdb/testsuite/gdb.dwarf2/pieces-optimized-out.exp +++ b/gdb/testsuite/gdb.dwarf2/pieces-optimized-out.exp @@ -44,6 +44,7 @@ gdb_test "p s" \ "print s" gdb_test "p s.a" " = 5" "print s.a" gdb_test "p s.b" " = " "print s.b" -gdb_test "p s.c" "value has been optimized out" "print s.c" -gdb_test "p s.d" "value has been optimized out" "print s.d" +gdb_test "p s.c" " = " "print s.c" +gdb_test "p s.d" " = " "print s.d" +gdb_test "p s.d + 1" "value has been optimized out" "print s.d + 1" diff --git a/gdb/value.c b/gdb/value.c index 8e0f8c4dcc0..8d635c7bc25 100644 --- a/gdb/value.c +++ b/gdb/value.c @@ -3439,9 +3439,8 @@ value_fetch_lazy (struct value *val) if (!value_bits_valid (parent, TARGET_CHAR_BIT * offset + value_bitpos (val), value_bitsize (val))) - error (_("value has been optimized out")); - - if (!unpack_value_bits_as_long (value_type (val), + set_value_optimized_out (val, 1); + else if (!unpack_value_bits_as_long (value_type (val), value_contents_for_printing (parent), offset, value_bitpos (val),