Enhance gdb.lookup_objfile so that it works with a symlinked binary.
[deliverable/binutils-gdb.git] / gdb / testsuite / gdb.python / py-objfile.exp
index 50339a6c9fe13928f1f4d3451d4d3e56b75240bf..cddbd3de89e52af8070894c6073310b09913edc6 100644 (file)
@@ -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"
+}
This page took 0.024481 seconds and 4 git commands to generate.