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]

FYI: more cleanups in gdb.dwarf2


I'm checking this in.

Right now if you run the test suite, gdb.dwarf2 will leave a bunch of
files in '.':

    dup-psym.o dw2-anonymous-func.o dw2-basic.o dw2-compressed.o
    dw2-const.o dw2-cu-size.o dw2-intercu.o dw2-intermix.o
    dw2-producer.o dw2-strp.o mac-fileno.o main-ndebug.o main.o

This is due to "bad" invocations of gdb_compile.
This is a latent test-suite parallelization bug, e.g., "main.o" is going
to cause a lot of clashes.

This patch fixes the problem.

Regtested on x86-64 Fedora 16.

Tom

2012-07-12  Tom Tromey  <tromey@redhat.com>

	* gdb.dwarf2/dup-psym.exp: Use prepare_for_testing_full.
	* gdb.dwarf2/dw2-anonymous-func.exp: Use
	prepare_for_testing_full.
	* gdb.dwarf2/dw2-basic.exp: Use prepare_for_testing_full.
	* gdb.dwarf2/dw2-compressed.exp: Use prepare_for_testing_full.
	* gdb.dwarf2/dw2-const.exp: Use prepare_for_testing_full.
	* gdb.dwarf2/dw2-cu-size.exp: Use prepare_for_testing_full.
	* gdb.dwarf2/dw2-intercu.exp: Use prepare_for_testing_full.
	* gdb.dwarf2/dw2-intermix.exp: Use prepare_for_testing_full.
	* gdb.dwarf2/dw2-linkage-name-trust.exp: Use
	prepare_for_testing_full.
	* gdb.dwarf2/dw2-producer.exp: Use prepare_for_testing_full.
	* gdb.dwarf2/dw2-ref-missing-frame.exp: Use
	prepare_for_testing_full.
	* gdb.dwarf2/dw2-restore.exp: Use prepare_for_testing_full.
	* gdb.dwarf2/dw2-strp.exp: Use prepare_for_testing_full.
	* gdb.dwarf2/mac-fileno.exp: Use prepare_for_testing_full.

Index: gdb.dwarf2/dup-psym.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.dwarf2/dup-psym.exp,v
retrieving revision 1.10
diff -u -r1.10 dup-psym.exp
--- gdb.dwarf2/dup-psym.exp	27 Jun 2012 17:00:09 -0000	1.10
+++ gdb.dwarf2/dup-psym.exp	12 Jul 2012 15:14:08 -0000
@@ -23,23 +23,11 @@
 
 standard_testfile .S
 
