aboutsummaryrefslogtreecommitdiff
path: root/gdb/testsuite
diff options
context:
space:
mode:
authorDoug Evans <dje@google.com>2015-01-13 17:00:31 -0800
committerDoug Evans <dje@google.com>2015-01-13 17:02:53 -0800
commite02c96a79949824bbe1da22ddfc6b50d362fb552 (patch)
tree8703c754cef937d9fd90c9224327bc81f729f9fa /gdb/testsuite
parent8068939ab8058b48d0c7c318d463b0c6b85741fa (diff)
downloadgdb-e02c96a79949824bbe1da22ddfc6b50d362fb552.zip
gdb-e02c96a79949824bbe1da22ddfc6b50d362fb552.tar.gz
gdb-e02c96a79949824bbe1da22ddfc6b50d362fb552.tar.bz2
Enhance gdb.lookup_objfile so that it works with a symlinked binary.
gdb/Changelog: * objfiles.c (objfile_filename): New function. * objfiles.h (objfile_filename): Declare it. (objfile_name): Add function comment. * python/py-objfile.c (objfpy_lookup_objfile_by_name): Try both the bfd file name (which may be realpath'd), and the original name. gdb/testsuite/ChangeLog: * gdb.python/py-objfile.exp: Test gdb.lookup_objfile on symlinked binary.
Diffstat (limited to 'gdb/testsuite')
-rw-r--r--gdb/testsuite/ChangeLog5
-rw-r--r--gdb/testsuite/gdb.python/py-objfile.exp11
2 files changed, 16 insertions, 0 deletions
diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog
index 4a903bc..fa7ffa9 100644
--- a/gdb/testsuite/ChangeLog
+++ b/gdb/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2015-01-13 Doug Evans <dje@google.com>
+
+ * gdb.python/py-objfile.exp: Test gdb.lookup_objfile on symlinked
+ binary.
+
2015-01-13 Joel Brobecker <brobecker@adacore.com>
* Makefile.in (clean mostlyclean): Do not delete *.py.
diff --git a/gdb/testsuite/gdb.python/py-objfile.exp b/gdb/testsuite/gdb.python/py-objfile.exp
index 50339a6..cddbd3d 100644
--- a/gdb/testsuite/gdb.python/py-objfile.exp
+++ b/gdb/testsuite/gdb.python/py-objfile.exp
@@ -115,3 +115,14 @@ if { [get_python_valueof "sep_objfile.build_id" "None"] != "None" } {
gdb_test "python print (gdb.lookup_objfile (sep_objfile.build_id, by_build_id=True))" \
"Objfile not found\\.\r\n${python_error_text}"
}
+
+# An objfile that was a symlink to a differently named file is still
+# findable with its original name.
+set symlink_binary [standard_output_file "symlink-binary"]
+remote_exec host "rm -f ${symlink_binary}"
+remote_exec host "ln -sf ${testfile} ${symlink_binary}"
+if [remote_file host exists "${symlink_binary}"] {
+ clean_restart "${symlink_binary}"
+ gdb_test "python print (gdb.lookup_objfile (\"${symlink_binary}\").filename)" \
+ "${testfile}" "gdb.lookup_objfile of symlinked binary"
+}