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.
This commit is contained in:
Tom Tromey 2018-12-25 11:44:58 -07:00
parent ec9c2750b7
commit 6ef2312a17
5 changed files with 29 additions and 24 deletions

View file

@ -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_print_stack_or_quit ();
void gdbpy_handle_exception () ATTRIBUTE_NORETURN;
gdbpy_ref<> python_string_to_unicode (PyObject *obj);