Multi-target support
[deliverable/binutils-gdb.git] / gdb / python / py-threadevent.c
index 1bc2fb06d54e4507291a534373120326790daa74..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;
-
   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<>
@@ -50,7 +43,7 @@ create_thread_event_object (PyTypeObject *py_type, PyObject *thread)
 {
   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;
 
This page took 0.027006 seconds and 4 git commands to generate.