diff options
author | Tom Tromey <tom@tromey.com> | 2018-10-24 16:45:41 -0600 |
---|---|---|
committer | Tom Tromey <tom@tromey.com> | 2018-11-04 08:01:01 -0700 |
commit | a31abe80ea4c45b544f3ae04bc63ccaeba530e0f (patch) | |
tree | a6caa5b1524a6939eb14c2f65f7c61895ea42965 /gdb/varobj.c | |
parent | 833d985d1c7f69f953a5c7ddcf2af1d001504961 (diff) | |
download | gdb-a31abe80ea4c45b544f3ae04bc63ccaeba530e0f.zip gdb-a31abe80ea4c45b544f3ae04bc63ccaeba530e0f.tar.gz gdb-a31abe80ea4c45b544f3ae04bc63ccaeba530e0f.tar.bz2 |
Return gdbpy_ref from gdbpy_get_varobj_pretty_printer
This changes gdbpy_get_varobj_pretty_printer to return a gdbpy_ref.
gdb/ChangeLog
2018-11-04 Tom Tromey <tom@tromey.com>
* varobj.c (install_default_visualizer): Update.
* python/python-internal.h (gdbpy_get_varobj_pretty_printer):
Return gdbpy_ref.
* python/py-prettyprint.c (search_pp_list): Return gdbpy_ref.
(find_pretty_printer_from_progspace)
(find_pretty_printer_from_gdb, find_pretty_printer)
(gdbpy_get_varobj_pretty_printer): Return gdbpy_ref.
(gdbpy_get_varobj_pretty_printer, gdbpy_default_visualizer):
Update.
Diffstat (limited to 'gdb/varobj.c')
-rw-r--r-- | gdb/varobj.c | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/gdb/varobj.c b/gdb/varobj.c index 3ae4de8..17cfe4b 100644 --- a/gdb/varobj.c +++ b/gdb/varobj.c @@ -1115,25 +1115,22 @@ install_default_visualizer (struct varobj *var) if (pretty_printing) { - PyObject *pretty_printer = NULL; + gdbpy_ref<> pretty_printer; if (var->value != nullptr) { pretty_printer = gdbpy_get_varobj_pretty_printer (var->value.get ()); - if (! pretty_printer) + if (pretty_printer == nullptr) { gdbpy_print_stack (); error (_("Cannot instantiate printer for default visualizer")); } } - + if (pretty_printer == Py_None) - { - Py_DECREF (pretty_printer); - pretty_printer = NULL; - } + pretty_printer.release (); - install_visualizer (var->dynamic, NULL, pretty_printer); + install_visualizer (var->dynamic, NULL, pretty_printer.release ()); } } |