29 #define THPY_REQUIRE_VALID(Thread) \
31 if (!Thread->thread) \
33 PyErr_SetString (PyExc_RuntimeError, \
34 _("Thread no longer exists.")); \
76 return PyString_FromString (name);
87 PyErr_SetString (PyExc_RuntimeError,
_(
"Thread no longer exists."));
93 PyErr_SetString (PyExc_TypeError,
94 _(
"Cannot delete `name' attribute."));
97 else if (newvalue == Py_None)
101 PyErr_SetString (PyExc_TypeError,
102 _(
"The value of `name' must be a string."));
125 return PyLong_FromLong (thread_obj->
thread->
num);
238 ret = PyTuple_New (3);
246 PyTuple_SET_ITEM (ret, 0, PyInt_FromLong (pid));
247 PyTuple_SET_ITEM (ret, 1, PyInt_FromLong (lwp));
248 PyTuple_SET_ITEM (ret, 2, PyInt_FromLong (tid));
259 PyObject *thread_obj;
264 Py_INCREF (thread_obj);
284 "The name of the thread, as set by the user or the OS.", NULL },
285 {
"num",
thpy_get_num, NULL,
"ID of the thread, as assigned by GDB.", NULL },
286 {
"ptid",
thpy_get_ptid, NULL,
"ID of the thread, as assigned by the OS.",
295 "is_valid () -> Boolean.\n\
296 Return true if this inferior thread is valid, false if not." },
299 Makes this the GDB selected thread." },
301 "is_stopped () -> Boolean\n\
302 Return whether the thread is stopped." },
304 "is_running () -> Boolean\n\
305 Return whether the thread is running." },
307 "is_exited () -> Boolean\n\
308 Return whether the thread is exited." },
316 "gdb.InferiorThread",
334 Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_ITER,
342 thread_object_methods,
344 thread_object_getset,
int gdb_pymodule_addobject(PyObject *module, const char *name, PyObject *object)
static PyObject * thpy_is_exited(PyObject *self, PyObject *args)
int gdbpy_initialize_thread(void)
PyTypeObject thread_object_type
static PyMethodDef thread_object_methods[]
static PyObject * thpy_get_num(PyObject *self, void *closure)
static PyObject * thpy_is_valid(PyObject *self, PyObject *args)
thread_object * create_thread_object(struct thread_info *tp)
int gdbpy_is_string(PyObject *obj)
void switch_to_thread(ptid_t ptid)
char * target_thread_name(struct thread_info *info)
static PyGetSetDef thread_object_getset[]
static PyObject * thpy_get_ptid(PyObject *self, void *closure)
#define GDB_PY_HANDLE_EXCEPTION(Exception)
PyObject * gdbpy_create_ptid_object(ptid_t ptid)
int is_stopped(ptid_t ptid)
#define CATCH(EXCEPTION, MASK)
thread_object * find_thread_object(ptid_t ptid)
char * python_string_to_host_string(PyObject *obj)
static PyObject * thpy_is_running(PyObject *self, PyObject *args)
#define THPY_REQUIRE_VALID(Thread)
PyObject * gdbpy_selected_thread(PyObject *self, PyObject *args)
PyObject_HEAD struct thread_info * thread
int ptid_get_pid(ptid_t ptid)
static PyObject * thpy_is_stopped(PyObject *self, PyObject *args)
long ptid_get_tid(ptid_t ptid)
PyTypeObject thread_object_type CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF("thread_object")
PyObject * find_inferior_object(int pid)
static int thpy_set_name(PyObject *self, PyObject *newvalue, void *ignore)
static PyObject * thpy_switch(PyObject *self, PyObject *args)
static void thpy_dealloc(PyObject *self)
int is_exited(ptid_t ptid)
static int ignore(struct target_ops *ops, struct gdbarch *gdbarch, struct bp_target_info *bp_tgt)
long ptid_get_lwp(ptid_t ptid)
static PyObject * thpy_get_name(PyObject *self, void *ignore)
int is_running(ptid_t ptid)
mach_port_t mach_port_t name mach_port_t mach_port_t name error_t int int rusage_t pid_t pid
#define PyVarObject_HEAD_INIT(type, size)