diff options
author | Doug Evans <dje@google.com> | 2015-10-26 14:33:19 -0700 |
---|---|---|
committer | Doug Evans <dje@google.com> | 2015-10-26 14:33:19 -0700 |
commit | 1a70ae976b673f7762f14734785b34fc5ba92eae (patch) | |
tree | a534938a791fec38364ed434f09d2833b07ff714 /gdb/cli | |
parent | 372405a5e8adbe5affce56410b6d6048c63cac3f (diff) | |
download | gdb-1a70ae976b673f7762f14734785b34fc5ba92eae.zip gdb-1a70ae976b673f7762f14734785b34fc5ba92eae.tar.gz gdb-1a70ae976b673f7762f14734785b34fc5ba92eae.tar.bz2 |
PR python/18938: source -s foo.py with foo.py a symlink to foo.notpy fails
gdb/ChangeLog:
PR python/18938
* cli/cli-cmds (source_script_fron_sctream): New arg file_to_open.
All callers updated.
gdb/testsuite/ChangeLog:
* gdb.python/python.exp: Add test for symlink from .py file to .notpy
file.
Diffstat (limited to 'gdb/cli')
-rw-r--r-- | gdb/cli/cli-cmds.c | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/gdb/cli/cli-cmds.c b/gdb/cli/cli-cmds.c index 6753c70..1886cae 100644 --- a/gdb/cli/cli-cmds.c +++ b/gdb/cli/cli-cmds.c @@ -538,10 +538,16 @@ find_and_open_script (const char *script_file, int search_path, return 1; } -/* Load script FILE, which has already been opened as STREAM. */ +/* Load script FILE, which has already been opened as STREAM. + FILE_TO_OPEN is the form of FILE to use if one needs to open the file. + This is provided as FILE may have been found via the source search path. + An important thing to note here is that FILE may be a symlink to a file + with a different or non-existing suffix, and thus one cannot infer the + extension language from FILE_TO_OPEN. */ static void -source_script_from_stream (FILE *stream, const char *file) +source_script_from_stream (FILE *stream, const char *file, + const char *file_to_open) { if (script_ext_mode != script_ext_off) { @@ -556,7 +562,7 @@ source_script_from_stream (FILE *stream, const char *file) = ext_lang_script_sourcer (extlang); gdb_assert (sourcer != NULL); - sourcer (extlang, stream, file); + sourcer (extlang, stream, file_to_open); return; } else if (script_ext_mode == script_ext_soft) @@ -609,7 +615,7 @@ source_script_with_search (const char *file, int from_tty, int search_path) 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); + source_script_from_stream (stream, file, search_path ? full_path : file); do_cleanups (old_cleanups); } |