This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [PATCH v2 17/18] Use the hashtable to accumulate completion results.
- From: Doug Evans <dje at google dot com>
- To: Keith Seitz <keiths at redhat dot com>
- Cc: gdb-patches at sourceware dot org
- Date: Fri, 22 May 2015 00:13:45 +0000
- Subject: Re: [PATCH v2 17/18] Use the hashtable to accumulate completion results.
- Authentication-results: sourceware.org; auth=none
Keith Seitz writes:
> The completion API now uses a VEC (char_ptr) to collect results of
> completion. The completion tracker is a hashtable whose elements are
> the completions. Both hold essentially the same data, so there is no
> need to keep both around.
>
> This patch introduces some API support for removing the vector of
> completions altogether. While it does not remove the vector or
> the vector return result from the completer functions, this patch
> does not use the results of the vector at all. Only the results of
> the hashtable inside the completer's private data is used.
>
> The vector will be removed in the next patch.
Heh. You're way ahead of me. :-)
Awesome.
>
> gdb/ChangeLog
>
> * cli/cli-decode.c (complete_on_cmdlist): Use get_completion_count
> to ascertain if there are any completion results.
> * completer.c (remove_leading_fn_component): New function.
> (location_completer): Use get_completion_count to figure out
> how many symbols and/or file names were found searching for
> possible completions.
> Traverse the completion tracker hashtable to strip leading
> file name components. Contents moved to remove_leading_fn_component.
> (free_completer_data): Change argument to proper type.
> (free_entry_callback): New function.
> (free_all_completer_data): New function.
> (vectorize_htab): New function.
> (get_completion_list): New function.
> (get_completion_count): New function.
> (maybe_add_completion): Accumulate completions when not limiting
> the number of completions.
> (complete_line): Ignore the return list from complete_line_internal
> and get the completion results from the tracker.
> Do not count/limit the results at all -- it is no longer necessary.
> Use free_all_completer_data to free any allocated memory during
> completion in the case of an exception.
> Use free_completer_data after get_completion_list to free
> completer data structures.
> (gdb_completion_word_break_characters): Ignore the return list
> from complete_line_internal and get the completion results from
> the tracker.
> Use free_completer_data after get_completion_list to free
> completer data structures.
> * completer.h (get_completion_list): Declare.
> (get_completion_count): Declare.
> * python/py-cmd.c (cmdpy_completer): Use get_completion_count
> to ascertain if there are any completion results.
LGTM.