From: Doug Evans Date: Thu, 10 Dec 2015 20:00:34 +0000 (-0800) Subject: patch ../103142573.patch X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=13265fa94289f4276e1011903b6d88003669bd6b;p=thirdparty%2Fbinutils-gdb.git patch ../103142573.patch --- diff --git a/README.google b/README.google index cbbd796d2be..df0c3f90eec 100644 --- a/README.google +++ b/README.google @@ -468,3 +468,16 @@ they are an ongoing maintenance burden. + testsuite/ + * gdb.base/gcore-build-id-pie.c: New file. + * gdb.base/gcore-build-id-pie.exp: New file. +--- README.google 2015-09-11 16:22:06.000000000 -0700 ++++ README.google 2015-09-15 16:23:33.000000000 -0700 ++ ++2015-09-15 Doug Evans ++ ++ Submitted upstream, not committed there yet. ++ PR python/18938 ++ * cli/cli-cmds (source_script_fron_sctream): New arg file_to_open. ++ All callers updated. ++ ++ testsuite/ ++ * gdb.python/python.exp: Add test for symlink from .py file to .notpy ++ file. diff --git a/gdb/cli/cli-cmds.c b/gdb/cli/cli-cmds.c index 2ec2dd35d33..798aa84112a 100644 --- a/gdb/cli/cli-cmds.c +++ b/gdb/cli/cli-cmds.c @@ -537,10 +537,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) { @@ -555,7 +561,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) @@ -608,7 +614,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); } diff --git a/gdb/testsuite/gdb.python/python.exp b/gdb/testsuite/gdb.python/python.exp index a0b80e0935e..19b832266aa 100644 --- a/gdb/testsuite/gdb.python/python.exp +++ b/gdb/testsuite/gdb.python/python.exp @@ -96,6 +96,19 @@ gdb_test "source $remote_source2_py" "yes" "source source2.py" gdb_test "source -s source2.py" "yes" "source -s source2.py" +set remote_source2_symlink_notpy \ + [gdb_remote_download host ${srcdir}/${subdir}/source2.py \ + [standard_output_file "source2-symlink.notpy"]] +set remote_source2_symlink_py [standard_output_file "source2-symlink.py"] +remote_file host delete $remote_source2_symlink_py +set status [remote_exec host "ln -sf $remote_source2_symlink_notpy $remote_source2_symlink_py"] +set test "source -s source2-symlink.py" +if {[lindex $status 0] == 0} { + gdb_test "source -s $remote_source2_symlink_py" "yes" $test +} else { + unsupported "$test (host does not support symbolic links)" +} + gdb_test "python print (gdb.current_objfile())" "None" gdb_test "python print (gdb.objfiles())" "\\\[\\\]"