diff options
author | Tom Tromey <tom@tromey.com> | 2018-12-25 11:44:58 -0700 |
---|---|---|
committer | Tom Tromey <tom@tromey.com> | 2018-12-27 13:34:39 -0700 |
commit | 6ef2312a177ebdfa841e82b515c144975073a501 (patch) | |
tree | ba1050399bcbfe2ac09c66ed5670c97a58abe43e /gdb/python/py-unwind.c | |
parent | ec9c2750b7bab8a55aaf7d2386e809d4e81deb03 (diff) | |
download | binutils-6ef2312a177ebdfa841e82b515c144975073a501.zip binutils-6ef2312a177ebdfa841e82b515c144975073a501.tar.gz binutils-6ef2312a177ebdfa841e82b515c144975073a501.tar.bz2 |
Consolidate some Python exception-printing functions
A few places in the Python code would either call gdbpy_print_stack,
or throw a gdb "quit", depending on the pending exception. This patch
consolidates these into a helper function.
gdb/ChangeLog
2018-12-27 Tom Tromey <tom@tromey.com>
* python/python-internal.h (gdbpy_print_stack_or_quit): Declare.
* python/py-unwind.c (pyuw_sniffer): Use
gdbpy_print_stack_or_quit.
* python/py-framefilter.c (throw_quit_or_print_exception):
Remove.
(gdbpy_apply_frame_filter): Use gdbpy_print_stack_or_quit.
* python/python.c (gdbpy_print_stack_or_quit): New function.
Diffstat (limited to 'gdb/python/py-unwind.c')
-rw-r--r-- | gdb/python/py-unwind.c | 7 |
1 files changed, 1 insertions, 6 deletions
diff --git a/gdb/python/py-unwind.c b/gdb/python/py-unwind.c index 469ae48..efef4f7 100644 --- a/gdb/python/py-unwind.c +++ b/gdb/python/py-unwind.c @@ -535,12 +535,7 @@ pyuw_sniffer (const struct frame_unwind *self, struct frame_info *this_frame, { /* If the unwinder is cancelled due to a Ctrl-C, then propagate the Ctrl-C as a GDB exception instead of swallowing it. */ - if (PyErr_ExceptionMatches (PyExc_KeyboardInterrupt)) - { - PyErr_Clear (); - quit (); - } - gdbpy_print_stack (); + gdbpy_print_stack_or_quit (); return 0; } if (pyo_unwind_info == Py_None) |