-if  { [gdb_compile "${srcdir}/${subdir}/main.c" "main.o" object {debug}] != "" } {
+if {[prepare_for_testing_full $testfile.exp \
+	 [list $testfile {debug} main.c debug $srcfile nodebug]]} {
     return -1
 }
 
-if  { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${testfile}.o" object {nodebug}] != "" } {
-    return -1
-}
-
-if  { [gdb_compile "${testfile}.o main.o" "${binfile}" executable {debug}] != "" } {
-    return -1
-}
-
-gdb_exit
-gdb_start
-# Note that we do not change the sources search path,
-gdb_load ${binfile}
-
 set test "info sources should contain only one reference to file1.txt"
 gdb_test_multiple "info sources" "$test" {
   -re "file1\\.txt.*file1\\.txt.*$gdb_prompt $" {
Index: gdb.dwarf2/dw2-anonymous-func.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.dwarf2/dw2-anonymous-func.exp,v
retrieving revision 1.5
diff -u -r1.5 dw2-anonymous-func.exp
--- gdb.dwarf2/dw2-anonymous-func.exp	27 Jun 2012 17:00:09 -0000	1.5
+++ gdb.dwarf2/dw2-anonymous-func.exp	12 Jul 2012 15:14:08 -0000
@@ -24,23 +24,11 @@
 standard_testfile .S
 set dwarf_srcfile "file1.txt"
 
-if  { [gdb_compile "${srcdir}/${subdir}/main.c" "main.o" object {debug}] != "" } {
+if {[prepare_for_testing_full $testfile.exp \
+	 [list $testfile debug main.c debug $srcfile nodebug]]} {
     return -1
 }
 
-if  { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${testfile}.o" object {nodebug}] != "" } {
-    return -1
-}
-
-if  { [gdb_compile "${testfile}.o main.o" "${binfile}" executable {debug}] != "" } {
-    return -1
-}
-
-gdb_exit
-gdb_start
-gdb_reinitialize_dir $srcdir/$subdir
-gdb_load ${binfile}
-
 # Force the debugger to create the file1.txt symtab, to make sure that
 # the debugger does not crash doing so.
 gdb_test "list file1.txt:1" "File 1 Line 1.*File 1 Line 8" "list file1.txt"
Index: gdb.dwarf2/dw2-basic.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.dwarf2/dw2-basic.exp,v
retrieving revision 1.14
diff -u -r1.14 dw2-basic.exp
--- gdb.dwarf2/dw2-basic.exp	27 Jun 2012 17:00:09 -0000	1.14
+++ gdb.dwarf2/dw2-basic.exp	12 Jul 2012 15:14:08 -0000
@@ -24,23 +24,11 @@
 standard_testfile .S
 set dwarf_srcfile "file1.txt"
 
-if  { [gdb_compile "${srcdir}/${subdir}/main.c" "main.o" object {debug}] != "" } {
+if {[prepare_for_testing_full $testfile.exp \
+	 [list $testfile debug main.c debug $srcfile nodebug]]} {
     return -1
 }
 
-if  { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${testfile}.o" object {nodebug}] != "" } {
-    return -1
-}
-
-if  { [gdb_compile "${testfile}.o main.o" "${binfile}" executable {debug}] != "" } {
-    return -1
-}
-
-gdb_exit
-gdb_start
-gdb_reinitialize_dir $srcdir/$subdir
-gdb_load ${binfile}
-
 set remote_dwarf_srcfile [remote_download host ${srcdir}/${subdir}/${dwarf_srcfile}]
 
 gdb_test_no_output "set listsize 1"
Index: gdb.dwarf2/dw2-compressed.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.dwarf2/dw2-compressed.exp,v
retrieving revision 1.9
diff -u -r1.9 dw2-compressed.exp
--- gdb.dwarf2/dw2-compressed.exp	27 Jun 2012 17:00:09 -0000	1.9
+++ gdb.dwarf2/dw2-compressed.exp	12 Jul 2012 15:14:08 -0000
@@ -24,23 +24,13 @@
 standard_testfile .S
 set dwarf_srcfile "file1.txt"
 
-if  { [gdb_compile "${srcdir}/${subdir}/main.c" "main-ndebug.o" object -g0] != "" } {
+if {[prepare_for_testing_full $testfile.exp \
+	 [list $testfile \
+	      {debug additional_flags=-static additional_flags=-nostdlib} \
+	      main.c -g0 $srcfile nodebug]]} {
     return -1
 }
 
-if  { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${testfile}.o" object {nodebug}] != "" } {
-    return -1
-}
-
-if  { [gdb_compile "${testfile}.o main-ndebug.o -static -nostdlib" "${binfile}" executable {debug}] != "" } {
-    return -1
-}
-
-gdb_exit
-gdb_start
-gdb_reinitialize_dir $srcdir/$subdir
-gdb_load ${binfile}
-
 set remote_dwarf_srcfile [remote_download host ${srcdir}/${subdir}/${dwarf_srcfile}]
 
 gdb_test_no_output "set listsize 1"
Index: gdb.dwarf2/dw2-const.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.dwarf2/dw2-const.exp,v
retrieving revision 1.6
diff -u -r1.6 dw2-const.exp
--- gdb.dwarf2/dw2-const.exp	27 Jun 2012 17:00:09 -0000	1.6
+++ gdb.dwarf2/dw2-const.exp	12 Jul 2012 15:14:08 -0000
@@ -21,20 +21,11 @@
 
 standard_testfile .S
 
-if  { [gdb_compile "${srcdir}/${subdir}/main.c" "main.o" object {debug}] != "" } {
+if {[prepare_for_testing_full $testfile.exp \
+	 [list $testfile debug main.c debug $srcfile nodebug]]} {
     return -1
 }
 
-if  { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${testfile}.o" object {nodebug}] != "" } {
-    return -1
-}
-
-if  { [gdb_compile "${testfile}.o main.o" "${binfile}" executable {debug}] != "" } {
-    return -1
-}
-
-clean_restart ${testfile}
-
 gdb_test "print twelve" "= 12"
 
 gdb_test "print/x val8" " = 0xffffffff00000000"
Index: gdb.dwarf2/dw2-cu-size.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.dwarf2/dw2-cu-size.exp,v
retrieving revision 1.7
diff -u -r1.7 dw2-cu-size.exp
--- gdb.dwarf2/dw2-cu-size.exp	27 Jun 2012 17:00:09 -0000	1.7
+++ gdb.dwarf2/dw2-cu-size.exp	12 Jul 2012 15:14:08 -0000
@@ -26,21 +26,9 @@
 
 standard_testfile .S
 
-if  { [gdb_compile "${srcdir}/${subdir}/main.c" "main.o" object {debug}] != "" } {
+if {[prepare_for_testing_full $testfile.exp \
+	 [list $testfile debug main.c debug $srcfile nodebug]]} {
     return -1
 }
 
-if  { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${testfile}.o" object {nodebug}] != "" } {
-    return -1
-}
-
-if  { [gdb_compile "${testfile}.o main.o" "${binfile}" executable {debug}] != "" } {
-    return -1
-}
-
-gdb_exit
-gdb_start
-gdb_reinitialize_dir $srcdir/$subdir
-gdb_load ${binfile}
-
 gdb_test "ptype noloc" "type = const int"
Index: gdb.dwarf2/dw2-intercu.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.dwarf2/dw2-intercu.exp,v
retrieving revision 1.14
diff -u -r1.14 dw2-intercu.exp
--- gdb.dwarf2/dw2-intercu.exp	27 Jun 2012 17:00:09 -0000	1.14
+++ gdb.dwarf2/dw2-intercu.exp	12 Jul 2012 15:14:08 -0000
@@ -24,23 +24,11 @@
 standard_testfile .S
 set dwarf_srcfile "file1.txt"
 
-if  { [gdb_compile "${srcdir}/${subdir}/main.c" "main.o" object {debug}] != "" } {
+if {[prepare_for_testing_full $testfile.exp \
+	 [list $testfile debug main.c debug $srcfile nodebug]]} {
     return -1
 }
 
-if  { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${testfile}.o" object {nodebug}] != "" } {
-    return -1
-}
-
-if  { [gdb_compile "${testfile}.o main.o" "${binfile}" executable {debug}] != "" } {
-    return -1
-}
-
-gdb_exit
-gdb_start
-gdb_reinitialize_dir $srcdir/$subdir
-gdb_load ${binfile}
-
 set remote_dwarf_srcfile [remote_download host ${srcdir}/${subdir}/${dwarf_srcfile}]
 
 # This needs to be done first so that the CU for int2 gets expanded first.
Index: gdb.dwarf2/dw2-intermix.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.dwarf2/dw2-intermix.exp,v
retrieving revision 1.12
diff -u -r1.12 dw2-intermix.exp
--- gdb.dwarf2/dw2-intermix.exp	27 Jun 2012 17:00:09 -0000	1.12
+++ gdb.dwarf2/dw2-intermix.exp	12 Jul 2012 15:14:08 -0000
@@ -24,23 +24,11 @@
 standard_testfile .S
 set dwarf_srcfile "file1.txt"
 
-if  { [gdb_compile "${srcdir}/${subdir}/main.c" "main.o" object {debug}] != "" } {
+if {[prepare_for_testing_full $testfile.exp \
+	 [list $testfile debug main.c debug $srcfile nodebug]]} {
     return -1
 }
 
-if  { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${testfile}.o" object {nodebug}] != "" } {
-    return -1
-}
-
-if  { [gdb_compile "${testfile}.o main.o" "${binfile}" executable {debug}] != "" } {
-    return -1
-}
-
-gdb_exit
-gdb_start
-gdb_reinitialize_dir $srcdir/$subdir
-gdb_load ${binfile}
-
 set remote_dwarf_srcfile [remote_download host ${srcdir}/${subdir}/${dwarf_srcfile}]
 
 gdb_test_no_output "set listsize 1"
Index: gdb.dwarf2/dw2-linkage-name-trust.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.dwarf2/dw2-linkage-name-trust.exp,v
retrieving revision 1.3
diff -u -r1.3 dw2-linkage-name-trust.exp
--- gdb.dwarf2/dw2-linkage-name-trust.exp	27 Jun 2012 17:00:09 -0000	1.3
+++ gdb.dwarf2/dw2-linkage-name-trust.exp	12 Jul 2012 15:14:08 -0000
@@ -25,16 +25,15 @@
     return 0  
 }
 
-standard_testfile
+standard_testfile .S
 set executable ${testfile}
-if { [gdb_compile ${srcdir}/${subdir}/${testfile}-main.cc "${objdir}/${subdir}/${testfile}-main.o" object {c++ debug}] != ""
-     || [gdb_compile "${srcdir}/${subdir}/${testfile}.S" "${objdir}/${subdir}/${testfile}.o" object {}] != ""
-     || [gdb_compile "${objdir}/${subdir}/${testfile}-main.o ${objdir}/${subdir}/${testfile}.o" "${binfile}" executable {c++}] != "" } {
+
+if {[prepare_for_testing_full $testfile.exp \
+	 [list $testfile c++ $testfile-main.cc {c++ debug} \
+	      $srcfile {}]]} {
     return -1
 }
 
-clean_restart $executable
-
 if ![runto_main] then {
     return -1
 }
Index: gdb.dwarf2/dw2-producer.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.dwarf2/dw2-producer.exp,v
retrieving revision 1.11
diff -u -r1.11 dw2-producer.exp
--- gdb.dwarf2/dw2-producer.exp	27 Jun 2012 17:00:09 -0000	1.11
+++ gdb.dwarf2/dw2-producer.exp	12 Jul 2012 15:14:08 -0000
@@ -22,23 +22,11 @@
 standard_testfile .S
 set dwarf_srcfile "file1.txt"
 
-if  { [gdb_compile "${srcdir}/${subdir}/main.c" "main.o" object {debug}] != "" } {
+if {[prepare_for_testing_full $testfile.exp \
+	 [list $testfile debug main.c debug $srcfile nodebug]]} {
     return -1
 }
 
-if  { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${testfile}.o" object {nodebug}] != "" } {
-    return -1
-}
-
-if  { [gdb_compile "${testfile}.o main.o" "${binfile}" executable {debug}] != "" } {
-    return -1
-}
-
-gdb_exit
-gdb_start
-gdb_reinitialize_dir $srcdir/$subdir
-gdb_load ${binfile}
-
 set remote_dwarf_srcfile [remote_download host ${srcdir}/${subdir}/${dwarf_srcfile}]
 
 gdb_test_no_output "set listsize 1"
Index: gdb.dwarf2/dw2-ref-missing-frame.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.dwarf2/dw2-ref-missing-frame.exp,v
retrieving revision 1.9
diff -u -r1.9 dw2-ref-missing-frame.exp
--- gdb.dwarf2/dw2-ref-missing-frame.exp	27 Jun 2012 17:00:09 -0000	1.9
+++ gdb.dwarf2/dw2-ref-missing-frame.exp	12 Jul 2012 15:14:08 -0000
@@ -20,22 +20,16 @@
 }
 
 standard_testfile .S
-set objsfile [standard_output_file ${testfile}.o]
 set srcfuncfile ${testfile}-func.c
-set objfuncfile [standard_output_file ${testfile}-func.o]
 set srcmainfile ${testfile}-main.c
-set objmainfile [standard_output_file ${testfile}-main.o]
 set executable ${testfile}
 
-if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" $objsfile object {}] != ""
-     || [gdb_compile "${srcdir}/${subdir}/${srcfuncfile}" $objfuncfile object {}] != ""
-     || [gdb_compile "${srcdir}/${subdir}/${srcmainfile}" $objmainfile object {debug}] != ""
-     || [gdb_compile "$objsfile $objfuncfile $objmainfile" $binfile executable {}] != "" } {
+if {[prepare_for_testing_full $testfile.exp \
+	 [list $testfile {} $srcfile {} $srcfuncfile {} \
+	      $srcmainfile debug]]} {
     return -1
 }
 
-clean_restart $executable
-
 # First try referencing DW_AT_frame_base which is not defined.
 if [runto func_nofb] {
     gdb_test "p func_nofb_var" {Could not find the frame base for "func_nofb".} "func_nofb print"
Index: gdb.dwarf2/dw2-restore.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.dwarf2/dw2-restore.exp,v
retrieving revision 1.8
diff -u -r1.8 dw2-restore.exp
--- gdb.dwarf2/dw2-restore.exp	27 Jun 2012 17:00:09 -0000	1.8
+++ gdb.dwarf2/dw2-restore.exp	12 Jul 2012 15:14:08 -0000
@@ -21,16 +21,11 @@
 }
 standard_testfile .S
 
-if  { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable \
-       [list {additional_flags=-nostdlib}]] != "" } {
+if {[prepare_for_testing $testfile.exp $testfile [list $srcfile] \
+	 [list {additional_flags=-nostdlib}]]} {
     return -1
 }
 
-gdb_exit
-gdb_start
-gdb_reinitialize_dir $srcdir/$subdir
-gdb_load ${binfile}
-
 if ![runto foo] {
     return 0
 }
Index: gdb.dwarf2/dw2-strp.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.dwarf2/dw2-strp.exp,v
retrieving revision 1.9
diff -u -r1.9 dw2-strp.exp
--- gdb.dwarf2/dw2-strp.exp	27 Jun 2012 17:00:09 -0000	1.9
+++ gdb.dwarf2/dw2-strp.exp	12 Jul 2012 15:14:08 -0000
@@ -24,23 +24,11 @@
 
 standard_testfile .S
 
-if  { [gdb_compile "${srcdir}/${subdir}/main.c" "main.o" object {debug}] != "" } {
+if {[prepare_for_testing_full $testfile.exp \
+	 [list $testfile debug main.c debug $srcfile nodebug]]} {
     return -1
 }
 
-if  { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${testfile}.o" object {nodebug}] != "" } {
-    return -1
-}
-
-if  { [gdb_compile "${testfile}.o main.o" "${binfile}" executable {debug}] != "" } {
-    return -1
-}
-
-gdb_exit
-gdb_start
-gdb_reinitialize_dir $srcdir/$subdir
-gdb_load ${binfile}
-
 gdb_test "p a_string" " = \"hello world!\\\\n\""
 gdb_test "ptype a_string" "type = const char \\\[14\\\]"
 
Index: gdb.dwarf2/mac-fileno.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.dwarf2/mac-fileno.exp,v
retrieving revision 1.12
diff -u -r1.12 mac-fileno.exp
--- gdb.dwarf2/mac-fileno.exp	27 Jun 2012 17:00:09 -0000	1.12
+++ gdb.dwarf2/mac-fileno.exp	12 Jul 2012 15:14:08 -0000
@@ -25,23 +25,11 @@
 standard_testfile .S
 set dwarf_srcfile "file1.txt"
 
-if  { [gdb_compile "${srcdir}/${subdir}/main.c" "main.o" object {debug}] != "" } {
+if {[prepare_for_testing_full $testfile.exp \
+	 [list $testfile debug main.c debug $srcfile nodebug]]} {
     return -1
 }
 
-if  { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${testfile}.o" object {nodebug}] != "" } {
-    return -1
-}
-
-if  { [gdb_compile "${testfile}.o main.o" "${binfile}" executable {debug}] != "" } {
-    return -1
-}
-
-gdb_exit
-gdb_start
-gdb_reinitialize_dir $srcdir/$subdir
-gdb_load ${binfile}
-
 set remote_dwarf_srcfile [remote_download host ${srcdir}/${subdir}/${dwarf_srcfile}]
 
 gdb_test_no_output "set listsize 1"


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