This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
[PATCH] Pass --data-directory through gdb_realpath.
- From: Doug Evans <dje at google dot com>
- To: gdb-patches at sourceware dot org
- Date: Tue, 15 Apr 2014 10:37:20 -0700
- Subject: [PATCH] Pass --data-directory through gdb_realpath.
- Authentication-results: sourceware.org; auth=none
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.
diff --git a/gdb/main.c b/gdb/main.c
index 59015f5..d269638 100644
--- a/gdb/main.c
+++ b/gdb/main.c
@@ -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