GDB (xrefs)
Loading...
Searching...
No Matches
Macros | Functions | Variables
py-infthread.c File Reference
#include "defs.h"
#include "gdbthread.h"
#include "inferior.h"
#include "python-internal.h"

Go to the source code of this file.

Macros

#define THPY_REQUIRE_VALID(Thread)
 

Functions

PyTypeObject thread_object_type CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF ("thread_object")
 
gdbpy_ref< thread_objectcreate_thread_object (struct thread_info *tp)
 
static void thpy_dealloc (PyObject *self)
 
static PyObjectthpy_get_name (PyObject *self, void *ignore)
 
static PyObjectthpy_get_details (PyObject *self, void *ignore)
 
static int thpy_set_name (PyObject *self, PyObject *newvalue, void *ignore)
 
static PyObjectthpy_get_num (PyObject *self, void *closure)
 
static PyObjectthpy_get_global_num (PyObject *self, void *closure)
 
static PyObjectthpy_get_ptid (PyObject *self, void *closure)
 
static PyObjectthpy_get_inferior (PyObject *self, void *ignore)
 
static PyObjectthpy_switch (PyObject *self, PyObject *args)
 
static PyObjectthpy_is_stopped (PyObject *self, PyObject *args)
 
static PyObjectthpy_is_running (PyObject *self, PyObject *args)
 
static PyObjectthpy_is_exited (PyObject *self, PyObject *args)
 
static PyObjectthpy_is_valid (PyObject *self, PyObject *args)
 
static PyObjectthpy_thread_handle (PyObject *self, PyObject *args)
 
PyObjectgdbpy_create_ptid_object (ptid_t ptid)
 
PyObjectgdbpy_selected_thread (PyObject *self, PyObject *args)
 
static int CPYCHECKER_NEGATIVE_RESULT_SETS_EXCEPTION gdbpy_initialize_thread (void)
 
 GDBPY_INITIALIZE_FILE (gdbpy_initialize_thread)
 

Variables

static gdb_PyGetSetDef thread_object_getset []
 
static PyMethodDef thread_object_methods []
 
PyTypeObject thread_object_type
 

Macro Definition Documentation

◆ THPY_REQUIRE_VALID

#define THPY_REQUIRE_VALID ( Thread)
Value:
do { \
if (!Thread->thread) \
{ \
PyErr_SetString (PyExc_RuntimeError, \
_("Thread no longer exists.")); \
return NULL; \
} \
} while (0)

Definition at line 29 of file py-infthread.c.

Referenced by thpy_get_details(), thpy_get_global_num(), thpy_get_inferior(), thpy_get_name(), thpy_get_num(), thpy_get_ptid(), thpy_is_exited(), thpy_is_running(), thpy_is_stopped(), thpy_switch(), and thpy_thread_handle().

Function Documentation

◆ CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF()

PyTypeObject thread_object_type CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF ( "thread_object" )
extern

◆ create_thread_object()

gdbpy_ref< thread_object > create_thread_object ( struct thread_info * tp)

Definition at line 40 of file py-infthread.c.

References thread_info::inf, inferior_to_inferior_object(), and thread_object_type.

Referenced by add_thread_object().

◆ gdbpy_create_ptid_object()

PyObject * gdbpy_create_ptid_object ( ptid_t ptid)

◆ GDBPY_INITIALIZE_FILE()

GDBPY_INITIALIZE_FILE ( gdbpy_initialize_thread )

◆ gdbpy_initialize_thread()

static int CPYCHECKER_NEGATIVE_RESULT_SETS_EXCEPTION gdbpy_initialize_thread ( void )
static

Definition at line 365 of file py-infthread.c.

References gdb_module, gdb_pymodule_addobject(), and thread_object_type.

◆ gdbpy_selected_thread()

PyObject * gdbpy_selected_thread ( PyObject * self,
PyObject * args )

Definition at line 356 of file py-infthread.c.

References inferior_ptid, inferior_thread(), and thread_to_thread_object().

◆ thpy_dealloc()

static void thpy_dealloc ( PyObject * self)
static

Definition at line 59 of file py-infthread.c.

◆ thpy_get_details()

static PyObject * thpy_get_details ( PyObject * self,
void * ignore )
static

◆ thpy_get_global_num()

static PyObject * thpy_get_global_num ( PyObject * self,
void * closure )
static

◆ thpy_get_inferior()

static PyObject * thpy_get_inferior ( PyObject * self,
void * ignore )
static

