gdb: throw OPTIMIZED_OUT_ERROR rather than GENERIC_ERROR
While reviewing this patch: https://sourceware.org/pipermail/gdb-patches/2021-November/183227.html I spotted that the patch could be improved if we threw OPTIMIZED_OUT_ERROR rather than GENERIC_ERROR in a few places. This commit updates error_value_optimized_out and require_not_optimized_out to throw OPTIMIZED_OUT_ERROR. I ran the testsuite and saw no regressions. This doesn't really surprise me, we don't usually write code like: catch (const gdb_exception_error &ex) { (if ex.error == GENERIC_ERROR) ... else ... } There are a three places where we write something like: catch (const gdb_exception_error &ex) { (if ex.error == OPTIMIZED_OUT_ERROR) ... } In frame.c:unwind_pc, stack.c:info_frame_command_core, and value.c:value_optimized_out, but if we are hitting these cases then it's not significantly changing GDB's behaviour.
This commit is contained in:
parent
b7c9d393d6
commit
a6e7fea128
1 changed files with 3 additions and 2 deletions
|
@ -1221,7 +1221,7 @@ value_actual_type (struct value *value, int resolve_simple_types,
|
|||
void
|
||||
error_value_optimized_out (void)
|
||||
{
|
||||
error (_("value has been optimized out"));
|
||||
throw_error (OPTIMIZED_OUT_ERROR, _("value has been optimized out"));
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -1230,7 +1230,8 @@ require_not_optimized_out (const struct value *value)
|
|||
if (!value->optimized_out.empty ())
|
||||
{
|
||||
if (value->lval == lval_register)
|
||||
error (_("register has not been saved in frame"));
|
||||
throw_error (OPTIMIZED_OUT_ERROR,
|
||||
_("register has not been saved in frame"));
|
||||
else
|
||||
error_value_optimized_out ();
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue