This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] Eliminate -var-create error for optzd ptr to struct


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 (éå)


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]