Re: [PATCH 3/3 v2] Implement completion limiting

Eli Zaretskii
2014-11-27T16:25:11Z

> From: Gary Benson <gbenson@redhat.com>
> Cc: Doug Evans <xdje42@gmail.com>, Eli Zaretskii <eliz@gnu.org>
> Date: Thu, 27 Nov 2014 13:16:08 +0000
>
> This commit adds a new exception, TOO_MANY_COMPLETIONS_ERROR, to be
> thrown whenever the completer has generated too many candidates to
> be useful. A new user-settable variable, "max_completions", is added
> to control this behaviour. A top-level completion limit is added to
> complete_line_internal, as the final check to ensure the user never
> sees too many completions. An additional limit is added to
> default_make_symbol_completion_list_break_on, to halt time-consuming
> symbol table expansions.
>
> gdb/ChangeLog:
>
> PR cli/9007
> PR cli/11920
> PR cli/15548
> * common/common-exceptions.h (enum errors)
> <TOO_MANY_COMPLETIONS_ERROR>: New value.
> * completer.h (completion_tracker_t): New typedef.
> (new_completion_tracker): New declaration.
> (make_cleanup_free_completion_tracker): Likewise.
> (maybe_limit_completions): Likewise.
> * completer.c [TUI]: Include tui/tui.h and tui/tui-io.h.
> (max_completions): New static variable.
> (new_completion_tracker): New function.
> (make_cleanup_free_completion_tracker): Likewise.
> (maybe_limit_completions): Likewise.
> (complete_line_internal): Do not generate any completions if
> max_completions = 0. Limit the number of completions if
> max_completions >= 0.
> (line_completion_function): Handle TOO_MANY_COMPLETIONS_ERROR.
> (_initialize_completer): New declaration and function.
> * symtab.c: Include completer.h.
> (completion_tracker): New static variable.
> (completion_list_add_name): Call maybe_limit_completions.
> (default_make_symbol_completion_list_break_on): Maintain
> completion_tracker across calls to completion_list_add_name.
> * NEWS (New Options): Mention set/show max-completions.
>
> gdb/doc/ChangeLog:
>
> * gdb.texinfo (Command Completion): Document new
> "set/show max-completions" option.

OK for the documentation parts.

Thanks.