diff options
author | Doug Evans <dje@google.com> | 2011-10-27 15:46:11 +0000 |
---|---|---|
committer | Doug Evans <dje@google.com> | 2011-10-27 15:46:11 +0000 |
commit | d234ef5c0cca9ae4737cfcd833555db14dc0ead0 (patch) | |
tree | bf0ed9a7ba656b0baae5d48d400f04007b890da3 /gdb/cli/cli-cmds.c | |
parent | a08fc94222d1b5be7ecbf52d4d41fa6da1d71f18 (diff) | |
download | gdb-d234ef5c0cca9ae4737cfcd833555db14dc0ead0.zip gdb-d234ef5c0cca9ae4737cfcd833555db14dc0ead0.tar.gz gdb-d234ef5c0cca9ae4737cfcd833555db14dc0ead0.tar.bz2 |
* cli/cli-cmds.c (source_script_with_search): Pass full path to
source_script_from_stream if it may have been found on the search path.
* python/py-auto-load.c (source_section_scripts): Pass full path to
source_python_script_for_objfile.
* python/python.c (source_python_script): Delete stream parameter.
All callers updated.
(source_python_script_for_objfile): Ditto.
* python/python-internal.h (source_python_script_for_objfile): Update.
* python/python.h (source_python_script): Update.
testsuite/
* gdb.python/python.exp: Test source -s.
Diffstat (limited to 'gdb/cli/cli-cmds.c')
-rw-r--r-- | gdb/cli/cli-cmds.c | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/gdb/cli/cli-cmds.c b/gdb/cli/cli-cmds.c index 34a530a..624d0de 100644 --- a/gdb/cli/cli-cmds.c +++ b/gdb/cli/cli-cmds.c @@ -535,7 +535,9 @@ source_script_from_stream (FILE *stream, const char *file) TRY_CATCH (e, RETURN_MASK_ERROR) { - source_python_script (stream, file); + /* The python support reopens the file using python functions, + so there's no point in passing STREAM here. */ + source_python_script (file); } if (e.reason < 0) { @@ -577,7 +579,7 @@ source_script_with_search (const char *file, int from_tty, int search_path) if (!find_and_open_script (file, search_path, &stream, &full_path)) { - /* The script wasn't found, or was otherwise inaccessible. + /* The script wasn't found, or was otherwise inaccessible. If the source command was invoked interactively, throw an error. Otherwise (e.g. if it was invoked by a script), silently ignore the error. */ @@ -588,7 +590,12 @@ source_script_with_search (const char *file, int from_tty, int search_path) } old_cleanups = make_cleanup (xfree, full_path); - source_script_from_stream (stream, file); + /* The python support reopens the file, so we need to pass full_path here + in case the file was found on the search path. It's useful to do this + anyway so that error messages show the actual file used. But only do + this if we (may have) used search_path, as printing the full path in + errors for the non-search case can be more noise than signal. */ + source_script_from_stream (stream, search_path ? full_path : file); do_cleanups (old_cleanups); } |