value_fetch_lazy, ensure parent is not lazy and check parent for validity.

http://sourceware.org/ml/gdb-patches/2013-07/msg00316.html

gdb/ChangeLog

        * value.c (value_fetch_lazy): Ensure parent value is not lazy
        before checking which bits of the parent, not the child, value are
        valid.

gdb/testsuite/ChangeLog

        * gdb.dwarf2/pieces-optimized-out.exp: New file.
        * gdb.dwarf2/pieces-optimized-out.c: New file.
        * gdb.dwarf2/pieces-optimized-out.S: New file.
This commit is contained in:
Andrew Burgess
2013-07-30 15:05:01 +00:00
parent 97c85fc673
commit b0c54aa509
6 changed files with 660 additions and 1 deletions

View File

@@ -3433,7 +3433,10 @@ value_fetch_lazy (struct value *val)
LONGEST offset = value_offset (val);
LONGEST num;
if (!value_bits_valid (val,
if (value_lazy (parent))
value_fetch_lazy (parent);
if (!value_bits_valid (parent,
TARGET_CHAR_BIT * offset + value_bitpos (val),
value_bitsize (val)))
error (_("value has been optimized out"));