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)
103 PyErr_SetString (PyExc_TypeError,
104 _(
"The value of `name' must be a string."));
265 ret = PyTuple_New (3);
273 PyTuple_SET_ITEM (ret, 0, PyInt_FromLong (
pid));
274 PyTuple_SET_ITEM (ret, 1, PyInt_FromLong (
lwp));
275 PyTuple_SET_ITEM (ret, 2, PyInt_FromLong (
tid));
311 "The name of the thread, as set by the user or the OS.", NULL },
313 "Per-inferior number of the thread, as assigned by GDB.", NULL },
315 "Global number of the thread, as assigned by GDB.", NULL },
316 {
"ptid",
thpy_get_ptid, NULL,
"ID of the thread, as assigned by the OS.",
319 "The Inferior object this thread belongs to.", NULL },
327 "is_valid () -> Boolean.\n\ 328 Return true if this inferior thread is valid, false if not." },
331 Makes this the GDB selected thread." },
333 "is_stopped () -> Boolean\n\ 334 Return whether the thread is stopped." },
336 "is_running () -> Boolean\n\ 337 Return whether the thread is running." },
339 "is_exited () -> Boolean\n\ 340 Return whether the thread is exited." },
348 "gdb.InferiorThread",
366 Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_ITER,
int gdb_pymodule_addobject(PyObject *module, const char *name, PyObject *object)
static PyObject * thpy_is_exited(PyObject *self, PyObject *args)
static constexpr ptid_t tid
int gdbpy_initialize_thread(void)
PyTypeObject thread_object_type
static PyMethodDef thread_object_methods[]
static PyObject * thpy_get_num(PyObject *self, void *closure)
int ptid_get_pid(const ptid_t &ptid)
mach_port_t mach_port_t name mach_port_t mach_port_t name kern_return_t int int rusage_t pid_t pid
static PyObject * thpy_is_valid(PyObject *self, PyObject *args)
thread_object * create_thread_object(struct thread_info *tp)
int gdbpy_is_string(PyObject *obj)
#define PyVarObject_HEAD_INIT(type, size)
static PyObject * thpy_get_ptid(PyObject *self, void *closure)
#define GDB_PY_HANDLE_EXCEPTION(Exception)
void switch_to_thread(ptid_t ptid)
PyObject * gdbpy_create_ptid_object(ptid_t ptid)
int is_stopped(ptid_t ptid)
#define CATCH(EXCEPTION, MASK)
std::unique_ptr< T, xfree_deleter< T > > unique_xmalloc_ptr
long ptid_get_tid(const ptid_t &ptid)
thread_object * find_thread_object(ptid_t ptid)
static PyObject * thpy_is_running(PyObject *self, PyObject *args)
gdb::unique_xmalloc_ptr< char > python_string_to_host_string(PyObject *obj)
long ptid_get_lwp(const ptid_t &ptid)
#define THPY_REQUIRE_VALID(Thread)
PyObject * gdbpy_selected_thread(PyObject *self, PyObject *args)
PyObject_HEAD struct thread_info * thread
const char * target_thread_name(struct thread_info *info)
static PyObject * thpy_is_stopped(PyObject *self, PyObject *args)
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 constexpr ptid_t lwp
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)
thread_object * thread_obj
static PyObject * thpy_get_global_num(PyObject *self, void *closure)
static PyObject * thpy_get_name(PyObject *self, void *ignore)
int is_running(ptid_t ptid)
static PyObject * thpy_get_inferior(PyObject *self, void *ignore)
static gdb_PyGetSetDef thread_object_getset[]