Python scripts can access information about, and manipulate inferior threads
controlled by gdb, via objects of the
The following thread-related functions are available in the
This function returns the thread object for the selected thread. If there is no selected thread, this will return
gdb.InferiorThread object has the following attributes:
The name of the thread. If the user specified a name using
thread name, then this returns that name. Otherwise, if an OS-supplied name is available, then it is returned. Otherwise, this returns
This attribute can be assigned to. The new value must be a string object, which sets the new name, or
None, which removes any user-specified thread name.
ID of the thread, as assigned by the operating system. This attribute is a tuple containing three integers. The first is the Process ID (PID); the second is the Lightweight Process ID (LWPID), and the third is the Thread ID (TID). Either the LWPID or TID may be 0, which indicates that the operating system does not use that identifier.
gdb.InferiorThread object has the following methods:
gdb.InferiorThreadobject is valid,
Falseif not. A
gdb.InferiorThreadobject will become invalid if the thread exits, or the inferior that the thread belongs is deleted. All other
gdb.InferiorThreadmethods will throw an exception if it is invalid at the time the method is called.
This changes gdb's currently selected thread to the one represented by this object.