GDB (xrefs)

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")
thread_object * | create_thread_object (struct thread_info *tp)
static void | thpy_dealloc (PyObject *self)
static PyObject * | thpy_get_name (PyObject *self, void *ignore)
static int | thpy_set_name (PyObject *self, PyObject *newvalue, void *ignore)
static PyObject * | thpy_get_num (PyObject *self, void *closure)
static PyObject * | thpy_get_global_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_switch (PyObject *self, PyObject *args)
static PyObject * | thpy_is_stopped (PyObject *self, PyObject *args)
static PyObject * | thpy_is_running (PyObject *self, PyObject *args)
static PyObject * | thpy_is_exited (PyObject *self, PyObject *args)
static PyObject * | thpy_is_valid (PyObject *self, PyObject *args)
PyObject * | gdbpy_create_ptid_object (ptid_t ptid)
PyObject * | gdbpy_selected_thread (PyObject *self, PyObject *args)
int | gdbpy_initialize_thread (void)

## 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)
_
#define _(String)
Definition: gdb_locale.h:35

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

Referenced by 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(), and thpy_switch().

## Function Documentation

## ◆ CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF()

PyTypeObject thread_object_type CPYCHECKER_TYPE_OBJECT_FOR_TYPEDEF | ( | "thread_object" |  | ) |

## ◆ create_thread_object()

thread_object* create_thread_object | ( | struct thread_info * | tp | ) |

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

References find_inferior_object(), thread_object::inf_obj, thread_info::ptid, ptid_get_pid(), thread_object::thread, threadlist_entry::thread_obj, and thread_object_type.

Referenced by add_thread_object().

## ◆ gdbpy_create_ptid_object()

PyObject* gdbpy_create_ptid_object | ( | ptid_t | ptid | ) |

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

References selftests::ptid::lwp, pid, ptid_get_lwp(), ptid_get_pid(), ptid_get_tid(), and selftests::ptid::tid.

Referenced by create_inferior_call_event_object(), and thpy_get_ptid().

## ◆ gdbpy_initialize_thread()

int gdbpy_initialize_thread | ( | void |  | ) |

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

References gdb_module, gdb_pymodule_addobject(), and thread_object_type.

Referenced by do_start_initialization().

## ◆ gdbpy_selected_thread()

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

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

References find_thread_object(), inferior_ptid, and threadlist_entry::thread_obj.

## ◆ thpy_dealloc()

static void thpy_dealloc | ( | PyObject * | self | ) |
| static

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

References Py_DECREF, and Py_TYPE.

## ◆ thpy_get_global_num()

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

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

References thread_info::global_num, THPY_REQUIRE_VALID, thread_object::thread, and threadlist_entry::thread_obj.

## ◆ thpy_get_inferior()

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

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

References thread_object::inf_obj, THPY_REQUIRE_VALID, and threadlist_entry::thread_obj.

## ◆ thpy_get_name()

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

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

References name, thread_info::name, target_thread_name(), THPY_REQUIRE_VALID, thread_object::thread, and threadlist_entry::thread_obj.

## ◆ thpy_get_num()

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

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

References thread_info::per_inf_num, THPY_REQUIRE_VALID, thread_object::thread, and threadlist_entry::thread_obj.

## ◆ thpy_get_ptid()

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

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

References gdbpy_create_ptid_object(), thread_info::ptid, THPY_REQUIRE_VALID, thread_object::thread, and threadlist_entry::thread_obj.

## ◆ thpy_is_exited()

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

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

References is_exited(), thread_info::ptid, THPY_REQUIRE_VALID, thread_object::thread, and threadlist_entry::thread_obj.

## ◆ thpy_is_running()

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

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

References is_running(), thread_info::ptid, THPY_REQUIRE_VALID, thread_object::thread, and threadlist_entry::thread_obj.

## ◆ thpy_is_stopped()

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

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

References is_stopped(), thread_info::ptid, THPY_REQUIRE_VALID, thread_object::thread, and threadlist_entry::thread_obj.

## ◆ thpy_is_valid()

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

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

References thread_object::thread, and threadlist_entry::thread_obj.

## ◆ thpy_set_name()

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

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

References _, gdbpy_is_string(), name, thread_info::name, python_string_to_host_string(), thread_object::thread, threadlist_entry::thread_obj, and xfree().

## ◆ thpy_switch()

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

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

References CATCH, END_CATCH, GDB_PY_HANDLE_EXCEPTION, thread_info::ptid, RETURN_MASK_ALL, switch_to_thread(), THPY_REQUIRE_VALID, thread_object::thread, threadlist_entry::thread_obj, and TRY.

## Variable Documentation

## ◆ thread_object_getset

gdb_PyGetSetDef thread_object_getset[]
| static

Initial value:
=
{
{ "name", thpy_get_name, thpy_set_name,
"The name of the thread, as set by the user or the OS.", 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 }
}
thpy_get_num
static PyObject * thpy_get_num(PyObject *self, void *closure)
Definition: py-infthread.c:123
thpy_get_ptid
static PyObject * thpy_get_ptid(PyObject *self, void *closure)
Definition: py-infthread.c:148
thpy_set_name
static int thpy_set_name(PyObject *self, PyObject *newvalue, void *ignore)
Definition: py-infthread.c:80
thpy_get_global_num
static PyObject * thpy_get_global_num(PyObject *self, void *closure)
Definition: py-infthread.c:135
thpy_get_name
static PyObject * thpy_get_name(PyObject *self, void *ignore)
Definition: py-infthread.c:62
thpy_get_inferior
static PyObject * thpy_get_inferior(PyObject *self, void *ignore)
Definition: py-infthread.c:160

Definition at line 308 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." },
{ NULL }
}
thpy_is_exited
static PyObject * thpy_is_exited(PyObject *self, PyObject *args)
Definition: py-infthread.c:229
thpy_is_valid
static PyObject * thpy_is_valid(PyObject *self, PyObject *args)
Definition: py-infthread.c:246
thpy_is_running
static PyObject * thpy_is_running(PyObject *self, PyObject *args)
Definition: py-infthread.c:213
thpy_is_stopped
static PyObject * thpy_is_stopped(PyObject *self, PyObject *args)
Definition: py-infthread.c:197
thpy_switch
static PyObject * thpy_switch(PyObject *self, PyObject *args)
Definition: py-infthread.c:174

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

## ◆ thread_object_type

PyTypeObject thread_object_type

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

Referenced by create_thread_object(), and gdbpy_initialize_thread().