From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 7958 invoked by alias); 23 Nov 2008 02:14:02 -0000 Received: (qmail 7861 invoked by uid 22791); 23 Nov 2008 02:14:01 -0000 X-Spam-Check-By: sourceware.org Received: from smtp-outbound-1.vmware.com (HELO smtp-outbound-1.vmware.com) (65.115.85.69) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Sun, 23 Nov 2008 02:13:26 +0000 Received: from mailhost3.vmware.com (mailhost3.vmware.com [10.16.27.45]) by smtp-outbound-1.vmware.com (Postfix) with ESMTP id 5FF7333006 for ; Sat, 22 Nov 2008 18:13:16 -0800 (PST) Received: from [10.20.92.151] (promb-2s-dhcp151.eng.vmware.com [10.20.92.151]) by mailhost3.vmware.com (Postfix) with ESMTP id 55F32C9A38 for ; Sat, 22 Nov 2008 18:13:16 -0800 (PST) Message-ID: <4928BC24.5020600@vmware.com> Date: Mon, 24 Nov 2008 12:44:00 -0000 From: Michael Snyder User-Agent: Thunderbird 1.5.0.12 (X11/20080411) MIME-Version: 1.0 To: "gdb-patches@sourceware.org" Subject: [RFA] Add optional argument to "info threads" command Content-Type: multipart/mixed; boundary="------------020609090206000805070708" X-IsSubscribed: yes Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2008-11/txt/msg00623.txt.bz2 This is a multi-part message in MIME format. --------------020609090206000805070708 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-length: 339 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? --------------020609090206000805070708 Content-Type: text/plain; name="infothread2.txt" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="infothread2.txt" Content-length: 2681 2008-11-22 Michael Snyder * 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 * 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 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 --------------020609090206000805070708--