set styling'). When false, which is the default if the argument
is not given, then no styling is applied to the returned string.
+ ** New read-only attribute gdb.InferiorThread.details, which is
+ either a string, containing additional, target specific thread
+ state information, or None, if there is no such additional
+ information.
+
* New features in the GDB remote stub, GDBserver
** GDBserver is now supported on OpenRISC GNU/Linux.
@end smallexample
@table @code
+@anchor{info_threads}
@kindex info threads
@item info threads @r{[}@var{thread-id-list}@r{]}
@xref{Tracepoint Packets}.
+@anchor{qThreadExtraInfo}
@item qThreadExtraInfo,@var{thread-id}
@cindex thread attributes info, remote request
@cindex @samp{qThreadExtraInfo} packet
a @code{gdb.Inferior} object. This attribute is not writable.
@end defvar
+@defvar InferiorThread.details
+A string containing target specific thread state information. The
+format of this string varies by target. If there is no additional
+state information for this thread, then this attribute contains
+@code{None}.
+
+For example, on a @sc{gnu}/Linux system, a thread that is in the
+process of exiting will return the string @samp{Exiting}. For remote
+targets the @code{details} string will be obtained with the
+@samp{qThreadExtraInfo} remote packet, if the target supports it
+(@pxref{qThreadExtraInfo,,@samp{qThreadExtraInfo}}).
+
+@value{GDBN} displays the @code{details} string as part of the
+@samp{Target Id} column, in the @code{info threads} output
+(@pxref{info_threads,,@samp{info threads}}).
+@end defvar
+
A @code{gdb.InferiorThread} object has the following methods:
@defun InferiorThread.is_valid ()
return PyString_FromString (name);
}
+/* Return a string containing target specific additional information about
+ the state of the thread, or None, if there is no such additional
+ information. */
+
+static PyObject *
+thpy_get_details (PyObject *self, void *ignore)
+{
+ thread_object *thread_obj = (thread_object *) self;
+
+ THPY_REQUIRE_VALID (thread_obj);
+
+ const char *extra_info;
+ try
+ {
+ extra_info = target_extra_thread_info (thread_obj->thread);
+ }
+ catch (const gdb_exception &except)
+ {
+ GDB_PY_HANDLE_EXCEPTION (except);
+ }
+ if (extra_info == nullptr)
+ Py_RETURN_NONE;
+
+ return PyString_FromString (extra_info);
+}
+
static int
thpy_set_name (PyObject *self, PyObject *newvalue, void *ignore)
{
{
{ "name", thpy_get_name, thpy_set_name,
"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,
gdb_test "python print (gdb.selected_thread().name == name)" "True" \
"check name of current thread again"
+gdb_test_no_output "python details = gdb.selected_thread().details" \
+ "record the thread details string"
+gdb_test "python print(details is None or isinstance(details, str))" "True" \
+ "check that the details has an acceptable type"
+
gdb_test "python print ('result = %s' % t0.is_stopped ())" " = True" "test InferiorThread.is_stopped"
gdb_test "python print ('result = %s' % t0.is_running ())" " = False" "test InferiorThread.is_running"
gdb_test "python print ('result = %s' % t0.is_exited ())" " = False" "test InferiorThread.is_exited"