From 60cfcb20ce8f95a6f71f68c51b295defa5d27032 Mon Sep 17 00:00:00 2001 From: Andrew Burgess Date: Thu, 11 Jul 2019 15:39:55 +0100 Subject: gdb: Add command completers for some info commands Add command completion for info variables, functions, args, and locals. This completer only completes the command line options as these commands all take a regexp which GDB can't really offer completions for. gdb/ChangeLog: * cli/cli-utils.c (info_print_command_completer): New function. * cli/cli-utils.h: Add 'completer.h' include, and forward declaration for 'struct cmd_list_element'. (info_print_command_completer): Declare. * stack.c (_initialize_stack): Add completer for 'info locals' and 'info args'. * symtab.c (_initialize_symtab): Add completer for 'info variables' and 'info functions'. * NEWS: Mention completion for additional info commands. --- gdb/symtab.c | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) (limited to 'gdb/symtab.c') diff --git a/gdb/symtab.c b/gdb/symtab.c index 4669112..4189899 100644 --- a/gdb/symtab.c +++ b/gdb/symtab.c @@ -5997,28 +5997,35 @@ symbol_set_symtab (struct symbol *symbol, struct symtab *symtab) void _initialize_symtab (void) { + cmd_list_element *c; + initialize_ordinary_address_classes (); - add_info ("variables", info_variables_command, - info_print_args_help (_("\ + c = add_info ("variables", info_variables_command, + info_print_args_help (_("\ All global and static variable names or those matching REGEXPs.\n\ Usage: info variables [-q] [-t TYPEREGEXP] [NAMEREGEXP]\n\ Prints the global and static variables.\n"), _("global and static variables"))); + set_cmd_completer_handle_brkchars (c, info_print_command_completer); if (dbx_commands) - add_com ("whereis", class_info, info_variables_command, - info_print_args_help (_("\ + { + c = add_com ("whereis", class_info, info_variables_command, + info_print_args_help (_("\ All global and static variable names, or those matching REGEXPs.\n\ Usage: whereis [-q] [-t TYPEREGEXP] [NAMEREGEXP]\n\ Prints the global and static variables.\n"), _("global and static variables"))); + set_cmd_completer_handle_brkchars (c, info_print_command_completer); + } - add_info ("functions", info_functions_command, - info_print_args_help (_("\ + c = add_info ("functions", info_functions_command, + info_print_args_help (_("\ All function names or those matching REGEXPs.\n\ Usage: info functions [-q] [-t TYPEREGEXP] [NAMEREGEXP]\n\ Prints the functions.\n"), _("functions"))); + set_cmd_completer_handle_brkchars (c, info_print_command_completer); /* FIXME: This command has at least the following problems: 1. It prints builtin types (in a very strange and confusing fashion). -- cgit v1.1