This is the mail archive of the
gdb-patches@sources.redhat.com
mailing list for the GDB project.
[commit] More uses of add_setshow_optional_filename_cmd
- From: Andrew Cagney <cagney at gnu dot org>
- To: gdb-patches at sources dot redhat dot com
- Date: Mon, 21 Feb 2005 02:06:38 -0500
- Subject: [commit] More uses of add_setshow_optional_filename_cmd
FYI,
Andrew
2005-02-21 Andrew Cagney <cagney@gnu.org>
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.
Index: solib.c
===================================================================
RCS file: /cvs/src/src/gdb/solib.c,v
retrieving revision 1.77
diff -p -u -r1.77 solib.c
--- solib.c 18 Feb 2005 15:25:28 -0000 1.77
+++ solib.c 21 Feb 2005 07:07:45 -0000
@@ -925,12 +925,12 @@ For other (relative) files, you can add
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);
}
Index: symfile.c
===================================================================
RCS file: /cvs/src/src/gdb/symfile.c,v
retrieving revision 1.153
diff -p -u -r1.153 symfile.c
--- symfile.c 21 Feb 2005 06:21:08 -0000 1.153
+++ symfile.c 21 Feb 2005 07:07:46 -0000
@@ -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);
}
Index: cli/cli-setshow.c
===================================================================
RCS file: /cvs/src/src/gdb/cli/cli-setshow.c,v
retrieving revision 1.23
diff -p -u -r1.23 cli-setshow.c
--- cli/cli-setshow.c 21 Feb 2005 06:21:09 -0000 1.23
+++ cli/cli-setshow.c 21 Feb 2005 07:07:46 -0000
@@ -180,15 +180,16 @@ do_setshow_command (char *arg, int from_
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);