mirror of
https://github.com/espressif/binutils-gdb.git
synced 2025-06-19 17:18:24 +08:00
Add lval_funcs::is_optimized_out
This adds an is_optimized_out function pointer to lval_funcs, and changes value_optimized_out to call it. This new function lets gdb determine if a value is optimized out without necessarily fetching the value. This is needed for a subsequent patch, where an attempt to access a lazy value would fail due to the value size limit -- however, the access was only needed to determine the optimized-out state.
This commit is contained in:
17
gdb/value.c
17
gdb/value.c
@ -1407,10 +1407,21 @@ value_contents_writeable (struct value *value)
|
||||
int
|
||||
value_optimized_out (struct value *value)
|
||||
{
|
||||
/* We can only know if a value is optimized out once we have tried to
|
||||
fetch it. */
|
||||
if (value->optimized_out.empty () && value->lazy)
|
||||
if (value->lazy)
|
||||
{
|
||||
/* See if we can compute the result without fetching the
|
||||
value. */
|
||||
if (VALUE_LVAL (value) == lval_memory)
|
||||
return false;
|
||||
else if (VALUE_LVAL (value) == lval_computed)
|
||||
{
|
||||
const struct lval_funcs *funcs = value->location.computed.funcs;
|
||||
|
||||
if (funcs->is_optimized_out != nullptr)
|
||||
return funcs->is_optimized_out (value);
|
||||
}
|
||||
|
||||
/* Fall back to fetching. */
|
||||
try
|
||||
{
|
||||
value_fetch_lazy (value);
|
||||
|
Reference in New Issue
Block a user