This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
[PATCH v2 03/18] Implement completion limiting for complete_on_cmdlist.
- From: Keith Seitz <keiths at redhat dot com>
- To: gdb-patches at sourceware dot org
- Date: Mon, 04 May 2015 12:18:14 -0700
- Subject: [PATCH v2 03/18] Implement completion limiting for complete_on_cmdlist.
- Authentication-results: sourceware.org; auth=none
- References: <20150504191734 dot 20434 dot 68053 dot stgit at valrhona dot uglyboxes dot com>
This is the first of a series of smaller patches to switch over
all completion functions to using maybe_add_completion to add
completions to the completion list to be presented to the user.
Note that in order to verify that this patch works as intended,
one must override the backup completion counting in complete_line.
[This backup code will be permanently removed in a later patch.]
During testing, I have verified all patches with this planned code
removal to verify that it works.
First up is complete_on_cmdlist. Completion limiting is already tested
in gdb.base/completion.exp, so there are no new tests.
gdb/ChangeLog
* cli/cli-decode.c (complete_on_cmdlist): Use add_completion
to determine whether to continue looking for completions.
---
gdb/cli/cli-decode.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/gdb/cli/cli-decode.c b/gdb/cli/cli-decode.c
index 286fc61..011c427 100644
--- a/gdb/cli/cli-decode.c
+++ b/gdb/cli/cli-decode.c
@@ -1815,7 +1815,9 @@ complete_on_cmdlist (struct completer_data *cdata,
match[text - word] = '\0';
strcat (match, ptr->name);
}
- VEC_safe_push (char_ptr, matchlist, match);
+ if (add_completion (cdata, &matchlist, match)
+ == ADD_COMPLETION_MAX_REACHED)
+ return matchlist;
}
/* If we saw no matching deprecated commands in the first pass,
just bail out. */