From: teawater <teawater@gmail.com>
To: "Michael Snyder" <msnyder@vmware.com>
Cc: "gdb-patches@sourceware.org" <gdb-patches@sourceware.org>
Subject: Re: [RFA] Add optional argument to "info threads" command
Date: Mon, 24 Nov 2008 15:19:00 -0000 [thread overview]
Message-ID: <daef60380811231825g49894375n5677d18919151ba5@mail.gmail.com> (raw)
In-Reply-To: <4928BC24.5020600@vmware.com>
Hey, I think this function is useful.
Thanks,
Hui
On Sun, Nov 23, 2008 at 10:12, Michael Snyder <msnyder@vmware.com> wrote:
>
> I've long been frustrated because I could not ask for
> info about just one or more threads.
>
> This patch makes use of command parsing code in breakpoint.c
> to give "info threads" the same optional arguments as "info
> breakpoints", ie. a list of one or more threads of interest,
> or a range of threads (eg. "5-9").
>
> Documentation updated.
>
> OK?
>
>
> 2008-11-22 Michael Snyder <msnyder@promb-2s-dhcp151.eng.vmware.com>
>
> * thread.c (info_threads_command): Parse arguments for optional
> list (or range) of threads to which the command shall apply.
> (_initialize_thread): Explain extension in help string.
>
> 2008-11-22 Michael Snyder <msnyder@promb-2s-dhcp151.eng.vmware.com>
>
> * gdb.texinfo (Debugging Programs with Multiple Threads):
> Document new optional argument to "info threads" command.
>
> Index: thread.c
> ===================================================================
> RCS file: /cvs/src/src/gdb/thread.c,v
> retrieving revision 1.98
> diff -u -p -r1.98 thread.c
> --- thread.c 17 Nov 2008 12:13:49 -0000 1.98
> +++ thread.c 23 Nov 2008 02:11:22 -0000
> @@ -752,7 +752,34 @@ The current thread <Thread ID %d> has te
> static void
> info_threads_command (char *arg, int from_tty)
> {
> - print_thread_info (uiout, -1, -1);
> + char *p = arg;
> + char *p1;
> + int num, match;
> + struct thread_info *tp;
> +
> + if (p == NULL)
> + print_thread_info (uiout, -1, -1);
> + else
> + while (*p)
> + {
> + match = 0;
> + p1 = p;
> + num = get_number_or_range (&p1);
> + if (num == 0)
> + warning (_("bad thread number at or near '%s'"), p);
> + else
> + {
> + for (tp = thread_list; tp; tp = tp->next)
> + if (num == tp->num)
> + {
> + match = 1;
> + print_thread_info (uiout, num, -1);
> + }
> + if (match == 0)
> + printf_unfiltered (_("No thread number %d.\n"), num);
> + }
> + p = p1;
> + }
> }
>
> /* Switch from one thread to another. */
> @@ -1116,7 +1143,7 @@ _initialize_thread (void)
> struct cmd_list_element *c;
>
> c = add_info ("threads", info_threads_command,
> - _("IDs of currently known threads."));
> + _("IDs of currently known threads, or optionally specified threads."));
> set_cmd_no_selected_thread_ok (c);
>
> c = add_prefix_cmd ("thread", class_run, thread_command, _("\
> Index: doc/gdb.texinfo
> ===================================================================
> RCS file: /cvs/src/src/gdb/doc/gdb.texinfo,v
> retrieving revision 1.536
> diff -u -p -r1.536 gdb.texinfo
> --- doc/gdb.texinfo 22 Nov 2008 12:14:33 -0000 1.536
> +++ doc/gdb.texinfo 23 Nov 2008 02:11:23 -0000
> @@ -2491,9 +2491,11 @@ number---always a single integer---with
>
> @table @code
> @kindex info threads
> -@item info threads
> -Display a summary of all threads currently in your
> -program. @value{GDBN} displays for each thread (in this order):
> +@item info threads @r{[}@var{threads}@r{]} @r{[}@var{range}@dots{}@r{]}
> +Display a summary of all threads currently in your program.
> +Optional argument means display information only
> +about the specified threads or range of threads.
> +@value{GDBN} displays for each thread (in this order):
>
> @enumerate
> @item
>
next prev parent reply other threads:[~2008-11-24 2:25 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-11-24 12:44 Michael Snyder
2008-11-24 15:19 ` teawater [this message]
2008-11-24 16:33 ` Pedro Alves
2008-11-24 21:22 ` Michael Snyder
2008-11-24 22:10 ` Pedro Alves
2008-11-24 23:03 ` Pedro Alves
2008-11-25 8:48 ` Michael Snyder
2008-11-25 16:06 ` Pedro Alves
2008-11-24 23:22 ` Eli Zaretskii
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=daef60380811231825g49894375n5677d18919151ba5@mail.gmail.com \
--to=teawater@gmail.com \
--cc=gdb-patches@sourceware.org \
--cc=msnyder@vmware.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox