New command line option -D.

* NEWS: Mention it.
	* main.c (set_gdb_data_directory): New function.
	(captured_main): Recognize -D.  Flag error for --data-directory "".
	Call set_gdb_data_directory.
	(print_gdb_help): Print --data-directory, -D.
	* main.h (set_gdb_data_directory): Declare.
	* top.c (staged_gdb_datadir): New static global.
	(set_gdb_datadir): Call set_gdb_data_directory
	(show_gdb_datadir): New function.
	(init_main): Update init of data-directory parameter.

	testsuite/
	* gdb.base/catch-syscall.exp (test_catch_syscall_fail_nodatadir):
	Update.
	(do_syscall_tests_without_xml): Update.

	doc/
	* gdb.texinfo (Mode Options): Add -D.
This commit is contained in:
Doug Evans
2014-05-16 12:15:10 -07:00
parent 18848e288c
commit 8d551b0239
9 changed files with 100 additions and 6 deletions

View File

@@ -1668,14 +1668,28 @@ show_exec_done_display_p (struct ui_file *file, int from_tty,
value);
}
/* New values of the "data-directory" parameter are staged here. */
static char *staged_gdb_datadir;
/* "set" command for the gdb_datadir configuration variable. */
static void
set_gdb_datadir (char *args, int from_tty, struct cmd_list_element *c)
{
set_gdb_data_directory (staged_gdb_datadir);
observer_notify_gdb_datadir_changed ();
}
/* "show" command for the gdb_datadir configuration variable. */
static void
show_gdb_datadir (struct ui_file *file, int from_tty,
struct cmd_list_element *c, const char *value)
{
fprintf_filtered (file, _("GDB's data directory is \"%s\".\n"),
gdb_datadir);
}
static void
set_history_filename (char *args, int from_tty, struct cmd_list_element *c)
{
@@ -1793,11 +1807,11 @@ Use \"on\" to enable the notification, and \"off\" to disable it."),
&setlist, &showlist);
add_setshow_filename_cmd ("data-directory", class_maintenance,
&gdb_datadir, _("Set GDB's data directory."),
&staged_gdb_datadir, _("Set GDB's data directory."),
_("Show GDB's data directory."),
_("\
When set, GDB uses the specified path to search for data files."),
set_gdb_datadir, NULL,
set_gdb_datadir, show_gdb_datadir,
&setlist,
&showlist);
}