binutils-gdb/gdb/python
Tom Tromey d4b0bb186e Remove some ui_out-related cleanups from Python
This patch introduces a bit of infrastructure -- namely, a minimal
std::optional analogue called gdb::optional, and an RAII template
class that works like make_cleanup_ui_out_tuple_begin_end or
make_cleanup_ui_out_list_begin_end -- and then uses these in the
Python code.  This removes a number of cleanups and generally
simplifies this code.

std::optional is only available in C++17.  Normally I would have had
this code check __cplusplus, but my gcc apparently isn't new enough to
find <optional>, even with -std=c++1z; so, because I could not test
it, the patch does not do this.

gdb/ChangeLog
2017-02-10  Tom Tromey  <tom@tromey.com>

	* ui-out.h (ui_out_emit_type): New class.
	(ui_out_emit_tuple, ui_out_emit_list): New typedefs.
	* python/py-framefilter.c (py_print_single_arg): Use gdb::optional
	and ui_out_emit_tuple.
	(enumerate_locals): Likewise.
	(py_mi_print_variables, py_print_locals, py_print_args): Use
	ui_out_emit_list.
	(py_print_frame): Use gdb::optional, ui_out_emit_tuple,
	ui_out_emit_list.
	* common/gdb_optional.h: New file.
2017-02-10 12:24:31 -07:00
..
lib/gdb update copyright year range in GDB files 2017-01-01 10:52:34 +04:00
py-arch.c Eliminate make_cleanup_ui_file_delete / make ui_file a class hierarchy 2017-02-02 11:11:47 +00:00
py-auto-load.c update copyright year range in GDB files 2017-01-01 10:52:34 +04:00
py-block.c update copyright year range in GDB files 2017-01-01 10:52:34 +04:00
py-bpevent.c Change event code to use gdbpy_ref 2017-01-10 19:13:29 -07:00
py-breakpoint.c Eliminate make_cleanup_ui_file_delete / make ui_file a class hierarchy 2017-02-02 11:11:47 +00:00
py-cmd.c Use gdbpy_ref in py-cmd.c 2017-01-10 19:14:01 -07:00
py-continueevent.c Change event code to use gdbpy_ref 2017-01-10 19:13:29 -07:00
py-event.c Change event code to use gdbpy_ref 2017-01-10 19:13:29 -07:00
py-event.h Change event code to use gdbpy_ref 2017-01-10 19:13:29 -07:00
py-events.h update copyright year range in GDB files 2017-01-01 10:52:34 +04:00
py-evtregistry.c update copyright year range in GDB files 2017-01-01 10:52:34 +04:00
py-evts.c update copyright year range in GDB files 2017-01-01 10:52:34 +04:00
py-exitedevent.c Change event code to use gdbpy_ref 2017-01-10 19:13:29 -07:00
py-finishbreakpoint.c Use gdbpy_ref in bpfinishpy_out_of_scope 2017-01-10 19:14:01 -07:00
py-frame.c Eliminate make_cleanup_ui_file_delete / make ui_file a class hierarchy 2017-02-02 11:11:47 +00:00
py-framefilter.c Remove some ui_out-related cleanups from Python 2017-02-10 12:24:31 -07:00
py-function.c Fix Py_DECREF being executed without holding the GIL 2017-01-20 21:06:51 -05:00
py-gdb-readline.c Fix python-interactive with Python 3.6 2017-01-20 20:39:08 -05:00
py-inferior.c Minor simplification of (Python) find_thread_object 2017-01-23 15:31:40 -05:00
py-infevents.c Change event code to use gdbpy_ref 2017-01-10 19:13:29 -07:00
py-infthread.c update copyright year range in GDB files 2017-01-01 10:52:34 +04:00
py-lazy-string.c Change type of encoding argument to gdbpy_extract_lazy_string 2017-01-10 19:13:55 -07:00
py-linetable.c Use gdbpy_ref in py-linetable.c 2017-01-10 19:13:34 -07:00
py-newobjfileevent.c Change event code to use gdbpy_ref 2017-01-10 19:13:29 -07:00
py-objfile.c Use class to manage BFD reference counts 2017-01-10 19:14:10 -07:00
py-param.c Use gdbpy_ref in py-param.c 2017-01-10 19:14:04 -07:00
py-prettyprint.c Use gdbpy_ref in py-prettyprint.c 2017-01-10 19:13:58 -07:00
py-progspace.c Use gdbpy_enter in py-progspace.c 2017-01-10 19:13:42 -07:00
py-ref.h Add gdb_ref_ptr.h 2017-01-10 19:14:09 -07:00
py-signalevent.c Change event code to use gdbpy_ref 2017-01-10 19:13:29 -07:00
py-stopevent.c Change event code to use gdbpy_ref 2017-01-10 19:13:29 -07:00
py-stopevent.h update copyright year range in GDB files 2017-01-01 10:52:34 +04:00
py-symbol.c Use gdbpy_ref in gdbpy_lookup_symbol 2017-01-10 19:13:38 -07:00
py-symtab.c update copyright year range in GDB files 2017-01-01 10:52:34 +04:00
py-threadevent.c Change event code to use gdbpy_ref 2017-01-10 19:13:29 -07:00
py-type.c Eliminate make_cleanup_ui_file_delete / make ui_file a class hierarchy 2017-02-02 11:11:47 +00:00
py-unwind.c Eliminate make_cleanup_ui_file_delete / make ui_file a class hierarchy 2017-02-02 11:11:47 +00:00
py-utils.c Remove make_cleanup_py_decref and make_cleanup_py_xdecref 2017-01-10 19:14:08 -07:00
py-value.c Eliminate make_cleanup_ui_file_delete / make ui_file a class hierarchy 2017-02-02 11:11:47 +00:00
py-varobj.c Use gdbpy_enter_varobj in py-varobj.c 2017-01-10 19:13:51 -07:00
py-xmethods.c Fix Py_DECREF being executed without holding the GIL 2017-01-20 21:06:51 -05:00
python-config.py Add support for Python 3. 2012-12-12 16:47:30 +00:00
python-internal.h Fix python-interactive with Python 3.6 2017-01-20 20:39:08 -05:00
python.c Remove cleanups from execute_gdb_command 2017-01-10 19:14:14 -07:00
python.h update copyright year range in GDB files 2017-01-01 10:52:34 +04:00