-/* Copyright (C) 2009-2018 Free Software Foundation, Inc.
+/* Copyright (C) 2009-2020 Free Software Foundation, Inc.
This file is part of GDB.
/* See py-event.h. */
-PyObject *
+gdbpy_ref<>
py_get_event_thread (ptid_t ptid)
{
- PyObject *pythread;
-
if (non_stop)
{
- thread_info *thread = find_thread_ptid (ptid);
+ thread_info *thread
+ = find_thread_ptid (current_inferior ()->process_target (),
+ ptid);
if (thread != nullptr)
- pythread = (PyObject *) thread_to_thread_object (thread);
- }
- else
- pythread = Py_None;
-
- if (!pythread)
- {
+ return thread_to_thread_object (thread);
PyErr_SetString (PyExc_RuntimeError, "Could not find event thread");
return NULL;
}
-
- return pythread;
+ return gdbpy_ref<>::new_reference (Py_None);
}
gdbpy_ref<>
{
gdb_assert (thread != NULL);
- gdbpy_ref<> thread_event_obj (create_event_object (py_type));
+ gdbpy_ref<> thread_event_obj = create_event_object (py_type);
if (thread_event_obj == NULL)
return NULL;