From: Doug Evans <dje@google.com>
To: Keith Seitz <keiths@redhat.com>
Cc: gdb-patches <gdb-patches@sourceware.org>
Subject: Re: [PATCH 00/18] Implement full completer limiting
Date: Mon, 20 Apr 2015 03:21:00 -0000 [thread overview]
Message-ID: <CADPb22Qk60UzUDfPbZRGekUHj0nsATyipcwvFJiegr7gkmnQgQ@mail.gmail.com> (raw)
In-Reply-To: <20150413192235.29172.13097.stgit@valrhona.uglyboxes.com>
On Mon, Apr 13, 2015 at 12:23 PM, Keith Seitz <keiths@redhat.com> wrote:
> This series of patches is essentially a rewrite of the completion API
> to enable better/more consistent completion-limiting.
>
> Currently completer functions are not required to implement completion-
> limiting. These functions will compute all possible completions and then
> rely on complete_line to limit the result.
>
> The main goal of this patchset is to require completer functions to
> implement proper completion-limiting using maybe_add_completion. This
> actually cleans up the completer API significantly and fixes at least one
> serious bug (an assertion failure, gdb/17960).
>
> The new API requires all completions to be added to the completion
> list using maybe_add_completion:
>
> void
> my_completer_function (struct completer_data *cdata,
> struct cmd_list_element *cmd,
> const char *text, const char *prefix)
> {
> while (/* there are more completions to look for */)
> {
> char *match = xstrdup (a_completion_match);
> enum maybe_add_completion_enum add_status;
>
> add_status = maybe_add_completion (cdata, match);
> switch (add_status)
> {
> case MAYBE_ADD_COMPLETION_OK:
> /* Completion was added -- keep looking for more. */
> break;
> case MAYBE_ADD_COMPLETION_OK_MAX_REACHED:
> /* Completion was added, but now at maximum permitted completions.
> Stop looking for more matches. */
> return;
> case MAYBE_ADD_COMPLETION_MAX_REACHED:
> /* Completion was not added; maximum permitted completions
> already reached. Stop looking for more matches. */
> xfree (match);
> return;
> case MAYBE_ADD_COMPLETION_DUPLICATE:
> /* This completion is already in the list. Keep looking for
> more matches. */
> xfree (match);
> break;
> }
> }
> }
>
> Each patch of the set has been tested regression-free against x86_64
> linux, native and native-gdbserver.
Hi.
I've gone over the entire patch set. A few things I like, but there's
at least one thing I'm concerned about. Replicating the above switch
in each completer: IWBN to avoid such duplication.
We should still be able to remove the global state and fix 17960.
next prev parent reply other threads:[~2015-04-20 3:21 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-04-13 19:23 Keith Seitz
2015-04-13 19:23 ` [PATCH 03/18] Implement completion limiting for complete_on_cmdlist Keith Seitz
2015-04-13 19:23 ` [PATCH 01/18] Add struct completer_data to the completion API Keith Seitz
2015-04-13 19:23 ` [PATCH 04/18] Implement completion limiting for add_filename_to_list Keith Seitz
2015-04-13 19:23 ` [PATCH 05/18] Implement completion limiting for ada_make_symbol_completion_list Keith Seitz
2015-04-13 19:23 ` [PATCH 08/18] Implement completion limiting for signal_completer Keith Seitz
2015-04-13 19:23 ` [PATCH 11/18] Implement completion limiting for reg_or_group_completer Keith Seitz
2015-04-13 19:23 ` [PATCH 17/18] Use the hashtable to accumulate completion results Keith Seitz
2015-04-13 19:23 ` [PATCH 02/18] Remove completion_tracker_t from the public completion API Keith Seitz
2015-04-13 19:23 ` [PATCH 15/18] Implement completion limiting for scmcmd_add_completion Keith Seitz
2015-04-13 19:23 ` [PATCH 10/18] Implement completion limiting for cmdpy_completer Keith Seitz
2015-04-13 19:23 ` [PATCH 12/18] Implement completion limiting for sim_command_completer Keith Seitz
2015-04-14 15:28 ` Mike Frysinger
2015-05-05 15:03 ` Keith Seitz
2015-05-05 15:34 ` Mike Frysinger
2015-05-05 15:53 ` Keith Seitz
2015-04-13 19:23 ` [PATCH 13/18] Implement completion limiting for complete_on_enum Keith Seitz
2015-04-13 19:23 ` [PATCH 06/18] Implement completion limiting for condition_completer Keith Seitz
2015-04-13 19:23 ` [PATCH 18/18] Remove the vector return result from the completion API Keith Seitz
2015-04-13 19:23 ` [PATCH 16/18] Make the completion API completely opaque Keith Seitz
2015-04-13 19:23 ` [PATCH 09/18] Implement completion limiting for interpreter_completer Keith Seitz
2015-04-13 19:23 ` [PATCH 14/18] Implement completion limiting in add_struct_fields Keith Seitz
2015-04-13 19:23 ` [PATCH 07/18] Implement completion limiting for filename_completer Keith Seitz
2015-04-20 3:21 ` Doug Evans [this message]
2015-04-29 19:19 ` [PATCH 00/18] Implement full completer limiting Keith Seitz
2015-04-30 0:26 ` Doug Evans
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=CADPb22Qk60UzUDfPbZRGekUHj0nsATyipcwvFJiegr7gkmnQgQ@mail.gmail.com \
--to=dje@google.com \
--cc=gdb-patches@sourceware.org \
--cc=keiths@redhat.com \
/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