binutils-gdb/gdb/python
Tom Tromey 5c329e6ab4 Use a wrapper for PyErr_Fetch
This introduces a new class that wraps PyErr_Fetch and PyErr_Restore,
and then changes all the callers in gdb to use it.  This reduces the
amount of explicit reference counting that is done in the Python code.
I also found and fixed a latent bug in gdbpy_print_stack -- it was not
correctly checking some error conditions, nor clearing the exception
when needed.

gdb/ChangeLog
2019-01-03  Tom Tromey  <tom@tromey.com>

	* python/python.c (gdbpy_enter, ~gdbpy_enter): Update.
	(gdbpy_print_stack): Use gdbpy_err_fetch.
	* python/python-internal.h (class gdbpy_err_fetch): New class.
	(class gdbpy_enter) <m_error_type, m_error_value,
	m_error_traceback>: Remove.
	<m_error>: New member.
	(gdbpy_exception_to_string): Don't declare.
	* python/py-varobj.c (py_varobj_iter_next): Use gdbpy_err_fetch.
	* python/py-value.c (convert_value_from_python): Use
	gdbpy_err_fetch.
	* python/py-utils.c (gdbpy_err_fetch::to_string): Rename from
	gdbpy_exception_to_string.
	(gdbpy_handle_exception): Use gdbpy_err_fetch.
	* python/py-prettyprint.c (print_stack_unless_memory_error): Use
	gdbpy_err_fetch.
2019-01-03 14:49:18 -07:00
..
lib/gdb Update copyright year range in all GDB files. 2019-01-01 10:01:51 +04:00
py-all-events.def Update copyright year range in all GDB files. 2019-01-01 10:01:51 +04:00
py-arch.c Style improvements in gdb/python 2019-01-02 09:32:06 -07:00
py-auto-load.c Update copyright year range in all GDB files. 2019-01-01 10:01:51 +04:00
py-block.c Update copyright year range in all GDB files. 2019-01-01 10:01:51 +04:00
py-bpevent.c Update copyright year range in all GDB files. 2019-01-01 10:01:51 +04:00
py-breakpoint.c Style improvements in gdb/python 2019-01-02 09:32:06 -07:00
py-cmd.c Update copyright year range in all GDB files. 2019-01-01 10:01:51 +04:00
py-continueevent.c Update copyright year range in all GDB files. 2019-01-01 10:01:51 +04:00
py-event-types.def Update copyright year range in all GDB files. 2019-01-01 10:01:51 +04:00
py-event.c Update copyright year range in all GDB files. 2019-01-01 10:01:51 +04:00
py-event.h Update copyright year range in all GDB files. 2019-01-01 10:01:51 +04:00
py-events.h Update copyright year range in all GDB files. 2019-01-01 10:01:51 +04:00
py-evtregistry.c Update copyright year range in all GDB files. 2019-01-01 10:01:51 +04:00
py-evts.c Update copyright year range in all GDB files. 2019-01-01 10:01:51 +04:00
py-exitedevent.c Change inferior_to_inferior_object to return a gdbpy_ref 2019-01-02 16:28:33 -07:00
py-finishbreakpoint.c Update copyright year range in all GDB files. 2019-01-01 10:01:51 +04:00
py-frame.c Style improvements in gdb/python 2019-01-02 09:32:06 -07:00
py-framefilter.c Update copyright year range in all GDB files. 2019-01-01 10:01:51 +04:00
py-function.c Update copyright year range in all GDB files. 2019-01-01 10:01:51 +04:00
py-gdb-readline.c Update copyright year range in all GDB files. 2019-01-01 10:01:51 +04:00
py-inferior.c Change inferior_to_inferior_object to return a gdbpy_ref 2019-01-02 16:28:33 -07:00
py-infevents.c Update copyright year range in all GDB files. 2019-01-01 10:01:51 +04:00
py-infthread.c Change inferior_to_inferior_object to return a gdbpy_ref 2019-01-02 16:28:33 -07:00
py-instruction.c Update copyright year range in all GDB files. 2019-01-01 10:01:51 +04:00
py-instruction.h Update copyright year range in all GDB files. 2019-01-01 10:01:51 +04:00
py-lazy-string.c Update copyright year range in all GDB files. 2019-01-01 10:01:51 +04:00
py-linetable.c Update copyright year range in all GDB files. 2019-01-01 10:01:51 +04:00
py-newobjfileevent.c Update copyright year range in all GDB files. 2019-01-01 10:01:51 +04:00
py-objfile.c Update copyright year range in all GDB files. 2019-01-01 10:01:51 +04:00
py-param.c Update copyright year range in all GDB files. 2019-01-01 10:01:51 +04:00
py-prettyprint.c Use a wrapper for PyErr_Fetch 2019-01-03 14:49:18 -07:00
py-progspace.c Update copyright year range in all GDB files. 2019-01-01 10:01:51 +04:00
py-record-btrace.c Update copyright year range in all GDB files. 2019-01-01 10:01:51 +04:00
py-record-btrace.h Update copyright year range in all GDB files. 2019-01-01 10:01:51 +04:00
py-record-full.c Update copyright year range in all GDB files. 2019-01-01 10:01:51 +04:00
py-record-full.h Update copyright year range in all GDB files. 2019-01-01 10:01:51 +04:00
py-record.c Update copyright year range in all GDB files. 2019-01-01 10:01:51 +04:00
py-record.h Update copyright year range in all GDB files. 2019-01-01 10:01:51 +04:00
py-ref.h Update copyright year range in all GDB files. 2019-01-01 10:01:51 +04:00
py-signalevent.c Update copyright year range in all GDB files. 2019-01-01 10:01:51 +04:00
py-stopevent.c Update copyright year range in all GDB files. 2019-01-01 10:01:51 +04:00
py-stopevent.h Update copyright year range in all GDB files. 2019-01-01 10:01:51 +04:00
py-symbol.c Update copyright year range in all GDB files. 2019-01-01 10:01:51 +04:00
py-symtab.c Update copyright year range in all GDB files. 2019-01-01 10:01:51 +04:00
py-threadevent.c Update copyright year range in all GDB files. 2019-01-01 10:01:51 +04:00
py-type.c Style improvements in gdb/python 2019-01-02 09:32:06 -07:00
py-unwind.c Update copyright year range in all GDB files. 2019-01-01 10:01:51 +04:00
py-utils.c Use a wrapper for PyErr_Fetch 2019-01-03 14:49:18 -07:00
py-value.c Use a wrapper for PyErr_Fetch 2019-01-03 14:49:18 -07:00
py-varobj.c Use a wrapper for PyErr_Fetch 2019-01-03 14:49:18 -07:00
py-xmethods.c Update copyright year range in all GDB files. 2019-01-01 10:01:51 +04:00
python-config.py configure uses incorrect link order when testing libpython 2018-05-04 10:08:09 -04:00
python-internal.h Use a wrapper for PyErr_Fetch 2019-01-03 14:49:18 -07:00
python.c Use a wrapper for PyErr_Fetch 2019-01-03 14:49:18 -07:00
python.h Update copyright year range in all GDB files. 2019-01-01 10:01:51 +04:00