Multi-target support
[deliverable/binutils-gdb.git] / gdb / python / py-threadevent.c
index 4f822b4ae09c03c4eef9baf621fe9f2fb112fc90..3be86b71daa3327e8920926928f119732eb5da64 100644 (file)
@@ -1,4 +1,4 @@
-/* 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 = nullptr;
-
   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 == nullptr)
-    {
+       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<>
This page took 0.02805 seconds and 4 git commands to generate.