Message ID | 1459888769-18875-1-git-send-email-donb@codesourcery.com |
---|---|
State | New |
Headers | show |
Don Breazeal <donb@codesourcery.com> writes: >> Please don't. A RETURN_MASK_ALL swallows Ctrl-C/QUIT, and that's almost >> always a bug. The cases you mention translate a QUIT to a python/scheme >> exception, which is not the same as just swallowing the exception. > > Patch below changes that back. Pedro, thanks for clarifying. > No, it doesn't. > @@ -1433,7 +1434,17 @@ 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_ALL) It should be RETURN_MASK_ERROR. > + { > + /* Fall back to checking value->optimized_out. */ > + } > + END_CATCH > + } Otherwise, patch is good to me.
On 4/6/2016 2:04 AM, Yao Qi wrote: > Don Breazeal <donb@codesourcery.com> writes: > >>> Please don't. A RETURN_MASK_ALL swallows Ctrl-C/QUIT, and that's almost >>> always a bug. The cases you mention translate a QUIT to a python/scheme >>> exception, which is not the same as just swallowing the exception. >> >> Patch below changes that back. Pedro, thanks for clarifying. >> > > No, it doesn't. > >> @@ -1433,7 +1434,17 @@ 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_ALL) > > It should be RETURN_MASK_ERROR. Sorry about that. /me shakes head at self for goofing up the easy stuff. > >> + { >> + /* Fall back to checking value->optimized_out. */ >> + } >> + END_CATCH >> + } > > Otherwise, patch is good to me. > Thanks Yao. This is now corrected and pushed in. Question: in light of Pedro's comments regarding gdbscm_value_optimized_out_p and valpy_get_is_optimized_out: > A RETURN_MASK_ALL swallows Ctrl-C/QUIT, and that's almost > always a bug. The cases you mention translate a QUIT to > a python/scheme exception, which is not the same as just > swallowing the exception. Would you still like for me to follow up with a patch to remove the TRY/CATCH blocks around the calls to value_optimized_out in those two functions? Or do we want to leave it as-is so that the QUIT handling remains unchanged? Thanks --Don
On 04/06/2016 10:41 PM, Don Breazeal wrote: > On 4/6/2016 2:04 AM, Yao Qi wrote: > Question: in light of Pedro's comments regarding > gdbscm_value_optimized_out_p and valpy_get_is_optimized_out: > >> A RETURN_MASK_ALL swallows Ctrl-C/QUIT, and that's almost >> always a bug. The cases you mention translate a QUIT to >> a python/scheme exception, which is not the same as just >> swallowing the exception. > > Would you still like for me to follow up with a patch to remove the > TRY/CATCH blocks around the calls to value_optimized_out in those two > functions? Or do we want to leave it as-is so that the QUIT handling > remains unchanged? Please leave them as is. We need to translate gdb exceptions to Python/Scheme exceptions at the gdb <-> extension-language boundaries. Those gdb functions in question will be returning to the Python/Scheme runtimes, which are not prepared to unwind correctly on a gdb exception. Thanks, Pedro Alves
On 06/04/16 22:41, Don Breazeal wrote: > Would you still like for me to follow up with a patch to remove the > TRY/CATCH blocks around the calls to value_optimized_out in those two > functions? Or do we want to leave it as-is so that the QUIT handling > remains unchanged? No, I was wrong on that point. Please leave it as-is.
diff --git a/gdb/value.c b/gdb/value.c index 8268b08..8a210e7 100644 --- a/gdb/value.c +++ b/gdb/value.c @@ -1205,7 +1205,8 @@ value_actual_type (struct value *value, int resolve_simple_types, if ((TYPE_CODE (result) == TYPE_CODE_PTR || TYPE_CODE (result) == TYPE_CODE_REF) && TYPE_CODE (check_typedef (TYPE_TARGET_TYPE (result))) - == TYPE_CODE_STRUCT) + == TYPE_CODE_STRUCT + && !value_optimized_out (value)) { struct type *real_type; @@ -1433,7 +1434,17 @@ 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_ALL) + { + /* Fall back to checking value->optimized_out. */ + } + END_CATCH + } return !VEC_empty (range_s, value->optimized_out); }