From 3f7b2faa4bb3f35f6c88687b6943cdbe6003b615 Mon Sep 17 00:00:00 2001 From: Doug Evans Date: Thu, 15 Apr 2010 17:45:57 +0000 Subject: 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. --- gdb/doc/ChangeLog | 4 ++++ gdb/doc/gdb.texinfo | 17 ++++++++++++++++- 2 files changed, 20 insertions(+), 1 deletion(-) (limited to 'gdb/doc') diff --git a/gdb/doc/ChangeLog b/gdb/doc/ChangeLog index 5a01076..ce9092f 100644 --- a/gdb/doc/ChangeLog +++ b/gdb/doc/ChangeLog @@ -1,3 +1,7 @@ +2010-04-15 Doug Evans + + * gdb.texinfo (Command Files): Add docs for new "source -s" option. + 2010-04-14 Phil Muldoon * gdb.texinfo (Pretty Printing): Document behaviour when to_string diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo index 104a1ec..749e975 100644 --- a/gdb/doc/gdb.texinfo +++ b/gdb/doc/gdb.texinfo @@ -19373,7 +19373,7 @@ using the @code{script-extension} setting. @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 for the file on the source search path 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. -- cgit v1.1