Definition at line 191 of file py-infthread.c.

References thread_object::inf_obj, and THPY_REQUIRE_VALID.

◆ thpy_get_name()

static PyObject * thpy_get_name ( PyObject * self,
void * ignore )
static

Definition at line 66 of file py-infthread.c.

References name, THPY_REQUIRE_VALID, thread_object::thread, and thread_name().

◆ thpy_get_num()

static PyObject * thpy_get_num ( PyObject * self,
void * closure )
static

◆ thpy_get_ptid()

static PyObject * thpy_get_ptid ( PyObject * self,
void * closure )
static

◆ thpy_is_exited()

static PyObject * thpy_is_exited ( PyObject * self,
PyObject * args )
static

◆ thpy_is_running()

static PyObject * thpy_is_running ( PyObject * self,
PyObject * args )
static

◆ thpy_is_stopped()

static PyObject * thpy_is_stopped ( PyObject * self,
PyObject * args )
static

◆ thpy_is_valid()

static PyObject * thpy_is_valid ( PyObject * self,
PyObject * args )
static

Definition at line 276 of file py-infthread.c.

References thread_object::thread.

◆ thpy_set_name()

static int thpy_set_name ( PyObject * self,
PyObject * newvalue,
void * ignore )
static

◆ thpy_switch()

static PyObject * thpy_switch ( PyObject * self,
PyObject * args )
static

◆ thpy_thread_handle()

static PyObject * thpy_thread_handle ( PyObject * self,
PyObject * args )
static

Variable Documentation

◆ thread_object_getset

gdb_PyGetSetDef thread_object_getset[]
static
Initial value:
=
{
"The name of the thread, as set by the user or the OS.", NULL },
{ "details", thpy_get_details, NULL,
"A target specific string containing extra thread state details.",
NULL },
{ "num", thpy_get_num, NULL,
"Per-inferior number of the thread, as assigned by GDB.", NULL },
{ "global_num", thpy_get_global_num, NULL,
"Global number of the thread, as assigned by GDB.", NULL },
{ "ptid", thpy_get_ptid, NULL, "ID of the thread, as assigned by the OS.",
NULL },
{ "inferior", thpy_get_inferior, NULL,
"The Inferior object this thread belongs to.", NULL },
{ NULL }
}
static PyObject * thpy_get_details(PyObject *self, void *ignore)
static PyObject * thpy_get_global_num(PyObject *self, void *closure)
static int thpy_set_name(PyObject *self, PyObject *newvalue, void *ignore)
static PyObject * thpy_get_num(PyObject *self, void *closure)
static PyObject * thpy_get_ptid(PyObject *self, void *closure)
static PyObject * thpy_get_inferior(PyObject *self, void *ignore)
static PyObject * thpy_get_name(PyObject *self, void *ignore)

Definition at line 378 of file py-infthread.c.

◆ thread_object_methods

PyMethodDef thread_object_methods[]
static
Initial value:
=
{
{ "is_valid", thpy_is_valid, METH_NOARGS,
"is_valid () -> Boolean.\n\
Return true if this inferior thread is valid, false if not." },
{ "switch", thpy_switch, METH_NOARGS,
"switch ()\n\
Makes this the GDB selected thread." },
{ "is_stopped", thpy_is_stopped, METH_NOARGS,
"is_stopped () -> Boolean\n\
Return whether the thread is stopped." },
{ "is_running", thpy_is_running, METH_NOARGS,
"is_running () -> Boolean\n\
Return whether the thread is running." },
{ "is_exited", thpy_is_exited, METH_NOARGS,
"is_exited () -> Boolean\n\
Return whether the thread is exited." },
{ "handle", thpy_thread_handle, METH_NOARGS,
"handle () -> handle\n\
Return thread library specific handle for thread." },
{ NULL }
}
static PyObject * thpy_is_running(PyObject *self, PyObject *args)
static PyObject * thpy_thread_handle(PyObject *self, PyObject *args)
static PyObject * thpy_is_stopped(PyObject *self, PyObject *args)
static PyObject * thpy_is_valid(PyObject *self, PyObject *args)
static PyObject * thpy_is_exited(PyObject *self, PyObject *args)
static PyObject * thpy_switch(PyObject *self, PyObject *args)

Definition at line 397 of file py-infthread.c.

◆ thread_object_type

PyTypeObject thread_object_type

Definition at line 421 of file py-infthread.c.

Referenced by create_thread_object(), and gdbpy_initialize_thread().