diff options
author | Tom Tromey <tromey@redhat.com> | 2011-01-19 17:21:39 +0000 |
---|---|---|
committer | Tom Tromey <tromey@redhat.com> | 2011-01-19 17:21:39 +0000 |
commit | 4694da01479181361c847bb9185c458e1ec51c46 (patch) | |
tree | 01db52325361b0cb5b25bb982a0e11829331aeb1 /gdb/doc | |
parent | 6ac88ef38d4da039b342dff4c457044f924bfc8a (diff) | |
download | gdb-4694da01479181361c847bb9185c458e1ec51c46.zip gdb-4694da01479181361c847bb9185c458e1ec51c46.tar.gz gdb-4694da01479181361c847bb9185c458e1ec51c46.tar.bz2 |
gdb
PR mi/8618:
* thread.c (free_thread): Free 'name'.
(print_thread_info): Emit thread name. Change CLI output.
(thread_name_command): New function.
(do_captured_thread_select): Emit newline.
(_initialize_thread): Register 'thread name' command.
* target.h (struct target_ops) <to_thread_name>: New field.
(target_thread_name): New macro.
* target.c (update_current_target): Handle to_thread_name.
* python/py-infthread.c (thpy_get_name): New function.
(thpy_set_name): Likewise.
(thread_object_getset): Add "name".
* linux-nat.c (linux_nat_thread_name): New function.
(linux_nat_add_target): Set to_thread_name.
* gdbthread.h (struct thread_info) <name>: New field.
gdb/doc
* gdb.texinfo (Threads): Document thread name output and `thread
name' command.
(Threads In Python): Document Thread.name attribute.
(GDB/MI Thread Commands): Document thread attributes.
gdb/testsuite
* gdb.python/py-infthread.exp: Add thread tests.
Diffstat (limited to 'gdb/doc')
-rw-r--r-- | gdb/doc/ChangeLog | 7 | ||||
-rw-r--r-- | gdb/doc/gdb.texinfo | 95 |
2 files changed, 89 insertions, 13 deletions
diff --git a/gdb/doc/ChangeLog b/gdb/doc/ChangeLog index 8863d0e..25c4758 100644 --- a/gdb/doc/ChangeLog +++ b/gdb/doc/ChangeLog @@ -1,3 +1,10 @@ +2011-01-19 Tom Tromey <tromey@redhat.com> + + * gdb.texinfo (Threads): Document thread name output and `thread + name' command. + (Threads In Python): Document Thread.name attribute. + (GDB/MI Thread Commands): Document thread attributes. + 2011-01-12 Andrew Burgess <aburgess@broadcom.com> * gdb.texinfo (GDB/MI Data Manipulation): Update to reflect diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo index d48d95c..4da4e55 100644 --- a/gdb/doc/gdb.texinfo +++ b/gdb/doc/gdb.texinfo @@ -2718,6 +2718,11 @@ the thread number assigned by @value{GDBN} the target system's thread identifier (@var{systag}) @item +the thread's name, if one is known. A thread can either be named by +the user (see @code{thread name}, below), or, in some cases, by the +program itself. + +@item the current stack frame summary for that thread @end enumerate @@ -2787,6 +2792,19 @@ shown in the first field of the @samp{info threads} display; or it could be a range of thread numbers, as in @code{2-4}. To apply a command to all threads, type @kbd{thread apply all @var{command}}. +@kindex thread name +@cindex name a thread +@item thread name [@var{name}] +This command assigns a name to the current thread. If no argument is +given, any existing user-specified name is removed. The thread name +appears in the @samp{info threads} display. + +On some systems, such as @sc{gnu}/Linux, @value{GDBN} is able to +determine the name of the thread as given by the OS. On these +systems, a name specified with @samp{thread name} will override the +system-give name, and removing the user-specified name will cause +@value{GDBN} to once again display the system-specified name. + @kindex set print thread-events @cindex print messages on thread start and exit @item set print thread-events @@ -21865,6 +21883,17 @@ is no selected thread, this will return @code{None}. A @code{gdb.InferiorThread} object has the following attributes: @table @code +@defivar InferiorThread name +The name of the thread. If the user specified a name using +@code{thread name}, then this returns that name. Otherwise, if an +OS-supplied name is available, then it is returned. Otherwise, this +returns @code{None}. + +This attribute can be assigned to. The new value must be a string +object, which sets the new name, or @code{None}, which removes any +user-specified thread name. +@end defivar + @defivar InferiorThread num ID of the thread, as assigned by GDB. @end defivar @@ -25753,21 +25782,38 @@ also reports the current thread. The @samp{info thread} command prints the same information about all threads. -@subsubheading Example +@subsubheading Result -@smallexample --thread-info -^done,threads=[ -@{id="2",target-id="Thread 0xb7e14b90 (LWP 21257)", - frame=@{level="0",addr="0xffffe410",func="__kernel_vsyscall",args=[]@},state="running"@}, -@{id="1",target-id="Thread 0xb7e156b0 (LWP 21254)", - frame=@{level="0",addr="0x0804891f",func="foo",args=[@{name="i",value="10"@}], - file="/tmp/a.c",fullname="/tmp/a.c",line="158"@},state="running"@}], -current-thread-id="1" -(gdb) -@end smallexample +The result is a list of threads. The following attributes are +defined for a given thread: + +@table @samp +@item current +This field exists only for the current thread. It has the value @samp{*}. -The @samp{state} field may have the following values: +@item id +The identifier that @value{GDBN} uses to refer to the thread. + +@item target-id +The identifier that the target uses to refer to the thread. + +@item details +Extra information about the thread, in a target-specific format. This +field is optional. + +@item name +The name of the thread. If the user specified a name using the +@code{thread name} command, then this name is given. Otherwise, if +@value{GDBN} can extract the thread name from the target, then that +name is given. If @value{GDBN} cannot find the thread name, then this +field is omitted. + +@item frame +The stack frame currently executing in the thread. + +@item state +The thread's state. The @samp{state} field may have the following +values: @table @code @item stopped @@ -25780,6 +25826,29 @@ threads. @end table +@item core +If @value{GDBN} can find the CPU core on which this thread is running, +then this field is the core identifier. This field is optional. + +@end table + +@subsubheading Example + +@smallexample +-thread-info +^done,threads=[ +@{id="2",target-id="Thread 0xb7e14b90 (LWP 21257)", + frame=@{level="0",addr="0xffffe410",func="__kernel_vsyscall", + args=[]@},state="running"@}, +@{id="1",target-id="Thread 0xb7e156b0 (LWP 21254)", + frame=@{level="0",addr="0x0804891f",func="foo", + args=[@{name="i",value="10"@}], + file="/tmp/a.c",fullname="/tmp/a.c",line="158"@}, + state="running"@}], +current-thread-id="1" +(gdb) +@end smallexample + @subheading The @code{-thread-list-ids} Command @findex -thread-list-ids |