This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [RFA 1/2] Add completion for COMMAND in 'thread apply all|ID... COMMAND'
>>>>> "Philippe" == Philippe Waroquiers <philippe.waroquiers@skynet.be> writes:
Philippe> This patch adds logic to complete the COMMAND part of the
Philippe> 'thread apply all|ID...' command.
Thanks for the patch. I think this is a good idea.
Philippe> +/* Skips the known arguments of thread apply all
Philippe> + and then invokes the usual command_completer. */
Philippe> +
Philippe> +static void
Philippe> +thread_apply_all_command_completer (struct cmd_list_element *cmd,
Philippe> + completion_tracker &tracker,
Philippe> + const char *text, const char *word)
Philippe> +{
Philippe> + while (text != NULL)
Philippe> + {
Philippe> + qcs_flags dummy;
Philippe> +
Philippe> + if (check_for_argument (&text, "-ascending", strlen ("-ascending")))
Philippe> + {
Philippe> + text = skip_spaces (text);
Philippe> + continue;
Philippe> + }
Philippe> +
Philippe> + if (parse_flags_qcs ("thread apply all COMMAND completer", &text, &dummy))
Philippe> + continue;
There are some corner cases that aren't handled here, that maybe should
be.
One example is if the input text is "thread apply all -ascen".
It seems like this should complete to "-ascending " (with the trailing space).
If the input text is "thread apply all -ascending" (no trailing space),
then won't it start completing commands without adding a trailing space?
This would result in an invalid command.
A similar thing applies if the completion occurs just after an isolated "-".
These aren't all equally important, but I think at minimum completion
shouldn't result in something invalid.
thanks,
Tom