diff --git a/gdb/frame.c b/gdb/frame.c index 5824020..1c1a18b 100644 --- a/gdb/frame.c +++ b/gdb/frame.c @@ -2369,8 +2369,7 @@ frame_stop_reason_string (enum unwind_stop_reason reason) case UNWIND_NO_REASON: case UNWIND_FIRST_ERROR: default: - internal_error (__FILE__, __LINE__, - "Invalid frame stop reason"); + error (_("Invalid frame stop reason")); } } diff --git a/gdb/python/py-frame.c b/gdb/python/py-frame.c index 75aa44e..2b95112 100644 --- a/gdb/python/py-frame.c +++ b/gdb/python/py-frame.c @@ -538,19 +538,20 @@ gdbpy_frame_stop_reason_string (PyObject *self, PyObject *args) { int reason; const char *str; + PyObject *py_str_reason = NULL; + volatile struct gdb_exception except; if (!PyArg_ParseTuple (args, "i", &reason)) return NULL; - if (reason < 0 || reason > UNWIND_NO_SAVED_PC) + TRY_CATCH (except, RETURN_MASK_ALL) { - PyErr_SetString (PyExc_ValueError, - _("Invalid frame stop reason.")); - return NULL; + str = frame_stop_reason_string (reason); + py_str_reason = PyUnicode_Decode (str, strlen (str), host_charset (), NULL); } + GDB_PY_HANDLE_EXCEPTION (except); - str = frame_stop_reason_string (reason); - return PyUnicode_Decode (str, strlen (str), host_charset (), NULL); + return py_str_reason; } /* Implements the equality comparison for Frame objects.