diff --git a/gdb/inferior.h b/gdb/inferior.h index f98e67d33f4..9e0e3b30e88 100644 --- a/gdb/inferior.h +++ b/gdb/inferior.h @@ -68,7 +68,18 @@ struct infcall_suspend_state_deleter { void operator() (struct infcall_suspend_state *state) const { - restore_infcall_suspend_state (state); + try + { + restore_infcall_suspend_state (state); + } + catch (const gdb_exception_error &e) + { + /* If we are restoring the inferior state due to an exception, + some error message will be printed. So, only warn the user + when we cannot restore during normal execution. */ + if (!std::uncaught_exception ()) + warning (_("Failed to restore inferior state: %s"), e.what ()); + } } };