From fa58ee119617c4302d6bf94ff751c3ee8e1062cd Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Mon, 19 Feb 2001 11:47:16 +0000 Subject: [PATCH] * demangle.c (demangling_style_names): New variable. (_initialize_demangler): Fill demangling_style_names with the names of known demangling styles from libiberty_demanglers[]. Use add_set_enum_cmd instead of add_set_cmd, to get completion on demangling style names. * proc-api.c (_initialize_proc_api): Make `procfs-file' use file-name completion. * remote-rdi.c (_initialize_remote_rdi): Ditto for `rdilogfile'. * solib.c (_initialize_solib): Ditto for `solib-search-path' and `solib-absolute-prefix'. * tracepoint.c (_initialize_tracepoint): Ditto for `save-tracepoints'. * win32-nat.c (_initialize_inftarg): Ditto for `dll-symbols'. * cli/cli-cmds.c (init_cli_cmds): Make `shell' and `make' use file-name completion. * infcmd.c (_initialize_infcmd): Make the following commands use the file-name completer: `tty', `args', `path', `paths', and `run'. --- gdb/ChangeLog | 28 ++++++++++++++++++++++++++++ gdb/cli/cli-cmds.c | 10 ++++++---- gdb/demangle.c | 29 ++++++++++++++++++++++++----- gdb/infcmd.c | 26 +++++++++++++++----------- gdb/proc-api.c | 1 + gdb/remote-rdi.c | 10 +++++++--- gdb/solib.c | 29 ++++++++++++++++------------- gdb/tracepoint.c | 8 ++++++-- gdb/win32-nat.c | 8 ++++++-- gdb/windows-nat.c | 8 ++++++-- 10 files changed, 115 insertions(+), 42 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 3623e027daf..fada1562fb7 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,31 @@ +2001-02-19 Eli Zaretskii + + * demangle.c (demangling_style_names): New variable. + (_initialize_demangler): Fill demangling_style_names with the + names of known demangling styles from libiberty_demanglers[]. Use + add_set_enum_cmd instead of add_set_cmd, to get completion on + demangling style names. + + * proc-api.c (_initialize_proc_api): Make `procfs-file' use + file-name completion. + + * remote-rdi.c (_initialize_remote_rdi): Ditto for `rdilogfile'. + + * solib.c (_initialize_solib): Ditto for `solib-search-path' and + `solib-absolute-prefix'. + + * tracepoint.c (_initialize_tracepoint): Ditto for + `save-tracepoints'. + + * win32-nat.c (_initialize_inftarg): Ditto for `dll-symbols'. + + * cli/cli-cmds.c (init_cli_cmds): Make `shell' and `make' use + file-name completion. + + * infcmd.c (_initialize_infcmd): Make the following commands use + the file-name completer: `tty', `args', `path', `paths', and + `run'. + 2001-02-18 Eli Zaretskii * go32-nat.c: Include i387-nat.h. diff --git a/gdb/cli/cli-cmds.c b/gdb/cli/cli-cmds.c index 4cc4aa34156..19b597062b2 100644 --- a/gdb/cli/cli-cmds.c +++ b/gdb/cli/cli-cmds.c @@ -778,9 +778,10 @@ from the target.", &setlist), "Generic command for showing gdb debugging flags", &showdebuglist, "show debug ", 0, &showlist); - add_com ("shell", class_support, shell_escape, - "Execute the rest of the line as a shell command. \n\ + c = add_com ("shell", class_support, shell_escape, + "Execute the rest of the line as a shell command. \n\ With no arguments, run an inferior shell."); + c->completer = filename_completer; /* NOTE: cagney/2000-03-20: Being able to enter ``(gdb) !ls'' would be a really useful feature. Unfortunately, the below wont do @@ -791,8 +792,9 @@ With no arguments, run an inferior shell."); if (xdb_commands) add_com_alias ("!", "shell", class_support, 0); - add_com ("make", class_support, make_command, - "Run the ``make'' program using the rest of the line as arguments."); + c = add_com ("make", class_support, make_command, + "Run the ``make'' program using the rest of the line as arguments."); + c->completer = filename_completer; add_cmd ("user", no_class, show_user, "Show definitions of user defined commands.\n\ Argument is the name of the user defined command.\n\ diff --git a/gdb/demangle.c b/gdb/demangle.c index 2c59deca911..20758befd9f 100644 --- a/gdb/demangle.c +++ b/gdb/demangle.c @@ -49,6 +49,11 @@ extern void _initialize_demangler (void); static char *current_demangling_style_string; +/* The array of names of the known demanglyng styles. Generated by + _initialize_demangler from libiberty_demanglers[] array. */ + +static const char **demangling_style_names; + static void set_demangling_command (char *, int, struct cmd_list_element *); /* Set current demangling style. Called by the "set demangle-style" @@ -173,12 +178,26 @@ void _initialize_demangler (void) { struct cmd_list_element *set, *show; - - set = add_set_cmd ("demangle-style", class_support, var_string_noescape, - (char *) ¤t_demangling_style_string, - "Set the current C++ demangling style.\n\ + int i, ndems; + + /* Fill the demangling_style_names[] array. */ + for (ndems = 0; + libiberty_demanglers[ndems].demangling_style != unknown_demangling; + ndems++) + ; + demangling_style_names = xmalloc (ndems * sizeof (char *)); + for (i = 0; + libiberty_demanglers[i].demangling_style != unknown_demangling; + i++) + demangling_style_names[i] = + xstrdup (libiberty_demanglers[i].demangling_style_name); + + set = add_set_enum_cmd ("demangle-style", class_support, + demangling_style_names, + (const char **) ¤t_demangling_style_string, + "Set the current C++ demangling style.\n\ Use `set demangle-style' without arguments for a list of demangling styles.", - &setlist); + &setlist); show = add_show_from_set (set, &showlist); set->function.sfunc = set_demangling_command; diff --git a/gdb/infcmd.c b/gdb/infcmd.c index 5ae5c6a4b9c..b7642c7b12b 100644 --- a/gdb/infcmd.c +++ b/gdb/infcmd.c @@ -40,6 +40,7 @@ #endif #include "event-top.h" #include "parser-defs.h" +#include "completer.h" /* Functions exported for general use: */ @@ -1794,16 +1795,17 @@ _initialize_infcmd (void) { struct cmd_list_element *c; - add_com ("tty", class_run, tty_command, - "Set terminal for future runs of program being debugged."); + c= add_com ("tty", class_run, tty_command, + "Set terminal for future runs of program being debugged."); + c->completer = filename_completer; - add_show_from_set - (add_set_cmd ("args", class_run, var_string_noescape, - (char *) &inferior_args, - "Set argument list to give program being debugged when it is started.\n\ + c = add_set_cmd ("args", class_run, var_string_noescape, + (char *) &inferior_args, + "Set argument list to give program being debugged when it is started.\n\ Follow this command with any number of args, to be passed to the program.", - &setlist), - &showlist); + &setlist); + add_show_from_set (c, &showlist); + c->completer = filename_completer; c = add_cmd ("environment", no_class, environment_info, @@ -1831,12 +1833,13 @@ This does not affect the program until the next \"run\" command.", &setlist); c->completer = noop_completer; - add_com ("path", class_files, path_command, - "Add directory DIR(s) to beginning of search path for object files.\n\ + c = add_com ("path", class_files, path_command, + "Add directory DIR(s) to beginning of search path for object files.\n\ $cwd in the path means the current working directory.\n\ This path is equivalent to the $PATH shell variable. It is a list of\n\ directories, separated by colons. These directories are searched to find\n\ fully linked executable files and separately compiled object files as needed."); + c->completer = filename_completer; c = add_cmd ("paths", no_class, path_info, "Current search path for finding object files.\n\ @@ -1928,13 +1931,14 @@ the breakpoint won't break until the Nth time it is reached)."); add_com_alias ("c", "cont", class_run, 1); add_com_alias ("fg", "cont", class_run, 1); - add_com ("run", class_run, run_command, + c = add_com ("run", class_run, run_command, "Start debugged program. You may specify arguments to give it.\n\ Args may include \"*\", or \"[...]\"; they are expanded using \"sh\".\n\ Input and output redirection with \">\", \"<\", or \">>\" are also allowed.\n\n\ With no arguments, uses arguments last specified (with \"run\" or \"set args\").\n\ To cancel previous arguments and run with no arguments,\n\ use \"set args\" without arguments."); + c->completer = filename_completer; add_com_alias ("r", "run", class_run, 1); if (xdb_commands) add_com ("R", class_run, run_no_args_command, diff --git a/gdb/proc-api.c b/gdb/proc-api.c index 8a28b0061f6..813923ab4bd 100644 --- a/gdb/proc-api.c +++ b/gdb/proc-api.c @@ -770,6 +770,7 @@ _initialize_proc_api (void) add_show_from_set (c, &showlist); c->function.sfunc = set_procfs_trace_cmd; + c->completer = filename_completer; c = add_set_cmd ("procfs-file", no_class, var_filename, (char *) &procfs_filename, diff --git a/gdb/remote-rdi.c b/gdb/remote-rdi.c index a4b2428e425..d97cb65c2c9 100644 --- a/gdb/remote-rdi.c +++ b/gdb/remote-rdi.c @@ -32,6 +32,7 @@ #include "gdbthread.h" #include "gdbcore.h" #include "breakpoint.h" +#include "completer.h" #ifdef USG #include @@ -1021,6 +1022,8 @@ rdilogenable_command (char *args, int from_tty) void _initialize_remote_rdi (void) { + struct cmd_list_element *c; + init_rdi_ops (); add_target (&arm_rdi_ops); @@ -1028,14 +1031,15 @@ _initialize_remote_rdi (void) Adp_SetLogfile (log_filename); Adp_SetLogEnable (log_enable); - add_cmd ("rdilogfile", class_maintenance, - rdilogfile_command, - "Set filename for ADP packet log.\n\ + c = add_cmd ("rdilogfile", class_maintenance, + rdilogfile_command, + "Set filename for ADP packet log.\n\ This file is used to log Angel Debugger Protocol packets.\n\ With a single argument, sets the logfile name to that value.\n\ Without an argument, shows the current logfile name.\n\ See also: rdilogenable\n", &maintenancelist); + c->completer = filename_completer; add_cmd ("rdilogenable", class_maintenance, rdilogenable_command, diff --git a/gdb/solib.c b/gdb/solib.c index 9808e8983d5..5fdb9a1d148 100644 --- a/gdb/solib.c +++ b/gdb/solib.c @@ -37,6 +37,7 @@ #include "environ.h" #include "language.h" #include "gdbcmd.h" +#include "completer.h" #include "solist.h" @@ -790,6 +791,8 @@ sharedlibrary_command (char *args, int from_tty) void _initialize_solib (void) { + struct cmd_list_element *c; + add_com ("sharedlibrary", class_files, sharedlibrary_command, "Load shared object library symbols for files matching REGEXP."); add_info ("sharedlibrary", info_sharedlibrary_command, @@ -806,19 +809,19 @@ must be loaded manually, using `sharedlibrary'.", &setlist), &showlist); - add_show_from_set - (add_set_cmd ("solib-absolute-prefix", class_support, var_filename, - (char *) &solib_absolute_prefix, - "Set prefix for loading absolute shared library symbol files.\n\ + c = add_set_cmd ("solib-absolute-prefix", class_support, var_filename, + (char *) &solib_absolute_prefix, + "Set prefix for loading absolute shared library symbol files.\n\ For other (relative) files, you can add values using `set solib-search-path'.", - &setlist), - &showlist); - add_show_from_set - (add_set_cmd ("solib-search-path", class_support, var_string, - (char *) &solib_search_path, - "Set the search path for loading non-absolute shared library symbol files.\n\ -This takes precedence over the environment variables PATH and LD_LIBRARY_PATH.", - &setlist), - &showlist); + &setlist); + add_show_from_set (c, &showlist); + c->completer = filename_completer; + c = add_set_cmd ("solib-search-path", class_support, var_string, + (char *) &solib_search_path, + "Set the search path for loading non-absolute shared library symbol files.\n\ +This takes precedence over the environment variables PATH and LD_LIBRARY_PATH.", + &setlist); + add_show_from_set (c, &showlist); + c->completer = filename_completer; } diff --git a/gdb/tracepoint.c b/gdb/tracepoint.c index f275458dfa2..a1feb18fc2e 100644 --- a/gdb/tracepoint.c +++ b/gdb/tracepoint.c @@ -32,6 +32,7 @@ #include "tracepoint.h" #include "remote.h" #include "linespec.h" +#include "completer.h" #include "ax.h" #include "ax-gdb.h" @@ -2600,6 +2601,8 @@ get_traceframe_number (void) void _initialize_tracepoint (void) { + struct cmd_list_element *c; + tracepoint_chain = 0; tracepoint_count = 0; traceframe_number = -1; @@ -2651,9 +2654,10 @@ last tracepoint set."); add_info_alias ("tp", "tracepoints", 1); - add_com ("save-tracepoints", class_trace, tracepoint_save_command, - "Save current tracepoint definitions as a script.\n\ + c = add_com ("save-tracepoints", class_trace, tracepoint_save_command, + "Save current tracepoint definitions as a script.\n\ Use the 'source' command in another debug session to restore them."); + c->completer = filename_completer; add_com ("tdump", class_trace, trace_dump_command, "Print everything collected at the current tracepoint."); diff --git a/gdb/win32-nat.c b/gdb/win32-nat.c index ce06fddad0b..71e10e952bf 100644 --- a/gdb/win32-nat.c +++ b/gdb/win32-nat.c @@ -30,6 +30,7 @@ #include "target.h" #include "gdbcore.h" #include "command.h" +#include "completer.h" #include #include #include @@ -1377,10 +1378,13 @@ init_child_ops (void) void _initialize_inftarg (void) { + struct cmd_list_element *c; + init_child_ops (); - add_com ("dll-symbols", class_files, dll_symbol_command, - "Load dll library symbols from FILE."); + c = add_com ("dll-symbols", class_files, dll_symbol_command, + "Load dll library symbols from FILE."); + c->completer = filename_completer; auto_solib_add = 1; add_com_alias ("sharedlibrary", "dll-symbols", class_alias, 1); diff --git a/gdb/windows-nat.c b/gdb/windows-nat.c index ce06fddad0b..71e10e952bf 100644 --- a/gdb/windows-nat.c +++ b/gdb/windows-nat.c @@ -30,6 +30,7 @@ #include "target.h" #include "gdbcore.h" #include "command.h" +#include "completer.h" #include #include #include @@ -1377,10 +1378,13 @@ init_child_ops (void) void _initialize_inftarg (void) { + struct cmd_list_element *c; + init_child_ops (); - add_com ("dll-symbols", class_files, dll_symbol_command, - "Load dll library symbols from FILE."); + c = add_com ("dll-symbols", class_files, dll_symbol_command, + "Load dll library symbols from FILE."); + c->completer = filename_completer; auto_solib_add = 1; add_com_alias ("sharedlibrary", "dll-symbols", class_alias, 1); -- 2.30.2