aboutsummaryrefslogtreecommitdiff
path: root/gdb/doc
diff options
context:
space:
mode:
authorDoug Evans <dje@google.com>2010-04-15 17:45:57 +0000
committerDoug Evans <dje@google.com>2010-04-15 17:45:57 +0000
commit3f7b2faa4bb3f35f6c88687b6943cdbe6003b615 (patch)
tree8bf0af678389bf6da72d8bc3def978e10ca77485 /gdb/doc
parent75375b3e00c282a6461d1a3df83582f624b18377 (diff)
downloadgdb-3f7b2faa4bb3f35f6c88687b6943cdbe6003b615.zip
gdb-3f7b2faa4bb3f35f6c88687b6943cdbe6003b615.tar.gz
gdb-3f7b2faa4bb3f35f6c88687b6943cdbe6003b615.tar.bz2
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.
Diffstat (limited to 'gdb/doc')
-rw-r--r--gdb/doc/ChangeLog4
-rw-r--r--gdb/doc/gdb.texinfo17
2 files changed, 20 insertions, 1 deletions
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 <dje@google.com>
+
+ * gdb.texinfo (Command Files): Add docs for new "source -s" option.
+
2010-04-14 Phil Muldoon <pmuldoon@redhat.com>
* 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.