From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 31801 invoked by alias); 11 Feb 2011 19:23:32 -0000 Received: (qmail 31788 invoked by uid 22791); 11 Feb 2011 19:23:30 -0000 X-SWARE-Spam-Status: No, hits=-4.8 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_HI,T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from smtp-outbound-2.vmware.com (HELO smtp-outbound-2.vmware.com) (65.115.85.73) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Fri, 11 Feb 2011 19:23:24 +0000 Received: from mailhost3.vmware.com (mailhost3.vmware.com [10.16.27.45]) by smtp-outbound-2.vmware.com (Postfix) with ESMTP id 955795900D; Fri, 11 Feb 2011 11:23:21 -0800 (PST) Received: from msnyder-server.eng.vmware.com (promd-2s-dhcp138.eng.vmware.com [10.20.124.138]) by mailhost3.vmware.com (Postfix) with ESMTP id 8BB47CD95A; Fri, 11 Feb 2011 11:23:21 -0800 (PST) Message-ID: <4D558CA9.7070302@vmware.com> Date: Fri, 11 Feb 2011 19:23:00 -0000 From: Michael Snyder User-Agent: Thunderbird 2.0.0.24 (X11/20101201) MIME-Version: 1.0 To: Joel Brobecker CC: "gdb-patches@sourceware.org" Subject: Re: [RFC] info threads takes an argument References: <4D54964A.2070401@vmware.com> <20110211060855.GT2384@adacore.com> In-Reply-To: <20110211060855.GT2384@adacore.com> Content-Type: multipart/mixed; boundary="------------070405060403000709000106" 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: 2011-02/txt/msg00217.txt.bz2 This is a multi-part message in MIME format. --------------070405060403000709000106 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-length: 607 Joel Brobecker wrote: >> 2011-02-10 Michael Snyder >> >> * thread.c (info_threads_command): Process arg as thread id. > > This seems like a reasonable enhancement to me. We have the same sort > of feature for Ada (except that we print a more detailed description > of the given task). > > You will also need a documentation update... > >> + if (arg != NULL && *arg != '\0') >> + { >> + int tmp_tid = strtoul (arg, NULL, 0); >> + if (tmp_tid != 0) > > Emtpy line after the variable declaration... > OK, here's help, doc, and a newline. ;-) --------------070405060403000709000106 Content-Type: text/plain; name="thread.txt" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="thread.txt" Content-length: 2219 2011-02-10 Michael Snyder * thread.c (info_threads_command): Process arg as thread id. (_initialize_thread): Document argument for info therads. Index: thread.c =================================================================== RCS file: /cvs/src/src/gdb/thread.c,v retrieving revision 1.131 diff -u -p -u -p -r1.131 thread.c --- thread.c 19 Jan 2011 17:21:36 -0000 1.131 +++ thread.c 11 Feb 2011 19:18:30 -0000 @@ -965,7 +965,17 @@ No selected thread. See `help thread'.\ static void info_threads_command (char *arg, int from_tty) { - print_thread_info (uiout, -1, -1); + int tid = -1; + + if (arg != NULL && *arg != '\0') + { + int tmp_tid = (int) parse_and_eval_long (arg); + + if (tmp_tid != 0) + tid = tmp_tid; + } + + print_thread_info (uiout, tid, -1); } /* Switch from one thread to another. */ @@ -1404,7 +1414,8 @@ _initialize_thread (void) static struct cmd_list_element *thread_apply_list = NULL; add_info ("threads", info_threads_command, - _("IDs of currently known threads.")); + _("IDs of currently known threads.\n\ +A single thread id may be given as the optional argument.")); add_prefix_cmd ("thread", class_run, thread_command, _("\ Use this command to switch between threads.\n\ 2011-02-11 Michael Snyder * gdb.texinfo (threads): Document argument for info threads cmd. Index: doc/gdb.texinfo =================================================================== RCS file: /cvs/src/src/gdb/doc/gdb.texinfo,v retrieving revision 1.797 diff -u -p -u -p -r1.797 gdb.texinfo --- doc/gdb.texinfo 4 Feb 2011 21:54:15 -0000 1.797 +++ doc/gdb.texinfo 11 Feb 2011 19:18:31 -0000 @@ -2706,9 +2706,10 @@ 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{n}@r{]} +Display a summary of all threads currently in your program. Optional +argument @var{n} means print information only about the specified +thread. @value{GDBN} displays for each thread (in this order): @enumerate @item --------------070405060403000709000106--