This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
Other format: | [Raw text] |
On Fri, Apr 9, 2010 at 12:31 PM, Eli Zaretskii <eliz@gnu.org> wrote: >> Date: Fri, 9 Apr 2010 11:12:27 -0700 >> From: Doug Evans <dje@google.com> >> Cc: tromey@redhat.com, gdb-patches@sourceware.org >> >> > This is fine, but what if @var{filename} is @file{d:/foo/myscript} (on >> > Windows)? >> >> source.c:openp() doesn't handle that case, it just blindly concatenates. >> [presumably because it hasn't needed to] >> >> I don't have an opinion on what *should* happen here. >> Possibilities are to either not try or remove the drive spec. > > My vote is for removing the drive letter. ?The other alternative means > that absolute file names are handled inconsistently across platforms > (I assume that not trying to look for absolute file name on Posix > platforms will not be a useful behavior). Hi. Here is the patch I will check in pending approval of the doc changes to mention dos drive spec handling. 2010-04-08 Doug Evans <dje@google.com> Add -s option to source command. * NEWS: Document new option. * cli/cli-cmds.c (find_and_open_script): Add function comment. Delete from_tty and cleanupp args. Split filep arg into file and full_pathp. New arg search_path. (source_script_from_stream): New function. (source_script_with_search): New function. (source_script): Rewrite. (source_command): Parse "-s" option. (init_cli_cmds): Add "-s" docs to source command help, and reformat. * python/python.c (source_python_script): Make file arg a const char *. Don't call fclose, leave for caller. * python/python.h (source_python_script): Update. testsuite/ * gdb.base/source-test.gdb: New file. * gdb.base/source.exp: Add tests for "source -s". doc/ * gdb.texinfo (Command Files): Add docs for new "source -s" option. Index: doc/gdb.texinfo =================================================================== RCS file: /cvs/src/src/gdb/doc/gdb.texinfo,v retrieving revision 1.704 diff -u -p -r1.704 gdb.texinfo --- doc/gdb.texinfo 14 Apr 2010 12:02:44 -0000 1.704 +++ doc/gdb.texinfo 14 Apr 2010 21:54:37 -0000 @@ -19373,7 +19373,7 @@ using the @code{script-extension} settin @table @code @kindex source @cindex execute commands from a file -@item source [@code{-v}] @var{filename} +@item source [-s] [-v] @var{filename} Execute the command file @var{filename}. @end table @@ -19390,6 +19390,21 @@ directory, then @value{GDBN} also looks except that @file{$cdir} is not searched because the compilation directory is not relevant to scripts. +If @code{-s} is specified, then @value{GDBN} searches for @var{filename} +on the search path even if @var{filename} specifies a directory. +The search is done by appending @var{filename} to each element of the +search path. So, for example, if @var{filename} is @file{mylib/myscript} +and the search path contains @file{/home/user} then @value{GDBN} will +look for the script @file{/home/user/mylib/myscript}. +The search is also done if @var{filename} is an absolute path. +For example, if @var{filename} is @file{/tmp/myscript} and +the search path contains @file{/home/user} then @value{GDBN} will +look for the script @file{/home/user/tmp/myscript}. +For DOS-like systems, if @var{filename} contains a drive specification, +it is stripped before concatenation. For example, if @var{filename} is +@file{d:myscript} and the search path contains @file{c:/tmp} then @value{GDBN} +will look for the script @file{c:/tmp/myscript}. + If @code{-v}, for verbose mode, is given then @value{GDBN} displays each command as it is executed. The option must be given before @var{filename}, and is interpreted as part of the filename anywhere else. Full patch attached.
Attachment:
gdb-100414-source-s-3.patch.txt
Description: Text document
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |