From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 13551 invoked by alias); 16 Dec 2011 18:47:05 -0000 Received: (qmail 13541 invoked by uid 22791); 16 Dec 2011 18:47:03 -0000 X-SWARE-Spam-Status: No, hits=-1.8 required=5.0 tests=AWL,BAYES_00 X-Spam-Check-By: sourceware.org Received: from relay1.mentorg.com (HELO relay1.mentorg.com) (192.94.38.131) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Fri, 16 Dec 2011 18:46:50 +0000 Received: from nat-ies.mentorg.com ([192.94.31.2] helo=EU1-MAIL.mgc.mentorg.com) by relay1.mentorg.com with esmtp id 1Rbcnw-0005LH-RY from pedro_alves@mentor.com ; Fri, 16 Dec 2011 10:46:49 -0800 Received: from scottsdale.localnet ([172.16.63.104]) by EU1-MAIL.mgc.mentorg.com with Microsoft SMTPSVC(6.0.3790.1830); Fri, 16 Dec 2011 18:46:46 +0000 From: Pedro Alves To: gdb-patches@sourceware.org Subject: Re: [RFC/WIP PATCH 13/14] Make "thread apply all" only loop over threads in the current set Date: Fri, 16 Dec 2011 18:47:00 -0000 User-Agent: KMail/1.13.6 (Linux/2.6.38-13-generic; KDE/4.7.2; x86_64; ; ) Cc: Tom Tromey References: <20111128153742.17761.21459.stgit@localhost6.localdomain6> <20111128154009.17761.49348.stgit@localhost6.localdomain6> In-Reply-To: MIME-Version: 1.0 Content-Type: Text/Plain; charset="iso-8859-15" Content-Transfer-Encoding: 7bit Message-Id: <201112161846.40373.pedro@codesourcery.com> 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-12/txt/msg00520.txt.bz2 On Tuesday 29 November 2011 21:47:09, Tom Tromey wrote: > >>>>> "Pedro" == Pedro Alves writes: > > Pedro> This makes "thread apply all" only loop over threads in the current > Pedro> set instead of always all threads. > > It seems to me that "thread apply" already has a thread argument, which > could be syntactically extended to cope with sets: > > thread apply [1.*] print x > > Then I think the existing syntax can just be mapped to a set: > > thread apply 1 2 3 print x > => thread apply [1,2,3] print x > > thread apply all print x > => thread apply [*] print x > (I didn't read the itset patch yet so I don't know if this is still > the right syntax, but you get the idea.) > > If you considered this and rejected it, I would be interested in your > reason. > > I am not strongly wedded to this idea. > > I wonder if your idea might be confusing for users, since "all" is an > absolute word, but this patch makes it not so. Yeah. In a way, it's still "all" something. But instead of all in the debug session, it's "all" in current focus. It's a similar change as done to, e.g., "continue -a", where -a means "all in current focus". I actually tried out the change after finding this: http://sourceware.org/ml/gdb/2010-09/msg00035.html "(...) a "upcmode" of operation where commands like breakpoint, info threads, .. apply only to UPC threads (a set in your example). Also, "c -a" like commands apply only to UPC threads. Same with "thread apply all". In essence you are focusing your debugging to a group of threads. Switching off "upcmode" makes everything go back to normal (in your case selecting a thread set "all" turns off this feature)." and thinking that such upcmode could easily be reimplemented this way. But I only now notice that they also change "info threads". Hmm. I'm dropping this patch for now. > > Pedro> I think it might make sense to make "info threads" only list threads > Pedro> of the current focus too. WDYT? > > If a command can determine whether it has an explicit prefix (and TBH I > am not sure it is a good idea to allow this -- and I didn't read that > patch yet either) I don't think that is a good idea either. > If there is a set meaning "the current focus set" you could: > > [1.*]> [$] info thread > > ... giving the current set some short moniker like "$" makes it easier > to use. That one I think makes sense. I implemented it for experimentation. > "info thread" takes thread arguments, so perhaps the same rewriting idea > used above applies. This approach would work even without a command > knowing whether it has explicit context: > > (gdb) info thread 1 2 3 > => info thread [1,2,3] > > (gdb) info thread [$] > => focused threads > > (gdb) info thread [1.*] > => threads of inferior 1 This may be what makes most sense. -- Pedro Alves