public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Pedro Alves <palves@redhat.com>
To: Philippe Waroquiers <philippe.waroquiers@skynet.be>,
	gdb-patches@sourceware.org
Subject: Re: [RFA_v2 3/8] Add FLAGS... arguments to 'thread apply'.
Date: Wed, 13 Jun 2018 19:53:00 -0000	[thread overview]
Message-ID: <86adc481-f249-f4f5-9bfc-a7484b4c2a54@redhat.com> (raw)
In-Reply-To: <20180605204905.30612-4-philippe.waroquiers@skynet.be>

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

  reply	other threads:[~2018-06-13 19:53 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-06-05 20:49 [RFA_v2 0/8] Implement 'frame apply COMMAND', enhance 'thread apply COMMAND' Philippe Waroquiers
2018-06-05 20:49 ` [RFA_v2 1/8] Add helper functions check_for_flags and check_for_flags_vqcs Philippe Waroquiers
2018-06-13 19:52   ` Pedro Alves
2018-06-14 21:40     ` Philippe Waroquiers
2018-06-15 16:25       ` Pedro Alves
2018-06-24 18:43         ` Philippe Waroquiers
2018-06-05 20:49 ` [RFA_v2 4/8] Documentation changes for 'frame apply' and 'thread apply' Philippe Waroquiers
2018-06-06 14:57   ` Eli Zaretskii
2018-06-05 20:49 ` [RFA_v2 5/8] Announce in NEWS 'frame apply', faas, taas, tfaas commands and FLAGS... arg for thread apply Philippe Waroquiers
2018-06-06 14:57   ` Eli Zaretskii
2018-06-05 20:49 ` [RFA_v2 6/8] Add a test for 'frame apply' Philippe Waroquiers
2018-06-05 20:49 ` [RFA_v2 8/8] Add a self-test for cli-utils.c Philippe Waroquiers
2018-06-05 20:49 ` [RFA_v2 7/8] Modify gdb.threads/threads.exp to test FLAGS vqcs for thread apply Philippe Waroquiers
2018-06-05 20:49 ` [RFA_v2 3/8] Add FLAGS... arguments to 'thread apply' Philippe Waroquiers
2018-06-13 19:53   ` Pedro Alves [this message]
2018-06-05 20:49 ` [RFA_v2 2/8] Implement frame apply [all | COUNT | -COUNT] [FLAGS...] COMMAND Philippe Waroquiers
2018-06-13 19:53   ` Pedro Alves
2018-06-14 23:01     ` Philippe Waroquiers
2018-06-15 17:35       ` Pedro Alves

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=86adc481-f249-f4f5-9bfc-a7484b4c2a54@redhat.com \
    --to=palves@redhat.com \
    --cc=gdb-patches@sourceware.org \
    --cc=philippe.waroquiers@skynet.be \
    /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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).