From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 32654 invoked by alias); 15 Feb 2011 19:30:42 -0000 Received: (qmail 32619 invoked by uid 22791); 15 Feb 2011 19:30:42 -0000 X-SWARE-Spam-Status: No, hits=-6.9 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_HI,SPF_HELO_PASS,T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 15 Feb 2011 19:30:38 +0000 Received: from int-mx02.intmail.prod.int.phx2.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id p1FJUar6032397 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Tue, 15 Feb 2011 14:30:36 -0500 Received: from ns3.rdu.redhat.com (ns3.rdu.redhat.com [10.11.255.199]) by int-mx02.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id p1FJUZCr007166; Tue, 15 Feb 2011 14:30:36 -0500 Received: from opsy.redhat.com (ovpn01.gateway.prod.ext.phx2.redhat.com [10.5.9.1]) by ns3.rdu.redhat.com (8.13.8/8.13.8) with ESMTP id p1FJUZPe009155; Tue, 15 Feb 2011 14:30:35 -0500 Received: by opsy.redhat.com (Postfix, from userid 500) id C5027378C97; Tue, 15 Feb 2011 12:30:34 -0700 (MST) From: Tom Tromey To: Michael Snyder Cc: "gdb-patches\@sourceware.org" Subject: Re: [RFC] info threads takes an argument References: <4D54964A.2070401@vmware.com> <20110211060855.GT2384@adacore.com> <4D558CA9.7070302@vmware.com> <4D55B1ED.5020808@vmware.com> <4D598863.1030507@vmware.com> Date: Tue, 15 Feb 2011 19:58:00 -0000 In-Reply-To: <4D598863.1030507@vmware.com> (Michael Snyder's message of "Mon, 14 Feb 2011 11:54:11 -0800") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.2 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii 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/msg00336.txt.bz2 >>>>> "Michael" == Michael Snyder writes: Michael> static void Michael> info_threads_command (char *arg, int from_tty) [...] Michael> + int tmp_tid Michael> + = (int) parse_and_eval_long (scan_expression_with_cleanup (&arg, Michael> + NULL)); parse_and_eval_long means that expressions will be accepted here. But then I think it will do the wrong thing if you actually pass multiple IDs -- I think it will syntax error instead of parsing each separately. I'd suggest just parsing out an integer and using atoi or the like. (I'm not sure if there is already a convenience function for this -- I'm always a little surprised at how few argument-parsing convenience functions there are for the CLI.) I like "thread find", it seems handy. Matching both the ID and the target PID means that using numbers here will be over-eager. Why match the ID? "info thread ID" seems good enough. Michael> + add_info ("threads", info_threads_command, Michael> + _("Display currently known threads.\n\ Michael> +Usage: info threads [ID [ID]...]\n\ I think it is more typical to write this as: Usage: info threads [ID]... Michael> + add_cmd ("find", no_class, thread_find_command, _("\ Michael> +Find thread ids with a name, target pid, or extra info matching REGEXP."), Michael> + &thread_cmd_list); How about a Usage here, too? Like: Find threads that match a regular expression. Usage: thread find REGEXP This command will display all the threads whose name, target PID, or extra info matches REGEXP. Michael> +* GDB has a new command: "thread find [regexp]". I'd make regexp all upper-case, in keeping with a GNU documentation convention. Tom