From: dje@google.com (Doug Evans)
To: gdb-patches@sourceware.org
Subject: [doc RFA] Don't search $cdir in openp
Date: Tue, 06 Apr 2010 18:02:00 -0000 [thread overview]
Message-ID: <20100406180226.A185884397@ruffy.mtv.corp.google.com> (raw)
Hi.
I'd like to check this in if there are no objections.
GDB uses the source search path for scripts, which includes $cdir.
But GDB doesn't actually expand $cdir, it just leaves it as is,
so if the user actually had a directory named $cdir it would get
used. This means that $cdir means different things in different
contexts (source file vs script file) and I think that's wrong.
Therefore this patch causes openp to skip $cdir.
This is ok for source files since it's handled at a higher level
(and openp doesn't know what to substitute for $cdir anyway).
I've tweaked the docs to clarify things.
Can I get approval (or rewording) for the doc part of the patch?
2010-04-06 Doug Evans <dje@google.com>
* 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.
Index: source.c
===================================================================
RCS file: /cvs/src/src/gdb/source.c,v
retrieving revision 1.108
diff -u -p -r1.108 source.c
--- source.c 10 Mar 2010 18:20:06 -0000 1.108
+++ source.c 6 Apr 2010 17:40:05 -0000
@@ -764,6 +764,15 @@ openp (const char *path, int opts, const
/* 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'. */
+ if (strcmp (filename, "$cdir") == 0)
+ continue;
}
/* Remove trailing slashes */
Index: doc/gdb.texinfo
===================================================================
RCS file: /cvs/src/src/gdb/doc/gdb.texinfo,v
retrieving revision 1.696
diff -u -p -r1.696 gdb.texinfo
--- doc/gdb.texinfo 5 Apr 2010 17:14:57 -0000 1.696
+++ doc/gdb.texinfo 6 Apr 2010 18:00:45 -0000
@@ -19383,8 +19383,12 @@ unless the order of execution is changed
printed as they are executed. An error in any command terminates
execution of the command file and control is returned to the console.
-@value{GDBN} searches for @var{filename} in the current directory and then
-on the search path (specified with the @samp{directory} command).
+@value{GDBN} first searches for @var{filename} in the current directory.
+If the file is not found there, and @var{filename} does not specify a
+directory, then @value{GDBN} also looks for the file on the source search path
+(specified with the @samp{directory} command);
+except that @file{$cdir} is not searched, @file{$cdir} is meaningless
+in this context.
If @code{-v}, for verbose mode, is given then @value{GDBN} displays
each command as it is executed. The option must be given before
next reply other threads:[~2010-04-06 18:02 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-04-06 18:02 Doug Evans [this message]
2010-04-06 18:12 ` Doug Evans
2010-04-06 18:32 ` Eli Zaretskii
2010-04-07 20:03 ` Tom Tromey
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20100406180226.A185884397@ruffy.mtv.corp.google.com \
--to=dje@google.com \
--cc=gdb-patches@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox