From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 76505 invoked by alias); 13 Jun 2018 19:53:38 -0000 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 Received: (qmail 76490 invoked by uid 89); 13 Jun 2018 19:53:37 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.8 required=5.0 tests=AWL,BAYES_00,SPF_HELO_PASS autolearn=ham version=3.3.2 spammy=shortcuts, life X-HELO: mx1.redhat.com Received: from mx3-rdu2.redhat.com (HELO mx1.redhat.com) (66.187.233.73) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 13 Jun 2018 19:53:36 +0000 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id ED0E7402332F; Wed, 13 Jun 2018 19:53:34 +0000 (UTC) Received: from [127.0.0.1] (ovpn04.gateway.prod.ext.ams2.redhat.com [10.39.146.4]) by smtp.corp.redhat.com (Postfix) with ESMTP id 75F457C4D; Wed, 13 Jun 2018 19:53:34 +0000 (UTC) Subject: Re: [RFA_v2 3/8] Add FLAGS... arguments to 'thread apply'. To: Philippe Waroquiers , gdb-patches@sourceware.org References: <20180605204905.30612-1-philippe.waroquiers@skynet.be> <20180605204905.30612-4-philippe.waroquiers@skynet.be> From: Pedro Alves Message-ID: <86adc481-f249-f4f5-9bfc-a7484b4c2a54@redhat.com> Date: Wed, 13 Jun 2018 19:53:00 -0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.8.0 MIME-Version: 1.0 In-Reply-To: <20180605204905.30612-4-philippe.waroquiers@skynet.be> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-SW-Source: 2018-06/txt/msg00333.txt.bz2 On 06/05/2018 09:49 PM, Philippe Waroquiers wrote: > Enhance 'thread apply' command to also accepts FLAGS... arguments. > > Some examples usages for this new argument: > thread apply all -s frame apply all -s p some_local_var_somewhere > Prints the thread id, frame location and some_local_var_somewhere > value in frames of threads that have such local var. > > To make the life of the user easier, the most typical use cases > have shortcuts : > taas : shortcut for 'thread apply all -s' > tfaas : shortcut for 'thread apply all -s frame apply all -s" > > An example usage : > tfaas p some_local_var_somewhere > same as the longer: > 'thread apply all -s frame apply all -s p some_local_var_somewhere' Same comments on -q/-s and [FLAGS...]/[OPTION...] etc. also apply here. > separated list of numbers, or ranges, or the keyword `all'. Ranges consist > of two numbers separated by a hyphen. Examples: > @@ -1592,6 +1631,10 @@ tp_array_compar (const thread_info *a, const thread_info *b) > static void > thread_apply_all_command (const char *cmd, int from_tty) > { > + int print_what_v = 1; /* Print thread id/thread/lwp. */ > + bool cont; > + bool silent; > + > tp_array_compar_ascending = false; > if (cmd != NULL > && check_for_argument (&cmd, "-ascending", strlen ("-ascending"))) > @@ -1600,8 +1643,13 @@ thread_apply_all_command (const char *cmd, int from_tty) > tp_array_compar_ascending = true; > } > > + if (cmd != NULL) > + check_for_flags_vqcs ("thread apply all", &cmd, > + &print_what_v, 1, > + &cont, &silent); So here we see a case where there's really no good reason this shouldn't work: (gdb) thread apply all -q -ascending -c p 1 thread apply all only accepts flags vqcs given individually > > + > +/* Implementation of the "taas" command. */ > + > +static void > +taas_command (const char *cmd, int from_tty) > +{ > + std::string expanded = std::string ("thread apply all -s ") + std::string (cmd); > + execute_command (expanded.c_str (), from_tty); > +} > + > +/* Implementation of the "tfaas" command. */ > + > +static void > +tfaas_command (const char *cmd, int from_tty) > +{ > + std::string expanded = std::string ("thread apply all -s frame apply all -s ") + std::string (cmd); > + execute_command (expanded.c_str (), from_tty); Overly long lines above. Thanks, Pedro Alves