This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] Add test for Fission DWP files with binary+dwp in different directories


Jan Kratochvil writes:
 > On Sat, 08 Feb 2014 02:38:44 +0100, Doug Evans wrote:
 > > --- 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)
 > 
 > These two changes are not right:
 > 	make clean
 > 	git status
 > ->
 > 	deleted: gdb.base/argv0-symlink.c
 > 	deleted: gdb.base/argv0-symlink.exp

Blech, my mind just can't keep in cache the possibility of objdir==srcdir.

 > Here should be
 > 	rm -rf $dwp_bin_dir $dwp_dwp_dir $dwp_symlink_dir
 > as otherwise
 > 	rm -rf gdb.base/argv0-dwp1/; touch gdb.base/argv0-dwp1
 > 	runtest-dwp gdb.base/argv0-symlink.exp
 > produces false
 > 	ERROR: Couldn't load .../argv0-dwp3/argv0-dwp-binary into .../testsuite/../../gdb/gdb.

Done.

 > > +    if ![runto_main] {
 > 
 > > +	untested "could not run to main"
 > 
 > Not needed as runto already prints an error if it fails.

Hmmm, the original author of this file didn't get that memo.  :-)

Done.

 > 
 > > +	return -1
 > > +    }
 > > +
 > > +    gdb_test {print argv[0]} ".*/$dwp_symlink_binary\"" "symlinks with fission dwp"
 > > +}
 > 
 > Nitpick: here could be
 > else {
 > 	untested "symlinks with fission dwp (no .dwp support)"
 > }

As it turns out there is already a file to test dwp w/ symlinks,
so I've moved the test there.

2014-02-11  Doug Evans  <dje@google.com>

	* gdb.dwarf2/Makefile.in (EXECUTABLES): Add dwp-symlink.
	(MISCELLANEOUS): New variable.
	(clean): rm -rf $(MISCELLANEOUS).
	* gdb.dwarf2/dwp-symlink.exp: Test the case where the executable and
	dwp live in the same directory as symlinks, with each symlink pointed
	to a differently named file in a different directory.

diff --git a/gdb/testsuite/gdb.dwarf2/Makefile.in b/gdb/testsuite/gdb.dwarf2/Makefile.in
index 978cdfd..7697e8c 100644
--- a/gdb/testsuite/gdb.dwarf2/Makefile.in
+++ b/gdb/testsuite/gdb.dwarf2/Makefile.in
@@ -21,7 +21,12 @@ VPATH = @srcdir@
 srcdir = @srcdir@
 
 EXECUTABLES = *.x pr10770 dw2-cp-infcall-ref-static dw2-inline-param \
-	dw2-noloc dw2-ranges dw2-ref-missing-frame dw2-unresolved gdb-index
+	dw2-noloc dw2-ranges dw2-ref-missing-frame dw2-unresolved gdb-index \
+	dwp-symlink
+
+MISCELLANEOUS = \
+	dwp-symlink.dwp dwp-symlink-thelink dwp-symlink-thelink.dwp \
+	dwp-dir1 dwp-dir2 dwp-dir3
 
 all info install-info dvi install uninstall installcheck check:
 	@echo "Nothing to be done for $@..."
@@ -31,6 +36,7 @@ clean mostlyclean:
 	-rm -f core core.coremaker coremaker.core corefile
 	-rm -f *.dwo *.dwp
 	-rm -f $(EXECUTABLES)
+	-rm -rf $(MISCELLANEOUS)
 	-rm -f *.gdb-index *.with-index
 
 distclean maintainer-clean realclean: clean
diff --git a/gdb/testsuite/gdb.dwarf2/dwp-symlink.exp b/gdb/testsuite/gdb.dwarf2/dwp-symlink.exp
index a0e1897..52fe893 100644
--- a/gdb/testsuite/gdb.dwarf2/dwp-symlink.exp
+++ b/gdb/testsuite/gdb.dwarf2/dwp-symlink.exp
@@ -87,5 +87,44 @@ gdb_test "cd .." "Working directory .*"
 gdb_test "ptype main" {type = int \(int, char \*\*\)} \
     "relative path, binary symlink, dwp at symlink"
 
+# Rename the dwp file back to its original name.
+remote_exec host "mv -f [standard_output_file ${thelink}.dwp] [standard_output_file ${testfile}.dwp]"
+
 # N.B. At this point the active gdb is in, essentially, some random directory.
 # Restart a new copy if you add more tests here.
+
+# Now verify that 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
+
+set dwp_bin_dir [standard_output_file dwp-dir1]
+set dwp_dwp_dir [standard_output_file dwp-dir2]
+set dwp_symlink_dir [standard_output_file dwp-dir3]
+set dwp_real_binary "dwp-abc"
+set dwp_real_dwp "dwp-def"
+set dwp_symlink_binary "dwp-symlink-binary"
+set dwp_symlink_dwp "${dwp_symlink_binary}.dwp"
+
+remote_exec host "rm -rf ${dwp_bin_dir}"
+remote_exec host "rm -rf ${dwp_dwp_dir}"
+remote_exec host "rm -rf ${dwp_symlink_dir}"
+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 [standard_output_file ${testfile}.dwp] ${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] {
+    return -1
+}
+
+gdb_test {print argv[0]} ".*/${dwp_symlink_binary}\"" \
+    "separate executable/dwp symlinks"


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]