gdb/python: New InferiorThread.ptid_string attribute

This commit adds a new InferiorThread.ptid_string attribute.  This
read-only attribute contains the string returned by target_pid_to_str,
which actually converts a ptid (not pid) to a string.

This is the string that appears (at least in part) in the output of
'info threads' in the 'Target Id' column, but also in the thread
exited message that GDB prints.

Having access to this string from Python is useful for allowing
extensions identify threads in a similar way to how GDB core would
identify the thread.

Reviewed-By: Eli Zaretskii <eliz@gnu.org>
Approved-By: Tom Tromey <tom@tromey.com>
This commit is contained in:
Andrew Burgess
2024-01-09 17:29:24 +00:00
parent 322ffd247e
commit 76118e1675
4 changed files with 46 additions and 0 deletions

View File

@@ -4084,6 +4084,13 @@ Either the LWPID or TID may be 0, which indicates that the operating system
does not use that identifier.
@end defvar
@defvar InferiorThread.ptid_string
This read-only attribute contains a string representing
@code{InferiorThread.ptid}. This is the string that @value{GDBN} uses
in the @samp{Target Id} column in the @kbd{info threads} output
(@pxref{info_threads,,@samp{info threads}}).
@end defvar
@defvar InferiorThread.inferior
The inferior this thread belongs to. This attribute is represented as
a @code{gdb.Inferior} object. This attribute is not writable.