aboutsummaryrefslogtreecommitdiff
path: root/gdb/python/py-infthread.c
diff options
context:
space:
mode:
authorTom Tromey <tom@tromey.com>2019-01-02 09:58:14 -0700
committerTom Tromey <tom@tromey.com>2019-01-02 16:28:33 -0700
commit61fd3e738919700c8d0fbb942519d72a767d90b1 (patch)
treecac5f01b3d3ff229654cd69ea8c60b8afb817038 /gdb/python/py-infthread.c
parentd20172fc53017cef12d64b21aa2fdac72072558c (diff)
downloadgdb-61fd3e738919700c8d0fbb942519d72a767d90b1.zip
gdb-61fd3e738919700c8d0fbb942519d72a767d90b1.tar.gz
gdb-61fd3e738919700c8d0fbb942519d72a767d90b1.tar.bz2
Change inferior_to_inferior_object to return a gdbpy_ref
Most callers of inferior_to_inferior_object already use a gdbpy_ref, so this changes inferior_to_inferior_object to return one. Doing this revealed that create_thread_object was not correctly handling the case where inferior_to_inferior_object failed, so this patch fixes this as well. gdb/ChangeLog 2019-01-02 Tom Tromey <tom@tromey.com> * python/python-internal.h (inferior_to_inferior_object): Change return type. * python/py-exitedevent.c (create_exited_event_object): Update. * python/py-inferior.c (inferior_to_inferior_object): Return gdbpy_ref. (python_new_inferior, python_inferior_deleted) (thread_to_thread_object, delete_thread_object) (build_inferior_list, gdbpy_selected_inferior): Update. * python/py-infthread.c (create_thread_object): Update. Also fail if inferior_to_inferior_object fails.
Diffstat (limited to 'gdb/python/py-infthread.c')
-rw-r--r--gdb/python/py-infthread.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/gdb/python/py-infthread.c b/gdb/python/py-infthread.c
index e15e281..bf90d08 100644
--- a/gdb/python/py-infthread.c
+++ b/gdb/python/py-infthread.c
@@ -41,12 +41,16 @@ create_thread_object (struct thread_info *tp)
{
thread_object *thread_obj;
+ gdbpy_ref<inferior_object> inf_obj = inferior_to_inferior_object (tp->inf);
+ if (inf_obj == NULL)
+ return NULL;
+
thread_obj = PyObject_New (thread_object, &thread_object_type);
if (!thread_obj)
return NULL;
thread_obj->thread = tp;
- thread_obj->inf_obj = (PyObject *) inferior_to_inferior_object (tp->inf);
+ thread_obj->inf_obj = (PyObject *) inf_obj.release ();
return thread_obj;
}