From 2b4ad2fe4300489fd40dbe07e1675ff1cf0bee58 Mon Sep 17 00:00:00 2001 From: Tom Tromey Date: Sat, 15 Sep 2018 00:57:12 -0600 Subject: Consolidate gdb.GdbError handling I noticed two nearly identical copies of the same code for handling gdb.GdbError. The only differences were in some error messages. These differences didn't seem very important, so this patch pulls the code out into a new function. 2018-09-23 Tom Tromey * python/py-function.c (fnpy_call): Use gdbpy_handle_exception. * python/py-cmd.c (cmdpy_function): Use gdbpy_handle_exception. * python/python-internal.h (gdbpy_handle_exception): Declare. * python/py-utils.c (gdbpy_handle_exception): New function. --- gdb/python/python-internal.h | 1 + 1 file changed, 1 insertion(+) (limited to 'gdb/python/python-internal.h') diff --git a/gdb/python/python-internal.h b/gdb/python/python-internal.h index e32502d..1812abb 100644 --- a/gdb/python/python-internal.h +++ b/gdb/python/python-internal.h @@ -654,6 +654,7 @@ extern const struct language_defn *python_language; int gdbpy_print_python_errors_p (void); void gdbpy_print_stack (void); +void gdbpy_handle_exception () ATTRIBUTE_NORETURN; PyObject *python_string_to_unicode (PyObject *obj); gdb::unique_xmalloc_ptr unicode_to_target_string (PyObject *unicode_str); -- cgit v1.1