This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [PATCH] Eliminate -var-create error for optzd ptr to struct
- From: Yao Qi <qiyaoltc at gmail dot com>
- To: Don Breazeal <donb at codesourcery dot com>
- Cc: <qiyaoltc at gmail dot com>, <gdb-patches at sourceware dot org>
- Date: Tue, 05 Apr 2016 13:52:54 +0100
- Subject: Re: [PATCH] Eliminate -var-create error for optzd ptr to struct
- Authentication-results: sourceware.org; auth=none
- References: <1459805313-6418-1-git-send-email-donb at codesourcery dot com>
Don Breazeal <donb@codesourcery.com> writes:
Hi Don,
> @@ -1433,7 +1434,18 @@ value_optimized_out (struct value *value)
> /* We can only know if a value is optimized out once we have tried to
> fetch it. */
> if (VEC_empty (range_s, value->optimized_out) && value->lazy)
> - value_fetch_lazy (value);
> + {
> + TRY
> + {
> + value_fetch_lazy (value);
> + }
> + CATCH (ex, RETURN_MASK_ERROR)
> + {
> + /* If we get an error, assume the value is not optimized out. */
> + return 0;
Why don't we fall back to checking value->optimized_out below? Some
bits/pieces of value are optimized out, but reading the rest of
bits/piece may trigger the memory error. In this case, the value is
optimized out too. We can do this...
TRY
{
value_fetch_lazy (value);
}
CATCH (ex, RETURN_MASK_ERROR)
{
/* Fall back to checking value->optimized_out. */
}
END_CATCH
What do you think?
> + }
> + END_CATCH
> + }
>
> return !VEC_empty (range_s, value->optimized_out);
Note that, after this patch, value_optimized_out will no longer throw
exceptions, some TRY/CATCH in value_optimized_out's callers can be
removed, such as gdbscm_value_optimized_out_p and
valpy_get_is_optimized_out. This can be done in a follow-up patch.
--
Yao (éå)