This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
[PATCH v2 00/18] Implement full completer limiting
- From: Keith Seitz <keiths at redhat dot com>
- To: gdb-patches at sourceware dot org
- Date: Mon, 04 May 2015 12:18:06 -0700
- Subject: [PATCH v2 00/18] Implement full completer limiting
- Authentication-results: sourceware.org; auth=none
Subject: Implement full completer limiting
This series (v2) 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);
if (add_completion (cdata, match)
== ADD_COMPLETION_MAX_REACHED)
return;
}
}
Each patch of the set has been tested regression-free against x86_64
linux, native and native-gdbserver.
---
Keith Seitz (18):
Add struct completer_data to the completion API.
Remove completion_tracker_t from the public completion API.
Implement completion limiting for complete_on_cmdlist.
Implement completion limiting for add_filename_to_list.
Implement completion limiting for ada_make_symbol_completion_list.
Implement completion limiting for condition_completer.
Implement completion limiting for filename_completer.
Implement completion limiting for signal_completer.
Implement completion limiting for interpreter_completer.
Implement completion limiting for cmdpy_completer.
Implement completion limiting for reg_or_group_completer.
Implement completion limiting for sim_command_completer.
Implement completion limiting for complete_on_enum.
Implement completion limiting in add_struct_fields.
Implement completion limiting for scmcmd_add_completion.
Make the completion API completely opaque.
Use the hashtable to accumulate completion results.
Remove the vector return result from the completion API.
gdb/ada-lang.c | 62 ++--
gdb/break-catch-syscall.c | 11 -
gdb/breakpoint.c | 22 +
gdb/cli/cli-cmds.c | 4
gdb/cli/cli-decode.c | 40 +-
gdb/command.h | 17 +
gdb/completer.c | 471 +++++++++++++++++-----------
gdb/completer.h | 110 +++----
gdb/corefile.c | 7
gdb/cp-abi.c | 7
gdb/f-lang.c | 8
gdb/guile/scm-cmd.c | 33 +-
gdb/infrun.c | 15 -
gdb/interps.c | 12 -
gdb/language.h | 8
gdb/python/py-cmd.c | 24 +
gdb/remote-sim.c | 10 -
gdb/symtab.c | 256 ++++++---------
gdb/symtab.h | 47 ++-
gdb/testsuite/gdb.ada/complete.exp | 144 ++++++++-
gdb/testsuite/gdb.ada/complete/foo.adb | 4
gdb/testsuite/gdb.ada/complete/pck.ads | 12 +
gdb/testsuite/gdb.base/break.c | 14 +
gdb/testsuite/gdb.base/break.exp | 4
gdb/testsuite/gdb.base/completion.exp | 206 ++++++++++++
gdb/testsuite/gdb.base/condbreak.exp | 70 ++++
gdb/testsuite/gdb.base/filesym.c | 4
gdb/testsuite/gdb.base/filesym.exp | 84 +++++
gdb/testsuite/gdb.base/filesym2.c | 24 +
gdb/testsuite/gdb.base/filesym3.c | 24 +
gdb/testsuite/gdb.base/filesym4.c | 24 +
gdb/testsuite/gdb.base/filesym5.c | 22 +
gdb/testsuite/gdb.cp/cpcompletion.exp | 55 +++
gdb/testsuite/gdb.cp/pr9594.cc | 28 ++
gdb/testsuite/gdb.guile/scm-cmd.exp | 24 +
gdb/testsuite/gdb.python/py-completion.exp | 45 +++
gdb/value.c | 14 -
gdb/value.h | 3
38 files changed, 1404 insertions(+), 565 deletions(-)
create mode 100644 gdb/testsuite/gdb.base/filesym2.c
create mode 100644 gdb/testsuite/gdb.base/filesym3.c
create mode 100644 gdb/testsuite/gdb.base/filesym4.c
create mode 100644 gdb/testsuite/gdb.base/filesym5.c