aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Tromey <tom@tromey.com>2016-11-20 10:27:59 -0700
committerTom Tromey <tom@tromey.com>2017-01-10 19:14:02 -0700
commit74c49d454b81c84fcffbc090466e241bdefd2f3a (patch)
tree349e690b1fa768b68e1efea05124e4887a7aecdc
parent16361ffbd145c877952f3c124c247460a6005d26 (diff)
downloadgdb-74c49d454b81c84fcffbc090466e241bdefd2f3a.zip
gdb-74c49d454b81c84fcffbc090466e241bdefd2f3a.tar.gz
gdb-74c49d454b81c84fcffbc090466e241bdefd2f3a.tar.bz2
Use gdbpy_ref in py_print_frame
This changes py_print_frame to use gdbpy_ref in more places. 2017-01-10 Tom Tromey <tom@tromey.com> * python/py-framefilter.c (py_print_frame): Use gdbpy_ref.
-rw-r--r--gdb/ChangeLog4
-rw-r--r--gdb/python/py-framefilter.c14
2 files changed, 8 insertions, 10 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 912b51a..ce31184 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,9 @@
2017-01-10 Tom Tromey <tom@tromey.com>
+ * python/py-framefilter.c (py_print_frame): Use gdbpy_ref.
+
+2017-01-10 Tom Tromey <tom@tromey.com>
+
* python/py-finishbreakpoint.c (bpfinishpy_out_of_scope): Use
gdbpy_ref.
diff --git a/gdb/python/py-framefilter.c b/gdb/python/py-framefilter.c
index 3a7132b..7a7dfbc 100644
--- a/gdb/python/py-framefilter.c
+++ b/gdb/python/py-framefilter.c
@@ -1009,7 +1009,6 @@ py_print_frame (PyObject *filter, int flags,
struct frame_info *frame = NULL;
struct cleanup *cleanup_stack;
struct value_print_options opts;
- PyObject *py_inf_frame;
int print_level, print_frame_info, print_args, print_locals;
gdb::unique_xmalloc_ptr<char> function_to_free;
@@ -1024,14 +1023,11 @@ py_print_frame (PyObject *filter, int flags,
/* Get the underlying frame. This is needed to determine GDB
architecture, and also, in the cases of frame variables/arguments to
read them if they returned filter object requires us to do so. */
- py_inf_frame = PyObject_CallMethod (filter, "inferior_frame", NULL);
+ gdbpy_ref py_inf_frame (PyObject_CallMethod (filter, "inferior_frame", NULL));
if (py_inf_frame == NULL)
return EXT_LANG_BT_ERROR;
- frame = frame_object_to_frame_info (py_inf_frame);;
-
- Py_DECREF (py_inf_frame);
-
+ frame = frame_object_to_frame_info (py_inf_frame.get ());
if (frame == NULL)
return EXT_LANG_BT_ERROR;
@@ -1085,7 +1081,7 @@ py_print_frame (PyObject *filter, int flags,
address printing. */
if (PyObject_HasAttrString (filter, "address"))
{
- PyObject *paddr = PyObject_CallMethod (filter, "address", NULL);
+ gdbpy_ref paddr (PyObject_CallMethod (filter, "address", NULL));
if (paddr == NULL)
{
@@ -1095,16 +1091,14 @@ py_print_frame (PyObject *filter, int flags,
if (paddr != Py_None)
{
- if (get_addr_from_python (paddr, &address) < 0)
+ if (get_addr_from_python (paddr.get (), &address) < 0)
{
- Py_DECREF (paddr);
do_cleanups (cleanup_stack);
return EXT_LANG_BT_ERROR;
}
has_addr = 1;
}
- Py_DECREF (paddr);
}
}