aboutsummaryrefslogtreecommitdiff
path: root/gdb
diff options
context:
space:
mode:
authorTom Tromey <tom@tromey.com>2018-12-25 11:00:21 -0700
committerTom Tromey <tom@tromey.com>2018-12-27 13:34:38 -0700
commitec9c2750b7bab8a55aaf7d2386e809d4e81deb03 (patch)
tree043b8260bb43cb0d5db54a1c089c8d3d6c0c554b /gdb
parent6987262214a204ea3ab857d86a1faf9f4e66f211 (diff)
downloadgdb-ec9c2750b7bab8a55aaf7d2386e809d4e81deb03.zip
gdb-ec9c2750b7bab8a55aaf7d2386e809d4e81deb03.tar.gz
gdb-ec9c2750b7bab8a55aaf7d2386e809d4e81deb03.tar.bz2
Use gdbpy_convert_exception in a few more spots
I noticed a few places were converting a gdb exception to a Python exception "by hand". It's better to use the existing gdbpy_convert_exception helper function, as this handles memory errors correctly, and in the future may be enhanced in other ways. gdb/ChangeLog 2018-12-27 Tom Tromey <tom@tromey.com> * python/py-value.c (convert_value_from_python): Use gdbpy_convert_exception. * python/py-param.c (parmpy_init): Use gdbpy_convert_exception. * python/py-cmd.c (cmdpy_init): Use gdbpy_convert_exception. * python/py-breakpoint.c (bppy_init): Use gdbpy_convert_exception.
Diffstat (limited to 'gdb')
-rw-r--r--gdb/ChangeLog9
-rw-r--r--gdb/python/py-breakpoint.c4
-rw-r--r--gdb/python/py-cmd.c4
-rw-r--r--gdb/python/py-param.c4
-rw-r--r--gdb/python/py-value.c4
5 files changed, 13 insertions, 12 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 9d1b1ab..15c59b2 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,14 @@
2018-12-27 Tom Tromey <tom@tromey.com>
+ * python/py-value.c (convert_value_from_python): Use
+ gdbpy_convert_exception.
+ * python/py-param.c (parmpy_init): Use gdbpy_convert_exception.
+ * python/py-cmd.c (cmdpy_init): Use gdbpy_convert_exception.
+ * python/py-breakpoint.c (bppy_init): Use
+ gdbpy_convert_exception.
+
+2018-12-27 Tom Tromey <tom@tromey.com>
+
* configure.nat (NATDEPFILES): Use nat/ prefix.
* Makefile.in (CONFIG_SRC_SUBDIR): Add nat.
(%.o: ${srcdir}/nat/%.c): Remove rule.
diff --git a/gdb/python/py-breakpoint.c b/gdb/python/py-breakpoint.c
index d144bcf..29f6761 100644
--- a/gdb/python/py-breakpoint.c
+++ b/gdb/python/py-breakpoint.c
@@ -874,9 +874,7 @@ bppy_init (PyObject *self, PyObject *args, PyObject *kwargs)
CATCH (except, RETURN_MASK_ALL)
{
bppy_pending_object = NULL;
- PyErr_Format (except.reason == RETURN_QUIT
- ? PyExc_KeyboardInterrupt : PyExc_RuntimeError,
- "%s", except.message);
+ gdbpy_convert_exception (except);
return -1;
}
END_CATCH
diff --git a/gdb/python/py-cmd.c b/gdb/python/py-cmd.c
index 0e39730..8fca90e 100644
--- a/gdb/python/py-cmd.c
+++ b/gdb/python/py-cmd.c
@@ -579,9 +579,7 @@ cmdpy_init (PyObject *self, PyObject *args, PyObject *kw)
xfree (docstring);
xfree (pfx_name);
Py_DECREF (self);
- PyErr_Format (except.reason == RETURN_QUIT
- ? PyExc_KeyboardInterrupt : PyExc_RuntimeError,
- "%s", except.message);
+ gdbpy_convert_exception (except);
return -1;
}
END_CATCH
diff --git a/gdb/python/py-param.c b/gdb/python/py-param.c
index bff5d60..f8b151f 100644
--- a/gdb/python/py-param.c
+++ b/gdb/python/py-param.c
@@ -738,9 +738,7 @@ parmpy_init (PyObject *self, PyObject *args, PyObject *kwds)
{
xfree (cmd_name);
Py_DECREF (self);
- PyErr_Format (except.reason == RETURN_QUIT
- ? PyExc_KeyboardInterrupt : PyExc_RuntimeError,
- "%s", except.message);
+ gdbpy_convert_exception (except);
return -1;
}
END_CATCH
diff --git a/gdb/python/py-value.c b/gdb/python/py-value.c
index d21c2fa..430415b 100644
--- a/gdb/python/py-value.c
+++ b/gdb/python/py-value.c
@@ -1732,9 +1732,7 @@ convert_value_from_python (PyObject *obj)
}
CATCH (except, RETURN_MASK_ALL)
{
- PyErr_Format (except.reason == RETURN_QUIT
- ? PyExc_KeyboardInterrupt : PyExc_RuntimeError,
- "%s", except.message);
+ gdbpy_convert_exception (except);
return NULL;
}
END_CATCH