[PATCH] Add test for Fission DWP files with binary+dwp in different directories
Doug Evans
dje@google.com
Sat Feb 8 01:38:00 GMT 2014
Hi.
I want to add another test to the argv0-symlink testcase
to explicitly cover a particular case that arises with the
use of Fission DWP files.
Arguably this test should live in gdb.dwarf2, but I went
with keeping it together with the rest of the argv0 symlink tests.
I'm happy to move it whereever though.
2014-02-07 Doug Evans <dje@google.com>
* gdb.base/Makefile.in (MISCELLANEOUS): Add argv0-*.
(clean): Add -r to rm -f $(MISCELLANEOUS).
* gdb.base/argv0-symlink.exp: Add test for Fission with symlinks and
real binary+dwp in different directories.
diff --git a/gdb/testsuite/gdb.base/Makefile.in b/gdb/testsuite/gdb.base/Makefile.in
index 828ec26..3bfbeb9 100644
--- a/gdb/testsuite/gdb.base/Makefile.in
+++ b/gdb/testsuite/gdb.base/Makefile.in
@@ -51,7 +51,8 @@ MISCELLANEOUS = coremmap.data dprintf-pendshr.sl ../foobar.baz fixsectshr.sl \
unloadshr.sl unloadshr2.sl watchpoint-solib-shr.sl \
weaklib1.sl weaklib2.sl hashline1.c hashline2.c hashline3.c \
auxv.gcore bigcore.corefile *.core *.debug *.stripped \
- gcore-buffer-overflow.test gcore.test shreloc.txt tmp-fullname.c
+ gcore-buffer-overflow.test gcore.test shreloc.txt tmp-fullname.c \
+ argv0-*
all info install-info dvi install uninstall installcheck check:
@echo "Nothing to be done for $@..."
@@ -60,7 +61,7 @@ clean mostlyclean:
-rm -f *~ *.o a.out xgdb *.x *.ci *.tmp
-rm -f *.dwo *.dwp
-rm -f core core.coremaker coremaker.core corefile $(EXECUTABLES)
- -rm -f $(MISCELLANEOUS)
+ -rm -rf $(MISCELLANEOUS)
distclean maintainer-clean realclean: clean
-rm -f *~ core
diff --git a/gdb/testsuite/gdb.base/argv0-symlink.exp b/gdb/testsuite/gdb.base/argv0-symlink.exp
index 0e0202d..6b6a8ad 100644
--- a/gdb/testsuite/gdb.base/argv0-symlink.exp
+++ b/gdb/testsuite/gdb.base/argv0-symlink.exp
@@ -15,10 +15,18 @@
standard_testfile
+# With Fission DWP files, most of the debug info is in ${testfile}.dwp.
+# Remove the file first. If it gets created by build_executable then we
+# know we have one.
+set dwp_file [standard_output_file ${testfile}.dwp]
+remote_file host delete $dwp_file
+
if { [build_executable ${testfile}.exp ${testfile} ${srcfile}] == -1 } {
return -1
}
+set have_fission_dwp [remote_file host exists $dwp_file]
+
set test "kept file symbolic link name"
set filelink "${testfile}-filelink"
@@ -73,3 +81,38 @@ if ![is_remote target] {
}
gdb_test {print argv[0]} "/$dirlink/$filelink\"" $test
gdb_test "info inferiors" "/$lastdir/$filelink *" "$test for info inferiors"
+
+# For Fission with DWP files, verify the following scenario works:
+# dir1/real-binary-with-random-name
+# dir2/real-dwp-with-random-name
+# dir3/symlink-to-real-binary
+# dir3/symlink-to-real-binary.dwp
+
+if { $have_fission_dwp } {
+ set dwp_bin_dir [standard_output_file argv0-dwp1]
+ set dwp_dwp_dir [standard_output_file argv0-dwp2]
+ set dwp_symlink_dir [standard_output_file argv0-dwp3]
+ set dwp_real_binary "dwp-abc"
+ set dwp_real_dwp "dwp-def"
+ set dwp_symlink_binary "argv0-dwp-binary"
+ set dwp_symlink_dwp "${dwp_symlink_binary}.dwp"
+
+ remote_exec host "mkdir $dwp_bin_dir"
+ remote_exec host "mkdir $dwp_dwp_dir"
+ remote_exec host "mkdir $dwp_symlink_dir"
+ remote_exec host "cp [standard_output_file $testfile] $dwp_bin_dir/$dwp_real_binary"
+ remote_exec host "cp $dwp_file $dwp_dwp_dir/$dwp_real_dwp"
+ # We don't test for failure to create the symlink here.
+ # We assume that if the above symlinks are created ok, these will be too.
+ remote_exec host "ln -sf $dwp_bin_dir/$dwp_real_binary $dwp_symlink_dir/$dwp_symlink_binary"
+ remote_exec host "ln -sf $dwp_dwp_dir/$dwp_real_dwp $dwp_symlink_dir/$dwp_symlink_dwp"
+
+ clean_restart "$dwp_symlink_dir/$dwp_symlink_binary"
+
+ if ![runto_main] {
+ untested "could not run to main"
+ return -1
+ }
+
+ gdb_test {print argv[0]} ".*/$dwp_symlink_binary\"" "symlinks with fission dwp"
+}
More information about the Gdb-patches
mailing list