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-Tag: sid-snapshot-20130801~18 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=11b4b7cc1fdcc85aeeb79d7bb1cac64542404cd5;p=external%2Fbinutils.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 fd02aa4..33e7c98 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,5 +1,10 @@ 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 before checking which bits of the parent, not the child, value are valid. diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog index 666d083..58c2dd7 100644 --- a/gdb/testsuite/ChangeLog +++ b/gdb/testsuite/ChangeLog @@ -1,5 +1,11 @@ 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. * gdb.dwarf2/pieces-optimized-out.c: New file. * gdb.dwarf2/pieces-optimized-out.S: New file. diff --git a/gdb/testsuite/gdb.dwarf2/pieces-optimized-out.exp b/gdb/testsuite/gdb.dwarf2/pieces-optimized-out.exp index 2e4d028..4effb30 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 8e0f8c4..8d635c7 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),