aboutsummaryrefslogtreecommitdiff
path: root/gdb/python/py-infthread.c
diff options
context:
space:
mode:
Diffstat (limited to 'gdb/python/py-infthread.c')
-rw-r--r--gdb/python/py-infthread.c24
1 files changed, 13 insertions, 11 deletions
diff --git a/gdb/python/py-infthread.c b/gdb/python/py-infthread.c
index 9ed18a3..9b90ad5 100644
--- a/gdb/python/py-infthread.c
+++ b/gdb/python/py-infthread.c
@@ -46,7 +46,7 @@ create_thread_object (struct thread_info *tp)
return NULL;
thread_obj->thread = tp;
- thread_obj->inf_obj = find_inferior_object (ptid_get_pid (tp->ptid));
+ thread_obj->inf_obj = (PyObject *) inferior_to_inferior_object (tp->inf);
return thread_obj;
}
@@ -179,7 +179,7 @@ thpy_switch (PyObject *self, PyObject *args)
TRY
{
- switch_to_thread (thread_obj->thread->ptid);
+ switch_to_thread (thread_obj->thread);
}
CATCH (except, RETURN_MASK_ALL)
{
@@ -200,7 +200,7 @@ thpy_is_stopped (PyObject *self, PyObject *args)
THPY_REQUIRE_VALID (thread_obj);
- if (is_stopped (thread_obj->thread->ptid))
+ if (thread_obj->thread->state == THREAD_STOPPED)
Py_RETURN_TRUE;
Py_RETURN_FALSE;
@@ -216,7 +216,7 @@ thpy_is_running (PyObject *self, PyObject *args)
THPY_REQUIRE_VALID (thread_obj);
- if (is_running (thread_obj->thread->ptid))
+ if (thread_obj->thread->state == THREAD_RUNNING)
Py_RETURN_TRUE;
Py_RETURN_FALSE;
@@ -232,7 +232,7 @@ thpy_is_exited (PyObject *self, PyObject *args)
THPY_REQUIRE_VALID (thread_obj);
- if (is_exited (thread_obj->thread->ptid))
+ if (thread_obj->thread->state == THREAD_EXITED)
Py_RETURN_TRUE;
Py_RETURN_FALSE;
@@ -283,13 +283,15 @@ gdbpy_create_ptid_object (ptid_t ptid)
PyObject *
gdbpy_selected_thread (PyObject *self, PyObject *args)
{
- PyObject *thread_obj;
-
- thread_obj = (PyObject *) find_thread_object (inferior_ptid);
- if (thread_obj)
+ if (inferior_ptid != null_ptid)
{
- Py_INCREF (thread_obj);
- return thread_obj;
+ PyObject *thread_obj
+ = (PyObject *) thread_to_thread_object (inferior_thread ());
+ if (thread_obj != NULL)
+ {
+ Py_INCREF (thread_obj);
+ return thread_obj;
+ }
}
Py_RETURN_NONE;