From 525226b563e98fc59a22393f2a145b7c14d6eec1 Mon Sep 17 00:00:00 2001 From: Andrew Cagney Date: Mon, 21 Feb 2005 07:08:42 +0000 Subject: [PATCH] 2005-02-21 Andrew Cagney Replace string variables with a filename completer with add_setshow_optional_filename_cmd. * solib.c, symfile.c: Update. * cli/cli-setshow.c: Do not tidle expand the file. --- gdb/ChangeLog | 5 +++++ gdb/cli/cli-setshow.c | 15 ++++++++------- gdb/solib.c | 16 ++++++++-------- gdb/symfile.c | 23 +++++++++++------------ 4 files changed, 32 insertions(+), 27 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 18c85f6..3ced130 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,5 +1,10 @@ 2005-02-21 Andrew Cagney + Replace string variables with a filename completer with + add_setshow_optional_filename_cmd. + * solib.c, symfile.c: Update. + * cli/cli-setshow.c: Do not tidle expand the file. + Add more uses of add_setshow_string_cmd, add_setshow_integer_cmd, and add_setshow_string_noescape_cmd. * cli/cli-setshow.c (deprecated_show_value_hack): Do not print a diff --git a/gdb/cli/cli-setshow.c b/gdb/cli/cli-setshow.c index 4b01e62..fca92b0 100644 --- a/gdb/cli/cli-setshow.c +++ b/gdb/cli/cli-setshow.c @@ -180,15 +180,16 @@ do_setshow_command (char *arg, int from_tty, struct cmd_list_element *c) xfree (*(char **) c->var); *(char **) c->var = savestring (arg, strlen (arg)); break; - case var_filename: case var_optional_filename: if (arg == NULL) - { - if (c->var_type == var_optional_filename) - arg = ""; - else - error_no_arg (_("filename to set it to.")); - } + arg = ""; + if (*(char **) c->var != NULL) + xfree (*(char **) c->var); + *(char **) c->var = savestring (arg, strlen (arg)); + break; + case var_filename: + if (arg == NULL) + error_no_arg (_("filename to set it to.")); if (*(char **) c->var != NULL) xfree (*(char **) c->var); *(char **) c->var = tilde_expand (arg); diff --git a/gdb/solib.c b/gdb/solib.c index de56d5b..d516332 100644 --- a/gdb/solib.c +++ b/gdb/solib.c @@ -925,12 +925,12 @@ For other (relative) files, you can add values using `set solib-search-path'."), one is set. */ solib_absolute_prefix = xstrdup (gdb_sysroot); - 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); - deprecated_add_show_from_set (c, &showlist); - set_cmd_sfunc (c, reload_shared_libraries); - set_cmd_completer (c, filename_completer); + add_setshow_optional_filename_cmd ("solib-search-path", class_support, + &solib_search_path, _("\ +Set the search path for loading non-absolute shared library symbol files."), _("\ +Show the search path for loading non-absolute shared library symbol files."), _("\ +This takes precedence over the environment variables PATH and LD_LIBRARY_PATH."), + reload_shared_libraries, + NULL, /* FIXME: i18n: */ + &setlist, &showlist); } diff --git a/gdb/symfile.c b/gdb/symfile.c index d5384cd..a726e66 100644 --- a/gdb/symfile.c +++ b/gdb/symfile.c @@ -3621,16 +3621,15 @@ cache."), &setlist, &showlist); debug_file_directory = xstrdup (DEBUGDIR); - c = (add_set_cmd - ("debug-file-directory", class_support, var_string, - (char *) &debug_file_directory, - "Set the directory where separate debug symbols are searched for.\n" - "Separate debug symbols are first searched for in the same\n" - "directory as the binary, then in the `" DEBUG_SUBDIRECTORY - "' subdirectory,\n" - "and lastly at the path of the directory of the binary with\n" - "the global debug-file directory prepended\n", - &setlist)); - deprecated_add_show_from_set (c, &showlist); - set_cmd_completer (c, filename_completer); + add_setshow_optional_filename_cmd ("debug-file-directory", class_support, + &debug_file_directory, _("\ +Set the directory where separate debug symbols are searched for."), _("\ +Show the directory where separate debug symbols are searched for."), _("\ +Separate debug symbols are first searched for in the same\n\ +directory as the binary, then in the `" DEBUG_SUBDIRECTORY "' subdirectory,\n\ +and lastly at the path of the directory of the binary with\n\ +the global debug-file directory prepended."), + NULL, + NULL, /* FIXME: i18n: */ + &setlist, &showlist); } -- 2.7.4