diff --git a/gdb/dwarf2/frame-tailcall.c b/gdb/dwarf2/frame-tailcall.c index 16dba2b201a..ec6ed6bb00e 100644 --- a/gdb/dwarf2/frame-tailcall.c +++ b/gdb/dwarf2/frame-tailcall.c @@ -377,7 +377,6 @@ dwarf2_tailcall_sniffer_first (struct frame_info *this_frame, get_frame_address_in_block will decrease it by 1 in such case. */ this_pc = get_frame_address_in_block (this_frame); - /* Catch any unwinding errors. */ try { int sp_regnum; @@ -439,7 +438,22 @@ dwarf2_tailcall_sniffer_first (struct frame_info *this_frame, { if (entry_values_debug) exception_print (gdb_stdout, except); - return; + + switch (except.error) + { + case NO_ENTRY_VALUE_ERROR: + /* Thrown by call_site_find_chain. */ + case MEMORY_ERROR: + case OPTIMIZED_OUT_ERROR: + case NOT_AVAILABLE_ERROR: + /* These can normally happen when we try to access an + optimized out or unavailable register, either in a + physical register or spilled to memory. */ + return; + } + + /* Let unexpected errors propagate. */ + throw; } /* Ambiguous unwind or unambiguous unwind verified as matching. */ diff --git a/gdb/value.c b/gdb/value.c index 97a099ddbd3..00d8ded2ae0 100644 --- a/gdb/value.c +++ b/gdb/value.c @@ -1412,7 +1412,18 @@ value_optimized_out (struct value *value) } catch (const gdb_exception_error &ex) { - /* Fall back to checking value->optimized_out. */ + switch (ex.error) + { + case MEMORY_ERROR: + case OPTIMIZED_OUT_ERROR: + case NOT_AVAILABLE_ERROR: + /* These can normally happen when we try to access an + optimized out or unavailable register, either in a + physical register or spilled to memory. */ + break; + default: + throw; + } } }