diff options
Diffstat (limited to 'gdb/cli')
-rw-r--r-- | gdb/cli/cli-utils.c | 17 | ||||
-rw-r--r-- | gdb/cli/cli-utils.h | 13 |
2 files changed, 30 insertions, 0 deletions
diff --git a/gdb/cli/cli-utils.c b/gdb/cli/cli-utils.c index cd3dfe6..c640550 100644 --- a/gdb/cli/cli-utils.c +++ b/gdb/cli/cli-utils.c @@ -473,3 +473,20 @@ extract_info_print_options (info_print_options *opts, if (*args != nullptr && **args == '\0') *args = nullptr; } + +/* See documentation in cli-utils.h. */ + +void +info_print_command_completer (struct cmd_list_element *ignore, + completion_tracker &tracker, + const char *text, const char * /* word */) +{ + const auto group + = make_info_print_options_def_group (nullptr); + if (gdb::option::complete_options + (tracker, &text, gdb::option::PROCESS_OPTIONS_UNKNOWN_IS_OPERAND, group)) + return; + + const char *word = advance_to_expression_complete_word_point (tracker, text); + symbol_completer (ignore, tracker, text, word); +} diff --git a/gdb/cli/cli-utils.h b/gdb/cli/cli-utils.h index a3826be..17cdd84 100644 --- a/gdb/cli/cli-utils.h +++ b/gdb/cli/cli-utils.h @@ -20,6 +20,10 @@ #ifndef CLI_CLI_UTILS_H #define CLI_CLI_UTILS_H +#include "completer.h" + +struct cmd_list_element; + /* *PP is a string denoting a number. Get the number. Advance *PP after the string and any trailing whitespace. @@ -66,6 +70,15 @@ struct info_print_options extern void extract_info_print_options (info_print_options *opts, const char **args); +/* Function that can be used as a command completer for 'info variable' + and friends. This offers command option completion as well as symbol + completion. At the moment all symbols are offered for all commands. */ + +extern void info_print_command_completer (struct cmd_list_element *ignore, + completion_tracker &tracker, + const char *text, + const char * /* word */); + /* Throws an error telling the user that ARGS starts with an option unrecognized by COMMAND. */ |