summaryrefslogtreecommitdiff
path: root/gdb/completer.c
diff options
context:
space:
mode:
authorMike Frysinger <vapier@gentoo.org>2012-11-20 21:02:34 +0000
committerMike Frysinger <vapier@gentoo.org>2012-11-20 21:02:34 +0000
commit0e34fe6db3e848e1fc1fa7445ad1ab44dddd27f4 (patch)
tree4622c2e36240fb0ad7b02fdf441c27f45e48de10 /gdb/completer.c
parentd8701e7b61280ef03465ed12d3618cb45e77257f (diff)
downloadgdb-0e34fe6db3e848e1fc1fa7445ad1ab44dddd27f4.tar.gz
gdb: include help aliases in help command completion
There are a bunch of aliases that get used with help, but the current command completion logic does not include those when doing completions. Since the framework is already mostly in place, extend complete_on_cmdlist slightly to pass down the ignore_help_classes flag like is done with the existing lookup command logic. Now you can do: (gdb) help use<tab> and get back: (gdb) help user-defined Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Diffstat (limited to 'gdb/completer.c')
-rw-r--r--gdb/completer.c17
1 files changed, 12 insertions, 5 deletions
diff --git a/gdb/completer.c b/gdb/completer.c
index 0815711fdbc..4d6b0d1c7e8 100644
--- a/gdb/completer.c
+++ b/gdb/completer.c
@@ -501,6 +501,7 @@ complete_line_internal (const char *text,
{
VEC (char_ptr) *list = NULL;
char *tmp_command, *p;
+ int ignore_help_classes;
/* Pointer within tmp_command which corresponds to text. */
char *word;
struct cmd_list_element *c, *result_list;
@@ -520,6 +521,9 @@ complete_line_internal (const char *text,
tmp_command = (char *) alloca (point + 1);
p = tmp_command;
+ /* The help command should complete help aliases. */
+ ignore_help_classes = reason != handle_help;
+
strncpy (tmp_command, line_buffer, point);
tmp_command[point] = '\0';
/* Since text always contains some number of characters leading up
@@ -536,7 +540,7 @@ complete_line_internal (const char *text,
}
else
{
- c = lookup_cmd_1 (&p, cmdlist, &result_list, 1);
+ c = lookup_cmd_1 (&p, cmdlist, &result_list, ignore_help_classes);
}
/* Move p up to the next interesting thing. */
@@ -577,12 +581,13 @@ complete_line_internal (const char *text,
{
if (reason != handle_brkchars)
list = complete_on_cmdlist (*result_list->prefixlist, p,
- word);
+ word, ignore_help_classes);
}
else
{
if (reason != handle_brkchars)
- list = complete_on_cmdlist (cmdlist, p, word);
+ list = complete_on_cmdlist (cmdlist, p, word,
+ ignore_help_classes);
}
/* Ensure that readline does the right thing with respect to
inserting quotes. */
@@ -608,7 +613,8 @@ complete_line_internal (const char *text,
/* It is a prefix command; what comes after it is
a subcommand (e.g. "info "). */
if (reason != handle_brkchars)
- list = complete_on_cmdlist (*c->prefixlist, p, word);
+ list = complete_on_cmdlist (*c->prefixlist, p, word,
+ ignore_help_classes);
/* Ensure that readline does the right thing
with respect to inserting quotes. */
@@ -679,7 +685,8 @@ complete_line_internal (const char *text,
}
if (reason != handle_brkchars)
- list = complete_on_cmdlist (result_list, q, word);
+ list = complete_on_cmdlist (result_list, q, word,
+ ignore_help_classes);
/* Ensure that readline does the right thing
with respect to inserting quotes. */