This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: RFA: display thread names
- From: Eli Zaretskii <eliz at gnu dot org>
- To: Tom Tromey <tromey at redhat dot com>
- Cc: gdb-patches at sourceware dot org
- Date: Wed, 12 Jan 2011 11:31:41 -0500
- Subject: Re: RFA: display thread names
- References: <m3fwsygm4h.fsf@fleche.redhat.com>
- Reply-to: Eli Zaretskii <eliz at gnu dot org>
> From: Tom Tromey <tromey@redhat.com>
> Date: Wed, 12 Jan 2011 08:47:10 -0700
>
> When you have many threads, it is nice to be able to give them names to
> distinguish them. This patch adds this facility via a new "thread name"
> command. Also, on some systems a thread can give itself a name; this
> patch adds such support for Linux.
Is there a plan to add a possibility to switch to a thread by its
name, and otherwise use the name in the same context where we
currently allow only its number? If there are no such plans, I'd say
having a name just for display is not a big deal it could be.
> 2011-01-12 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.
This part is approved, with the following comment:
> +@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"@}],
The long lines in this example needs to be broken in two. (Yes, I
know that you inherited that from the original example, but we might
as well fix that now.)
> --- a/gdb/NEWS
> +++ b/gdb/NEWS
> @@ -15,6 +15,14 @@
> It is like the "dir" command except that it replaces the
> source path list instead of augmenting it.
>
> +* GDB now understands thread names.
> +
> + On GNU/Linux, "info threads" will display the thread name as set by
> + prctl or pthread_setname_np.
> +
> + There is also a new command, "thread name", which can be used to
> + assign a name internally for GDB to display.
> +
> * OpenCL C
> Initial support for the OpenCL C language (http://www.khronos.org/opencl)
> has been integrated into GDB.
> @@ -46,6 +54,9 @@
> ** New function gdb.newest_frame returns the newest frame in the
> selected thread.
>
> + ** The gdb.InferiorThread class has a new "name" attribute. This
> + holds the thread's name.
> +
> * C++ Improvements:
This part is OK.
Thanks.