From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 1814 invoked by alias); 22 Aug 2012 22:37:03 -0000 Received: (qmail 1802 invoked by uid 22791); 22 Aug 2012 22:37:01 -0000 X-SWARE-Spam-Status: No, hits=-5.8 required=5.0 tests=AWL,BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,KHOP_RCVD_TRUST,KHOP_THREADED,RCVD_IN_DNSWL_LOW,RCVD_IN_HOSTKARMA_YE,RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from mail-ob0-f169.google.com (HELO mail-ob0-f169.google.com) (209.85.214.169) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Wed, 22 Aug 2012 22:36:27 +0000 Received: by obhx4 with SMTP id x4so282462obh.0 for ; Wed, 22 Aug 2012 15:36:26 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:x-system-of-record:x-gm-message-state; bh=m8wmQ0Wlyh0IzIFYj6U/P6hUrwoNtp0vcOSMUe/sGsc=; b=X1eCanhYt6V18/lQHLDpbLmCX26ByryjQDJGkVxvPYJMesd7HDlinarIvK2qrVW26i py6SBGR/ZdVbeCa8LLE+DqiNGxhnaIa9+g61oqdokCVpLEFahZreahhOnpT7TMUGyz3j fOJPaeRcx+cB/xt5pLDtaLvpGxPPIRDaSQBvhZ/7WqX6O8YMglmEARtQlaZuXyHywreu +Imk4VB09YpOOk54P88/r5akYL1tzkK5XrNvbvtb19rtwz6E8ihPcNpPVLoenl0lRbor BoVst9ZOzK1v4OuwhpMuDrTtQIfJqyrdfZbg+efOrBE6FkFy8TfcW4BiK+qYts+D1i9J jiXA== Received: by 10.50.157.194 with SMTP id wo2mr3837961igb.72.1345674986156; Wed, 22 Aug 2012 15:36:26 -0700 (PDT) MIME-Version: 1.0 Received: by 10.50.157.194 with SMTP id wo2mr3837954igb.72.1345674986017; Wed, 22 Aug 2012 15:36:26 -0700 (PDT) Received: by 10.50.104.233 with HTTP; Wed, 22 Aug 2012 15:36:25 -0700 (PDT) In-Reply-To: <87pq6isqt9.fsf@fleche.redhat.com> References: <87pq6isqt9.fsf@fleche.redhat.com> Date: Wed, 22 Aug 2012 22:37:00 -0000 Message-ID: Subject: Re: [patch] info threads sort by name and name regex matching From: Aaron Gamble To: Tom Tromey Cc: gdb-patches@sourceware.org Content-Type: text/plain; charset=ISO-8859-1 X-System-Of-Record: true X-Gm-Message-State: ALoCoQkRhCuYSUeC2RqbkG7xhwq8JgDbTm0AWrnuC3NzXO+wdBFnR4/dszuCMmDeUdZvUuLyI4l3xBEjGrTkNrQfdL6fdfhArBaqQxa0oupuDQriISWVACCCRcxTz8nXtxZVX8TK+q7XBI3la4g9ojjWuc/PAxi4Td9MfYqADjwt09p9Aq/5hedTYDMwzznCbzWiwKQ1heTwmS4bFJntVvkUmA1BDlDOrw== 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: 2012-08/txt/msg00641.txt.bz2 On Wed, Aug 22, 2012 at 11:51 AM, Tom Tromey wrote: *snip* > Aaron> With this patch sorting by name will happen always. (Perhaps a switch > Aaron> to enable sorting would be better?) > > Yes, I think so. I think sorting by name makes sense but it isn't > perhaps always what you want. Sorting by number has the nice feature > that it is stable. > > Aaron> Regex matching is specified by doing 'info threads r'. This is > Aaron> not ambiguous with previous behavior where parameters to info threads > Aaron> were only numbers. (spaces between 'r' and are ignored) > > I'm curious why you chose this particular spelling. > Other possible approaches would be a subcommand, or a flag like "-r". > Either of these is perhaps more in keeping with gdb tradition. > > I'm interested in other opinions here too. > > Expect some bikeshedding on this point. I picked a single letter for it to be quick and easy to type. I suppose it's possible 'info threads' could be expanded to do other sorts of matching where different flags would be useful. How about 'info threads [ -a ] [ id.. | -n ]' -a - Sort alphabetically by name -n regex - Match thread names with regex Of course then we could do sorting based on the name of the function a thread is in or other sorts of sorting. So other sorting flags would need to be introduced. *snip* > Aaron> + threads = xmalloc (sizeof (*threads) * thread_list_size); > Aaron> + make_cleanup (free, threads); > > I think making a VEC here would be better. > Then you wouldn't need thread_list_size at all. Hmm, not sure if this would improve performance at all. A one time allocation bounded by the number of threads vs VEC's implementation of expanding arrays. I'll wait for others feedback. > > Tom Thanks for the feedback. I'll fix the other things you mentioned I snipped out. -Aaron