mirror of
https://github.com/espressif/binutils-gdb.git
synced 2025-06-18 00:32:30 +08:00
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:
@ -1,3 +1,17 @@
|
|||||||
|
2014-05-16 Doug Evans <dje@google.com>
|
||||||
|
|
||||||
|
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.
|
||||||
|
|
||||||
2014-05-16 Gregory Fong <gregory.0xf0@gmail.com>
|
2014-05-16 Gregory Fong <gregory.0xf0@gmail.com>
|
||||||
|
|
||||||
Import the "dirfd" gnulib module.
|
Import the "dirfd" gnulib module.
|
||||||
|
5
gdb/NEWS
5
gdb/NEWS
@ -3,6 +3,11 @@
|
|||||||
|
|
||||||
*** Changes since GDB 7.7
|
*** Changes since GDB 7.7
|
||||||
|
|
||||||
|
* New command line options
|
||||||
|
|
||||||
|
-D data-directory
|
||||||
|
This is an alias for the --data-directory option.
|
||||||
|
|
||||||
* GDB supports printing and modifying of variable length automatic arrays
|
* GDB supports printing and modifying of variable length automatic arrays
|
||||||
as specified in ISO C99.
|
as specified in ISO C99.
|
||||||
|
|
||||||
|
@ -1,3 +1,7 @@
|
|||||||
|
2014-05-16 Doug Evans <dje@google.com>
|
||||||
|
|
||||||
|
* gdb.texinfo (Mode Options): Add -D.
|
||||||
|
|
||||||
2014-05-09 Samuel Bronson <naesten@gmail.com>
|
2014-05-09 Samuel Bronson <naesten@gmail.com>
|
||||||
|
|
||||||
* Makefile.in (PACKAGE): Copy from ../Makefile.in in case of
|
* Makefile.in (PACKAGE): Copy from ../Makefile.in in case of
|
||||||
|
@ -1164,7 +1164,9 @@ Run @value{GDBN} using @var{directory} as its working directory,
|
|||||||
instead of the current directory.
|
instead of the current directory.
|
||||||
|
|
||||||
@item -data-directory @var{directory}
|
@item -data-directory @var{directory}
|
||||||
|
@itemx -D @var{directory}
|
||||||
@cindex @code{--data-directory}
|
@cindex @code{--data-directory}
|
||||||
|
@cindex @code{-D}
|
||||||
Run @value{GDBN} using @var{directory} as its data directory.
|
Run @value{GDBN} using @var{directory} as its data directory.
|
||||||
The data directory is where @value{GDBN} searches for its
|
The data directory is where @value{GDBN} searches for its
|
||||||
auxiliary files. @xref{Data Files}.
|
auxiliary files. @xref{Data Files}.
|
||||||
|
49
gdb/main.c
49
gdb/main.c
@ -106,6 +106,41 @@ get_gdb_program_name (void)
|
|||||||
|
|
||||||
static void print_gdb_help (struct ui_file *);
|
static void print_gdb_help (struct ui_file *);
|
||||||
|
|
||||||
|
/* Set the data-directory parameter to NEW_DATADIR.
|
||||||
|
If NEW_DATADIR is not a directory then a warning is printed.
|
||||||
|
We don't signal an error for backward compatibility. */
|
||||||
|
|
||||||
|
void
|
||||||
|
set_gdb_data_directory (const char *new_datadir)
|
||||||
|
{
|
||||||
|
struct stat st;
|
||||||
|
|
||||||
|
if (stat (new_datadir, &st) < 0)
|
||||||
|
{
|
||||||
|
int save_errno = errno;
|
||||||
|
|
||||||
|
fprintf_unfiltered (gdb_stderr, "Warning: ");
|
||||||
|
print_sys_errmsg (new_datadir, save_errno);
|
||||||
|
}
|
||||||
|
else if (!S_ISDIR (st.st_mode))
|
||||||
|
warning (_("%s is not a directory."), new_datadir);
|
||||||
|
|
||||||
|
xfree (gdb_datadir);
|
||||||
|
gdb_datadir = gdb_realpath (new_datadir);
|
||||||
|
|
||||||
|
/* gdb_realpath won't return an absolute path if the path doesn't exist,
|
||||||
|
but we still want to record an absolute path here. If the user entered
|
||||||
|
"../foo" and "../foo" doesn't exist then we'll record $(pwd)/../foo which
|
||||||
|
isn't canonical, but that's ok. */
|
||||||
|
if (!IS_ABSOLUTE_PATH (gdb_datadir))
|
||||||
|
{
|
||||||
|
char *abs_datadir = gdb_abspath (gdb_datadir);
|
||||||
|
|
||||||
|
xfree (gdb_datadir);
|
||||||
|
gdb_datadir = abs_datadir;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* Relocate a file or directory. PROGNAME is the name by which gdb
|
/* Relocate a file or directory. PROGNAME is the name by which gdb
|
||||||
was invoked (i.e., argv[0]). INITIAL is the default value for the
|
was invoked (i.e., argv[0]). INITIAL is the default value for the
|
||||||
file or directory. FLAG is true if the value is relocatable, false
|
file or directory. FLAG is true if the value is relocatable, false
|
||||||
@ -517,6 +552,7 @@ captured_main (void *data)
|
|||||||
{"directory", required_argument, 0, 'd'},
|
{"directory", required_argument, 0, 'd'},
|
||||||
{"d", required_argument, 0, 'd'},
|
{"d", required_argument, 0, 'd'},
|
||||||
{"data-directory", required_argument, 0, 'D'},
|
{"data-directory", required_argument, 0, 'D'},
|
||||||
|
{"D", required_argument, 0, 'D'},
|
||||||
{"cd", required_argument, 0, OPT_CD},
|
{"cd", required_argument, 0, OPT_CD},
|
||||||
{"tty", required_argument, 0, 't'},
|
{"tty", required_argument, 0, 't'},
|
||||||
{"baud", required_argument, 0, 'b'},
|
{"baud", required_argument, 0, 'b'},
|
||||||
@ -641,8 +677,15 @@ captured_main (void *data)
|
|||||||
gdb_stdout = ui_file_new();
|
gdb_stdout = ui_file_new();
|
||||||
break;
|
break;
|
||||||
case 'D':
|
case 'D':
|
||||||
xfree (gdb_datadir);
|
if (optarg[0] == '\0')
|
||||||
gdb_datadir = xstrdup (optarg);
|
{
|
||||||
|
fprintf_unfiltered (gdb_stderr,
|
||||||
|
_("%s: empty path for"
|
||||||
|
" `--data-directory'\n"),
|
||||||
|
argv[0]);
|
||||||
|
exit (1);
|
||||||
|
}
|
||||||
|
set_gdb_data_directory (optarg);
|
||||||
gdb_datadir_provided = 1;
|
gdb_datadir_provided = 1;
|
||||||
break;
|
break;
|
||||||
#ifdef GDBTK
|
#ifdef GDBTK
|
||||||
@ -1146,6 +1189,8 @@ Remote debugging options:\n\n\
|
|||||||
-l TIMEOUT Set timeout in seconds for remote debugging.\n\n\
|
-l TIMEOUT Set timeout in seconds for remote debugging.\n\n\
|
||||||
Other options:\n\n\
|
Other options:\n\n\
|
||||||
--cd=DIR Change current directory to DIR.\n\
|
--cd=DIR Change current directory to DIR.\n\
|
||||||
|
--data-directory=DIR, -D\n\
|
||||||
|
Set GDB's data-directory to DIR.\n\
|
||||||
"), stream);
|
"), stream);
|
||||||
fputs_unfiltered (_("\n\
|
fputs_unfiltered (_("\n\
|
||||||
At startup, GDB reads the following init files and executes their commands:\n\
|
At startup, GDB reads the following init files and executes their commands:\n\
|
||||||
|
@ -47,4 +47,6 @@ extern char *windows_get_absolute_argv0 (const char *argv0);
|
|||||||
parse the argv array. */
|
parse the argv array. */
|
||||||
extern const char *get_gdb_program_name (void);
|
extern const char *get_gdb_program_name (void);
|
||||||
|
|
||||||
|
extern void set_gdb_data_directory (const char *new_data_dir);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -1,3 +1,9 @@
|
|||||||
|
2014-05-16 Doug Evans <dje@google.com>
|
||||||
|
|
||||||
|
* gdb.base/catch-syscall.exp (test_catch_syscall_fail_nodatadir):
|
||||||
|
Update.
|
||||||
|
(do_syscall_tests_without_xml): Update.
|
||||||
|
|
||||||
2014-05-16 Pedro Alves <palves@redhat.com>
|
2014-05-16 Pedro Alves <palves@redhat.com>
|
||||||
|
|
||||||
* lib/mi-support.exp (mi_expect_stop): On timeout, say "timeout"
|
* lib/mi-support.exp (mi_expect_stop): On timeout, say "timeout"
|
||||||
|
@ -256,7 +256,8 @@ proc test_catch_syscall_fail_nodatadir {} {
|
|||||||
|
|
||||||
# Make sure GDB doesn't load the syscalls xml from the system
|
# Make sure GDB doesn't load the syscalls xml from the system
|
||||||
# data directory.
|
# data directory.
|
||||||
gdb_test_no_output "set data-directory /the/path/to/nowhere"
|
gdb_test "set data-directory /the/path/to/nowhere" \
|
||||||
|
"Warning: /the/path/to/nowhere: .*"
|
||||||
|
|
||||||
# Testing to see if we receive a warning when calling "catch
|
# Testing to see if we receive a warning when calling "catch
|
||||||
# syscall" without XML support (without datadir).
|
# syscall" without XML support (without datadir).
|
||||||
@ -374,7 +375,8 @@ proc test_catch_syscall_with_wrong_args_noxml {} {
|
|||||||
proc do_syscall_tests_without_xml {} {
|
proc do_syscall_tests_without_xml {} {
|
||||||
# Make sure GDB doesn't load the syscalls xml from the system data
|
# Make sure GDB doesn't load the syscalls xml from the system data
|
||||||
# directory.
|
# directory.
|
||||||
gdb_test_no_output "set data-directory /the/path/to/nowhere"
|
gdb_test "set data-directory /the/path/to/nowhere" \
|
||||||
|
"Warning: /the/path/to/nowhere: .*"
|
||||||
|
|
||||||
# Let's test if we can catch syscalls without XML support.
|
# Let's test if we can catch syscalls without XML support.
|
||||||
# We should succeed, but GDB is not supposed to print syscall names.
|
# We should succeed, but GDB is not supposed to print syscall names.
|
||||||
|
18
gdb/top.c
18
gdb/top.c
@ -1668,14 +1668,28 @@ show_exec_done_display_p (struct ui_file *file, int from_tty,
|
|||||||
value);
|
value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* New values of the "data-directory" parameter are staged here. */
|
||||||
|
static char *staged_gdb_datadir;
|
||||||
|
|
||||||
/* "set" command for the gdb_datadir configuration variable. */
|
/* "set" command for the gdb_datadir configuration variable. */
|
||||||
|
|
||||||
static void
|
static void
|
||||||
set_gdb_datadir (char *args, int from_tty, struct cmd_list_element *c)
|
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 ();
|
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
|
static void
|
||||||
set_history_filename (char *args, int from_tty, struct cmd_list_element *c)
|
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);
|
&setlist, &showlist);
|
||||||
|
|
||||||
add_setshow_filename_cmd ("data-directory", class_maintenance,
|
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."),
|
_("Show GDB's data directory."),
|
||||||
_("\
|
_("\
|
||||||
When set, GDB uses the specified path to search for data files."),
|
When set, GDB uses the specified path to search for data files."),
|
||||||
set_gdb_datadir, NULL,
|
set_gdb_datadir, show_gdb_datadir,
|
||||||
&setlist,
|
&setlist,
|
||||||
&showlist);
|
&showlist);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user