aboutsummaryrefslogtreecommitdiff
path: root/gdb/source.c
diff options
context:
space:
mode:
authorDoug Evans <dje@google.com>2010-04-08 21:08:40 +0000
committerDoug Evans <dje@google.com>2010-04-08 21:08:40 +0000
commit080017175b5248f1e5b0d48a55a06634244db459 (patch)
tree8d15bc0ee57732cc1e00075e1acd5550dc7d992a /gdb/source.c
parent938d2b7434405c3e8cf1ceeb9496ff0bac01e84c (diff)
downloadgdb-080017175b5248f1e5b0d48a55a06634244db459.zip
gdb-080017175b5248f1e5b0d48a55a06634244db459.tar.gz
gdb-080017175b5248f1e5b0d48a55a06634244db459.tar.bz2
* source.c (openp): Skip $cdir in PATH.
doc/ * gdb.texinfo (Command Files): Document that gdb skips $cdir in search path, and document that gdb only scans the search path if the script's path doesn't specify a directory.
Diffstat (limited to 'gdb/source.c')
-rw-r--r--gdb/source.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/gdb/source.c b/gdb/source.c
index dda5d1b..e9893ba 100644
--- a/gdb/source.c
+++ b/gdb/source.c
@@ -764,6 +764,16 @@ openp (const char *path, int opts, const char *string,
/* Normal file name in path -- just use it. */
strncpy (filename, p, len);
filename[len] = 0;
+
+ /* Don't search $cdir. It's also a magic path like $cwd, but we
+ don't have enough information to expand it. The user *could*
+ have an actual directory named '$cdir' but handling that would
+ be confusing, it would mean different things in different
+ contexts. If the user really has '$cdir' one can use './$cdir'.
+ We can get $cdir when loading scripts. When loading source files
+ $cdir must have already been expanded to the correct value. */
+ if (strcmp (filename, "$cdir") == 0)
+ continue;
}
/* Remove trailing slashes */