Pass --data-directory through gdb_realpath.
Commit Message
Hi.
gdb currently records the supplied --data-directory as is,
which if a relative path will be wrong if the user cd's
to a different directory.
2014-04-15 Doug Evans <dje@google.com>
* main.c (captured_main): Pass --data-directory through gdb_realpath.
@@ -642,7 +642,15 @@ captured_main (void *data)
break;
case 'D':
xfree (gdb_datadir);
- gdb_datadir = xstrdup (optarg);
+ if (optarg[0] == '\0')
+ {
+ fprintf_unfiltered (gdb_stderr,
+ _("%s: empty path for"
+ " `--data-directory'\n"),
+ argv[0]);
+ exit (1);
+ }
+ gdb_datadir = gdb_realpath (optarg);
gdb_datadir_provided = 1;
break;
#ifdef GDBTK