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 "<optimized out>"
        when printing an optimized out value.  Expect an error when using
        an optimized out value in an expression.
This commit is contained in:
Andrew Burgess 2013-07-30 15:36:18 +00:00
parent b0c54aa509
commit 11b4b7cc1f
4 changed files with 16 additions and 5 deletions

View File

@ -1,3 +1,8 @@
2013-07-30 Andrew Burgess <aburgess@broadcom.com>
* value.c (value_fetch_lazy): Mark optimized out values as such
rather than raising an error.
2013-07-30 Andrew Burgess <aburgess@broadcom.com>
* value.c (value_fetch_lazy): Ensure parent value is not lazy

View File

@ -1,3 +1,9 @@
2013-07-30 Andrew Burgess <aburgess@broadcom.com>
* gdb.dwarf2/pieces-optimized-out.exp: Expect "<optimized out>"
when printing an optimized out value. Expect an error when using
an optimized out value in an expression.
2013-07-30 Andrew Burgess <aburgess@broadcom.com>
* gdb.dwarf2/pieces-optimized-out.exp: New file.

View File

@ -44,6 +44,7 @@ gdb_test "p s" \
"print s"
gdb_test "p s.a" " = 5" "print s.a"
gdb_test "p s.b" " = <optimized out>" "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" " = <optimized out>" "print s.c"
gdb_test "p s.d" " = <optimized out>" "print s.d"
gdb_test "p s.d + 1" "value has been optimized out" "print s.d + 1"

View File

@ -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),