Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Michael Snyder <msnyder@vmware.com>
To: Joel Brobecker <brobecker@adacore.com>
Cc: "gdb-patches@sourceware.org" <gdb-patches@sourceware.org>
Subject: Re: [RFC] info threads takes an argument
Date: Fri, 11 Feb 2011 19:23:00 -0000	[thread overview]
Message-ID: <4D558CA9.7070302@vmware.com> (raw)
In-Reply-To: <20110211060855.GT2384@adacore.com>

[-- Attachment #1: Type: text/plain, Size: 607 bytes --]

Joel Brobecker wrote:
>> 2011-02-10  Michael Snyder  <msnyder@msnyder-server.eng.vmware.com>
>>
>> 	* 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.   ;-)



[-- Attachment #2: thread.txt --]
[-- Type: text/plain, Size: 2219 bytes --]

2011-02-10  Michael Snyder  <msnyder@msnyder-server.eng.vmware.com>

	* 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  <msnyder@vmware.com>

	* 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

  reply	other threads:[~2011-02-11 19:23 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-02-11  1:52 Michael Snyder
2011-02-11  6:09 ` Joel Brobecker
2011-02-11 19:23   ` Michael Snyder [this message]
2011-02-11 21:14     ` Tom Tromey
     [not found]       ` <4D55B1ED.5020808@vmware.com>
     [not found]         ` <m3k4h2e6xu.fsf@fleche.redhat.com>
2011-02-14 20:03           ` Michael Snyder
2011-02-14 20:40             ` Eli Zaretskii
2011-02-15 19:58             ` Tom Tromey
2011-02-15 21:44               ` Michael Snyder
2011-02-16 11:58                 ` Pedro Alves
2011-02-16 18:47                   ` Michael Snyder
2011-02-17 16:57                     ` Jan Kratochvil
2011-02-17 19:12                       ` Michael Snyder
2011-02-17 20:11                       ` Michael Snyder
2011-02-17 21:22                         ` Jan Kratochvil
2011-02-21 18:45                 ` Tom Tromey

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=4D558CA9.7070302@vmware.com \
    --to=msnyder@vmware.com \
    --cc=brobecker@adacore.com \
    --cc=gdb-patches@sourceware.org \
    /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