Eliminate -var-create error for optzd ptr to struct
This patch eliminates an error thrown when accessing the value of a
pointer to a structure where the pointer has been optimized out and
'set print object' is 'on'. The error shows up as the rather ugly
value of the pointer variable in Eclipse.
If 'set print object' is 'on', GDB tries to determine the actual
(derived) type of the object rather than the declared type, which
requires dereferencing the pointer, which in this cases throws an
error because the pointer has been optimized out.
The fix is to simply ignore the 'print object on' setting for
pointers or references to structures when they have been optimized
out. This means we just get the declared type instead of the actual
type, because in this case that's the best that we can do.
To implement the fix, value_optimized_out was modified so that it
no longer throws an error when it fails to fetch the specified
value. Instead, it just checks value->optimized_out. If we can't
definitively say that the value is optimized out, then we assume
it is not.
gdb/ChangeLog:
2016-04-06 Don Breazeal <donb@codesourcery.com>
* value.c (value_actual_type): Don't try to get rtti type
of the value if it has been optimized out.
(value_optimized_out): If a memory access error occurs,
just check vaue->optimized_out.