FYI: fix up gdb.threads

Tom Tromey tromey@redhat.com
Tue Jun 26 19:23:00 GMT 2012


I'm checking this in.

This applies the standard_* cleanup to gdb.threads.

gdb.threads was a bit trickier than the norm, but nothing too severe.
Basically, the older the test, the more likely it is to have problems.

After this patch gdb.threads is still not quite objdir-free.  The old
tests step.exp and step2.exp use it.  But, they don't do anything --
Pedro did some archaeology and found that these date to a time when the
Makefile built the tests.  (I never knew about that...)

I will send a second patch to try to fix those up.

Regtested on x86-64 Fedora 16.

Tom

2012-06-26  Tom Tromey  <tromey@redhat.com>

	* gdb.threads/watchpoint-fork.exp (test): Use
	standard_output_file.  Don't declare objdir.
	* gdb.threads/attach-into-signal.exp: Use standard_testfile,
	standard_output_file.
	* gdb.threads/attach-stopped.exp: Use standard_testfile.
	* gdb.threads/bp_in_thread.exp: Use standard_testfile,
	clean_restart.  Remove incdir.
	* gdb.threads/corethreads.exp: Use standard_testfile.
	* gdb.threads/execl.exp: Use standard_testfile,
	standard_output_file, clean_restart.
	* gdb.threads/fork-child-threads.exp: Use standard_testfile,
	clean_restart.
	* gdb.threads/fork-thread-pending.exp: Use standard_testfile,
	clean_restart.
	* gdb.threads/gcore-thread.exp: Use standard_testfile.  Remove
	incdir.
	* gdb.threads/hand-call-in-threads.exp: Use standard_testfile,
	clean_restart.  Remove incdir.
	* gdb.threads/ia64-sigill.exp: Use standard_testfile.
	* gdb.threads/interrupted-hand-call.exp: Use standard_testfile,
	clean_restart.  Remove incdir.
	* gdb.threads/killed.exp: Use standard_testfile, clean_restart.
	Remove incdir.
	* gdb.threads/leader-exit.exp: Use standard_testfile.
	* gdb.threads/linux-dp.exp: Use standard_testfile, clean_restart.
	* gdb.threads/local-watch-wrong-thread.exp: Use standard_testfile,
	clean_restart.
	* gdb.threads/manythreads.exp: Use standard_testfile,
	clean_restart.  Remove incdir.
	* gdb.threads/multi-create.exp: Use standard_testfile,
	clean_restart.
	* gdb.threads/no-unwaited-for-left.exp: Use standard_testfile.
	* gdb.threads/non-ldr-exc-1.exp: Use standard_testfile.
	* gdb.threads/non-ldr-exc-2.exp: Use standard_testfile.
	* gdb.threads/non-ldr-exc-3.exp: Use standard_testfile.
	* gdb.threads/non-ldr-exc-4.exp: Use standard_testfile.
	* gdb.threads/pending-step.exp: Use standard_testfile,
	clean_restart.  Remove incdir.
	* gdb.threads/print-threads.exp: Use standard_testfile,
	clean_restart.  Remove incdir.
	* gdb.threads/pthread_cond_wait.exp: Use standard_testfile,
	clean_restart.  Remove incdir.
	* gdb.threads/pthreads.exp: Use standard_testfile, clean_restart.
	Remove incdir.
	* gdb.threads/schedlock.exp: Use standard_testfile.  Remove
	incdir.
	* gdb.threads/sigthread.exp: Use standard_testfile,
	clean_restart.
	* gdb.threads/staticthreads.exp: Use standard_testfile,
	clean_restart.  Remove incdir.
	* gdb.threads/switch-threads.exp: Use standard_testfile,
	clean_restart.  Remove incdir.
	* gdb.threads/thread-execl.exp: Use standard_testfile,
	clean_restart.  Remove incdir.
	* gdb.threads/thread-find.exp: Use standard_testfile,
	clean_restart.
	* gdb.threads/thread-specific.exp: Use standard_testfile,
	clean_restart.  Remove incdir.
	* gdb.threads/thread-unwindonsignal.exp: Use standard_testfile,
	clean_restart.  Remove incdir.
	* gdb.threads/thread_check.exp: Use standard_testfile,
	clean_restart.  Remove incdir.
	* gdb.threads/thread_events.exp: Use standard_testfile.  Remove
	incdir.
	* gdb.threads/threadapply.exp: Use standard_testfile,
	clean_restart.  Remove incdir.
	* gdb.threads/threxit-hop-specific.exp: Use standard_testfile,
	clean_restart.  Remove incdir.
	* gdb.threads/tls-nodebug.exp: Use standard_testfile,
	clean_restart.
	* gdb.threads/tls-shared.exp: Use standard_testfile,
	clean_restart, standard_output_file.
	* gdb.threads/tls-var.exp: Use standard_testfile,
	standard_output_file.
	* gdb.threads/tls.exp: Use standard_testfile, clean_restart.
	Remove incdir.
	* gdb.threads/watchthreads-reorder.exp: Use standard_testfile.
	* gdb.threads/watchthreads.exp: Use standard_testfile.  Remove
	incdir.
	* gdb.threads/watchthreads2.exp: Use standard_testfile,
	clean_restart.  Remove incdir.

Index: gdb.threads/attach-into-signal.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.threads/attach-into-signal.exp,v
retrieving revision 1.12
diff -u -r1.12 attach-into-signal.exp
--- gdb.threads/attach-into-signal.exp	21 Jun 2012 20:46:25 -0000	1.12
+++ gdb.threads/attach-into-signal.exp	26 Jun 2012 19:19:38 -0000
@@ -22,29 +22,21 @@
     continue
 }
 
-set testfile "attach-into-signal"
-set srcfile  ${testfile}.c
+standard_testfile
 set executable_nothr ${testfile}-nothr
 set executable_thr ${testfile}-thr
 
-remote_exec build "rm -f ${objdir}/${subdir}/${executable_nothr}"
-remote_exec build "rm -f ${objdir}/${subdir}/${executable_thr}"
-# For debugging this test
-#
-#log_user 1
-
 proc corefunc { threadtype executable } {
     global srcfile
     global srcdir
-    global objdir
     global subdir
     global gdb_prompt
 
     with_test_prefix "$threadtype" {
 	clean_restart ${executable}
 
-	set binfile ${objdir}/${subdir}/${executable}
-	set escapedbinfile [string_to_regexp ${objdir}/${subdir}/${executable}]
+	set binfile [standard_output_file $executable]
+	set escapedbinfile [string_to_regexp ${binfile}]
 
 	if [get_compiler_info] {
 	    return -1
@@ -183,7 +175,7 @@
 
 # build the test case also with threads
 #
-if  { [gdb_compile_pthreads "${srcdir}/${subdir}/${srcfile}" "${objdir}/${subdir}/${executable_thr}" executable {debug additional_flags=-DUSE_THREADS}] != "" } {
+if  { [gdb_compile_pthreads "${srcdir}/${subdir}/${srcfile}" [standard_output_file ${executable_thr}] executable {debug additional_flags=-DUSE_THREADS}] != "" } {
     untested "attach-into-signal.exp (threaded)"
     return -1
 }
Index: gdb.threads/attach-stopped.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.threads/attach-stopped.exp,v
retrieving revision 1.11
diff -u -r1.11 attach-stopped.exp
--- gdb.threads/attach-stopped.exp	21 Jun 2012 20:46:25 -0000	1.11
+++ gdb.threads/attach-stopped.exp	26 Jun 2012 19:19:38 -0000
@@ -23,10 +23,8 @@
     continue
 }
 
-set testfile "attach-stopped"
-set srcfile  ${testfile}.c
-set binfile  ${objdir}/${subdir}/${testfile}
-set escapedbinfile  [string_to_regexp ${objdir}/${subdir}/${testfile}]
+standard_testfile
+set escapedbinfile  [string_to_regexp $binfile]
 
 #execute_anywhere "rm -f ${binfile}"
 remote_exec build "rm -f ${binfile}"
Index: gdb.threads/bp_in_thread.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.threads/bp_in_thread.exp,v
retrieving revision 1.11
diff -u -r1.11 bp_in_thread.exp
--- gdb.threads/bp_in_thread.exp	16 Jan 2012 16:21:52 -0000	1.11
+++ gdb.threads/bp_in_thread.exp	26 Jun 2012 19:19:38 -0000
@@ -18,18 +18,14 @@
 # GDB reported a SIGTRAP signal in a random thread when hitting
 # a breakpoint.
 
-set testfile "bp_in_thread"
-set srcfile ${testfile}.c
-set binfile ${objdir}/${subdir}/${testfile}
+standard_testfile
 
-if {[gdb_compile_pthreads "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable [list debug "incdir=${objdir}"]] != "" } {
+if {[gdb_compile_pthreads "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable debug] != "" } {
     return -1
 }
 
-gdb_exit
-gdb_start
-gdb_reinitialize_dir $srcdir/$subdir
-gdb_load ${binfile}
+clean_restart $binfile
+
 runto_main
 
 gdb_test "break noreturn" \
Index: gdb.threads/corethreads.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.threads/corethreads.exp,v
retrieving revision 1.2
diff -u -r1.2 corethreads.exp
--- gdb.threads/corethreads.exp	4 Jan 2012 08:27:55 -0000	1.2
+++ gdb.threads/corethreads.exp	26 Jun 2012 19:19:38 -0000
@@ -19,10 +19,8 @@
     return
 }
 
-set testfile "corethreads"
-set srcfile ${testfile}.c
+standard_testfile
 set executable ${testfile}
-set binfile ${objdir}/${subdir}/${executable}
 if { [gdb_compile_pthreads "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } {
      untested ${testfile}.exp
      return -1
Index: gdb.threads/execl.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.threads/execl.exp,v
retrieving revision 1.9
diff -u -r1.9 execl.exp
--- gdb.threads/execl.exp	4 Jan 2012 08:27:55 -0000	1.9
+++ gdb.threads/execl.exp	26 Jun 2012 19:19:38 -0000
@@ -20,9 +20,7 @@
 }
 
 # Original image, loads a thread library.
-set testfile "execl"
-set srcfile ${testfile}.c
-set binfile ${objdir}/${subdir}/${testfile}
+standard_testfile
 
 if {[gdb_compile_pthreads "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } {
     return -1
@@ -31,16 +29,13 @@
 # New image, that does not load a thread library.
 set testfile1 "execl1"
 set srcfile1 ${testfile1}.c
-set binfile1 ${objdir}/${subdir}/${testfile1}
+set binfile1 [standard_output_file ${testfile1}]
 
 if {[gdb_compile "${srcdir}/${subdir}/${srcfile1}" "${binfile1}" executable {debug}] != "" } {
     return -1
 }
 
-gdb_exit
-gdb_start
-gdb_reinitialize_dir $srcdir/$subdir
-gdb_load ${binfile}
+clean_restart ${binfile}
 
 runto_main
 
Index: gdb.threads/fork-child-threads.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.threads/fork-child-threads.exp,v
retrieving revision 1.8
diff -u -r1.8 fork-child-threads.exp
--- gdb.threads/fork-child-threads.exp	4 Jan 2012 08:27:55 -0000	1.8
+++ gdb.threads/fork-child-threads.exp	26 Jun 2012 19:19:38 -0000
@@ -22,19 +22,14 @@
     return 0
 }
 
-set testfile fork-child-threads
-set srcfile ${testfile}.c
-set binfile ${objdir}/${subdir}/${testfile}
+standard_testfile
 
 if {[gdb_compile_pthreads "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } {
     return -1
 }
 
-gdb_exit
-gdb_start
-gdb_reinitialize_dir $srcdir/$subdir
+clean_restart ${binfile}
 
-gdb_load ${binfile}
 if ![runto_main] then {
    fail "Can't run to main"
    return 0
Index: gdb.threads/fork-thread-pending.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.threads/fork-thread-pending.exp,v
retrieving revision 1.6
diff -u -r1.6 fork-thread-pending.exp
--- gdb.threads/fork-thread-pending.exp	4 Jan 2012 08:27:55 -0000	1.6
+++ gdb.threads/fork-thread-pending.exp	26 Jun 2012 19:19:38 -0000
@@ -25,19 +25,14 @@
     return 0
 }
 
-set testfile fork-thread-pending
-set srcfile ${testfile}.c
-set binfile ${objdir}/${subdir}/${testfile}
+standard_testfile
 
 if {[gdb_compile_pthreads "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } {
     return -1
 }
 
-gdb_exit
-gdb_start
-gdb_reinitialize_dir $srcdir/$subdir
+clean_restart ${binfile}
 
-gdb_load ${binfile}
 if ![runto_main] then {
    fail "Can't run to main"
    return 0
Index: gdb.threads/gcore-thread.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.threads/gcore-thread.exp,v
retrieving revision 1.24
diff -u -r1.24 gcore-thread.exp
--- gdb.threads/gcore-thread.exp	16 Jan 2012 16:21:52 -0000	1.24
+++ gdb.threads/gcore-thread.exp	26 Jun 2012 19:19:38 -0000
@@ -17,12 +17,10 @@
 # This is a test for the gdb command "generate-core-file".
 
 # Single-threaded test case
-set testfile "gcore-thread"
-set srcfile  pthreads.c
-set objfile  ${objdir}/${subdir}/${testfile}.o
-set binfile  ${objdir}/${subdir}/${testfile}
-set corefile ${objdir}/${subdir}/${testfile}.test
-set core0file ${objdir}/${subdir}/${testfile}0.test
+standard_testfile pthreads.c
+set objfile  $binfile.o
+set corefile $binfile.test
+set core0file ${binfile}0.test
 
 if [istarget "*-*-linux"] then {
     set target_cflags "-D_MIT_POSIX_THREADS"
@@ -35,7 +33,7 @@
 # libpthread, therefore libthread_db will not fail as expected
 # on the test `zeroed-threads cannot be listed'.
 
-set opts [list debug "incdir=${objdir}"]
+set opts [list debug]
 if {[gdb_compile_pthreads "${srcdir}/${subdir}/${srcfile}" "${objfile}" object $opts] != ""
     || ([gdb_compile_pthreads "${objfile}" "${binfile}" executable [concat $opts {additional_flags=-Wl,-z,norelro}] ] != ""
         && [gdb_compile_pthreads "${objfile}" "${binfile}" executable $opts] != "") } {
Index: gdb.threads/hand-call-in-threads.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.threads/hand-call-in-threads.exp,v
retrieving revision 1.8
diff -u -r1.8 hand-call-in-threads.exp
--- gdb.threads/hand-call-in-threads.exp	16 Jan 2012 16:21:52 -0000	1.8
+++ gdb.threads/hand-call-in-threads.exp	26 Jun 2012 19:19:38 -0000
@@ -18,11 +18,9 @@
 
 set NR_THREADS 4
 
-set testfile "hand-call-in-threads"
-set srcfile ${testfile}.c
-set binfile ${objdir}/${subdir}/${testfile}
+standard_testfile
 
-if {[gdb_compile_pthreads "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable [list debug "incdir=${objdir}" "additional_flags=-DNR_THREADS=$NR_THREADS"]] != "" } {
+if {[gdb_compile_pthreads "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable [list debug "additional_flags=-DNR_THREADS=$NR_THREADS"]] != "" } {
     return -1
 }
 
@@ -51,10 +49,7 @@
     return ""
 }
 
-gdb_exit
-gdb_start
-gdb_reinitialize_dir $srcdir/$subdir
-gdb_load ${binfile}
+clean_restart ${binfile}
 
 if { ![runto_main] } {
     fail "Can't run to main"
Index: gdb.threads/ia64-sigill.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.threads/ia64-sigill.exp,v
retrieving revision 1.4
diff -u -r1.4 ia64-sigill.exp
--- gdb.threads/ia64-sigill.exp	4 Jan 2012 08:27:55 -0000	1.4
+++ gdb.threads/ia64-sigill.exp	26 Jun 2012 19:19:38 -0000
@@ -20,9 +20,7 @@
 # breakpoint has been already deleted.  moribund locations are not active in
 # the default all-stop mode.
 
-set testfile "ia64-sigill"
-set srcfile ${testfile}.c
-set binfile ${objdir}/${subdir}/${testfile}
+standard_testfile
 if {[gdb_compile_pthreads "${srcdir}/${subdir}/${srcfile}" ${binfile} executable [list debug additional_flags=-lrt]] != "" } {
     return -1
 }
Index: gdb.threads/interrupted-hand-call.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.threads/interrupted-hand-call.exp,v
retrieving revision 1.8
diff -u -r1.8 interrupted-hand-call.exp
--- gdb.threads/interrupted-hand-call.exp	16 Jan 2012 16:21:52 -0000	1.8
+++ gdb.threads/interrupted-hand-call.exp	26 Jun 2012 19:19:38 -0000
@@ -19,11 +19,9 @@
 
 set NR_THREADS 4
 
-set testfile "interrupted-hand-call"
-set srcfile ${testfile}.c
-set binfile ${objdir}/${subdir}/${testfile}
+standard_testfile
 
-if {[gdb_compile_pthreads "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable [list debug "incdir=${objdir}" "additional_flags=-DNR_THREADS=$NR_THREADS"]] != "" } {
+if {[gdb_compile_pthreads "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable [list debug "additional_flags=-DNR_THREADS=$NR_THREADS"]] != "" } {
     return -1
 }
 
@@ -35,10 +33,7 @@
     continue
 }
 
-gdb_exit
-gdb_start
-gdb_reinitialize_dir $srcdir/$subdir
-gdb_load ${binfile}
+clean_restart ${binfile}
 
 if { ![runto_main] } {
     fail "Can't run to main"
Index: gdb.threads/killed.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.threads/killed.exp,v
retrieving revision 1.18
diff -u -r1.18 killed.exp
--- gdb.threads/killed.exp	16 Jan 2012 16:21:52 -0000	1.18
+++ gdb.threads/killed.exp	26 Jun 2012 19:19:38 -0000
@@ -55,18 +55,14 @@
 # $ 
 
 
-set testfile "killed"
-set srcfile ${testfile}.c
-set binfile ${objdir}/${subdir}/${testfile}
+standard_testfile
 
-if {[gdb_compile_pthreads "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable [list debug "incdir=${objdir}"]] != "" } {
+if {[gdb_compile_pthreads "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable debug] != "" } {
     return -1
 }
 
 
-gdb_start
-gdb_reinitialize_dir $srcdir/$subdir
-gdb_load ${binfile}
+clean_restart ${binfile}
 
 gdb_run_cmd
 gdb_expect {
Index: gdb.threads/leader-exit.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.threads/leader-exit.exp,v
retrieving revision 1.2
diff -u -r1.2 leader-exit.exp
--- gdb.threads/leader-exit.exp	4 Jan 2012 08:27:55 -0000	1.2
+++ gdb.threads/leader-exit.exp	26 Jun 2012 19:19:38 -0000
@@ -15,10 +15,8 @@
 
 # Exit of the thread group leader should not break GDB.
 
-set testfile "leader-exit"
-set srcfile ${testfile}.c
+standard_testfile
 set executable ${testfile}
-set binfile ${objdir}/${subdir}/${executable}
 
 if {[gdb_compile_pthreads "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } {
     return -1
Index: gdb.threads/linux-dp.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.threads/linux-dp.exp,v
retrieving revision 1.31
diff -u -r1.31 linux-dp.exp
--- gdb.threads/linux-dp.exp	25 Apr 2012 13:54:00 -0000	1.31
+++ gdb.threads/linux-dp.exp	26 Jun 2012 19:19:38 -0000
@@ -39,16 +39,12 @@
     return
 }
 
-set testfile "linux-dp"
-set srcfile ${testfile}.c
-set binfile ${objdir}/${subdir}/${testfile}
+standard_testfile
 if {[gdb_compile_pthreads "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != ""} {
     return -1
 }
 
-gdb_start
-gdb_reinitialize_dir $srcdir/$subdir
-gdb_load ${binfile}
+clean_restart ${binfile}
 gdb_test_no_output "set print sevenbit-strings"
 runto_main
 
Index: gdb.threads/local-watch-wrong-thread.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.threads/local-watch-wrong-thread.exp,v
retrieving revision 1.7
diff -u -r1.7 local-watch-wrong-thread.exp
--- gdb.threads/local-watch-wrong-thread.exp	4 Jan 2012 08:27:55 -0000	1.7
+++ gdb.threads/local-watch-wrong-thread.exp	26 Jun 2012 19:19:38 -0000
@@ -23,19 +23,14 @@
     return 0
 }
 
-set testfile "local-watch-wrong-thread"
-set srcfile ${testfile}.c
-set binfile ${objdir}/${subdir}/${testfile}
+standard_testfile
 if {[gdb_compile_pthreads \
 	 "${srcdir}/${subdir}/${srcfile}" \
 	 "${binfile}" executable {debug} ] != "" } {
     return -1
 }
 
-gdb_exit
-gdb_start
-gdb_reinitialize_dir $srcdir/$subdir
-gdb_load ${binfile}
+clean_restart ${binfile}
 
 gdb_test_no_output "set can-use-hw-watchpoints 1" ""
 
Index: gdb.threads/manythreads.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.threads/manythreads.exp,v
retrieving revision 1.24
diff -u -r1.24 manythreads.exp
--- gdb.threads/manythreads.exp	16 Jan 2012 16:21:53 -0000	1.24
+++ gdb.threads/manythreads.exp	26 Jun 2012 19:19:38 -0000
@@ -17,17 +17,13 @@
 # This file was written by Jeff Johnston. (jjohnstn@redhat.com)
 
 
-set testfile "manythreads"
-set srcfile ${testfile}.c
-set binfile ${objdir}/${subdir}/${testfile}
+standard_testfile
 
-if {[gdb_compile_pthreads "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable [list debug "incdir=${objdir}"]] != "" } {
+if {[gdb_compile_pthreads "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable debug] != "" } {
     return -1
 }
 
-gdb_start
-gdb_reinitialize_dir $srcdir/$subdir
-gdb_load ${binfile}
+clean_restart ${binfile}
 gdb_test_no_output "set print sevenbit-strings"
 runto_main
 
Index: gdb.threads/multi-create.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.threads/multi-create.exp,v
retrieving revision 1.6
diff -u -r1.6 multi-create.exp
--- gdb.threads/multi-create.exp	4 Jan 2012 08:27:55 -0000	1.6
+++ gdb.threads/multi-create.exp	26 Jun 2012 19:19:38 -0000
@@ -14,18 +14,14 @@
 # You should have received a copy of the GNU General Public License
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
-set testfile "multi-create"
-set srcfile ${testfile}.c
-set binfile ${objdir}/${subdir}/${testfile}
+standard_testfile
 
 if {[gdb_compile_pthreads "${srcdir}/${subdir}/${srcfile}" "${binfile}" \
 	 executable {debug}] != "" } {
     return -1
 }
 
-gdb_start
-gdb_reinitialize_dir $srcdir/$subdir
-gdb_load ${binfile}
+clean_restart ${binfile}
 runto_main
 
 # Run to the beginning of create_function several times.  Make sure
Index: gdb.threads/no-unwaited-for-left.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.threads/no-unwaited-for-left.exp,v
retrieving revision 1.3
diff -u -r1.3 no-unwaited-for-left.exp
--- gdb.threads/no-unwaited-for-left.exp	4 Jan 2012 08:27:55 -0000	1.3
+++ gdb.threads/no-unwaited-for-left.exp	26 Jun 2012 19:19:38 -0000
@@ -16,10 +16,8 @@
 # Exit of a thread when there are other threads in the inferior should
 # not hang GDB.
 
-set testfile "no-unwaited-for-left"
-set srcfile ${testfile}.c
+standard_testfile
 set executable ${testfile}
-set binfile ${objdir}/${subdir}/${executable}
 
 if {[gdb_compile_pthreads "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } {
     return -1
Index: gdb.threads/non-ldr-exc-1.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.threads/non-ldr-exc-1.exp,v
retrieving revision 1.4
diff -u -r1.4 non-ldr-exc-1.exp
--- gdb.threads/non-ldr-exc-1.exp	21 Feb 2012 22:01:09 -0000	1.4
+++ gdb.threads/non-ldr-exc-1.exp	26 Jun 2012 19:19:38 -0000
@@ -21,10 +21,8 @@
     continue
 }
 
-set testfile "non-ldr-exc-1"
-set srcfile ${testfile}.c
+standard_testfile
 set executable ${testfile}
-set binfile ${objdir}/${subdir}/${executable}
 
 if {[gdb_compile_pthreads "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } {
     return -1
Index: gdb.threads/non-ldr-exc-2.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.threads/non-ldr-exc-2.exp,v
retrieving revision 1.4
diff -u -r1.4 non-ldr-exc-2.exp
--- gdb.threads/non-ldr-exc-2.exp	21 Feb 2012 22:01:09 -0000	1.4
+++ gdb.threads/non-ldr-exc-2.exp	26 Jun 2012 19:19:38 -0000
@@ -22,10 +22,8 @@
     continue
 }
 
-set testfile "non-ldr-exc-2"
-set srcfile ${testfile}.c
+standard_testfile
 set executable ${testfile}
-set binfile ${objdir}/${subdir}/${executable}
 
 if {[gdb_compile_pthreads "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } {
     return -1
Index: gdb.threads/non-ldr-exc-3.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.threads/non-ldr-exc-3.exp,v
retrieving revision 1.4
diff -u -r1.4 non-ldr-exc-3.exp
--- gdb.threads/non-ldr-exc-3.exp	21 Feb 2012 22:01:09 -0000	1.4
+++ gdb.threads/non-ldr-exc-3.exp	26 Jun 2012 19:19:38 -0000
@@ -24,10 +24,8 @@
     continue
 }
 
-set testfile "non-ldr-exc-3"
-set srcfile ${testfile}.c
+standard_testfile
 set executable ${testfile}
-set binfile ${objdir}/${subdir}/${executable}
 
 if {[gdb_compile_pthreads "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } {
     return -1
Index: gdb.threads/non-ldr-exc-4.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.threads/non-ldr-exc-4.exp,v
retrieving revision 1.4
diff -u -r1.4 non-ldr-exc-4.exp
--- gdb.threads/non-ldr-exc-4.exp	21 Feb 2012 22:01:09 -0000	1.4
+++ gdb.threads/non-ldr-exc-4.exp	26 Jun 2012 19:19:38 -0000
@@ -23,10 +23,8 @@
     continue
 }
 
-set testfile "non-ldr-exc-4"
-set srcfile ${testfile}.c
+standard_testfile
 set executable ${testfile}
-set binfile ${objdir}/${subdir}/${executable}
 
 if {[gdb_compile_pthreads "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } {
     return -1
Index: gdb.threads/pending-step.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.threads/pending-step.exp,v
retrieving revision 1.5
diff -u -r1.5 pending-step.exp
--- gdb.threads/pending-step.exp	4 Jan 2012 08:27:55 -0000	1.5
+++ gdb.threads/pending-step.exp	26 Jun 2012 19:19:38 -0000
@@ -48,20 +48,13 @@
 #    continued in step 5).  Neither does this SIGTRAP correspond to a
 #    breakpoint hit.  GDB reports to the user a spurious SIGTRAP.
 
-set testfile "pending-step"
-set srcfile ${testfile}.c
-set binfile ${objdir}/${subdir}/${testfile}
+standard_testfile
 
-if {[gdb_compile_pthreads "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable [list debug "incdir=${objdir}"]] != "" } {
+if {[gdb_compile_pthreads "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable debug] != "" } {
     return -1
 }
 
-# Start with a fresh gdb.
-
-gdb_exit
-gdb_start
-gdb_reinitialize_dir $srcdir/$subdir
-gdb_load ${binfile}
+clean_restart ${binfile}
 
 if ![runto_main] then {
     fail "Can't run to main"
Index: gdb.threads/print-threads.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.threads/print-threads.exp,v
retrieving revision 1.22
diff -u -r1.22 print-threads.exp
--- gdb.threads/print-threads.exp	16 Jan 2012 16:21:53 -0000	1.22
+++ gdb.threads/print-threads.exp	26 Jun 2012 19:19:38 -0000
@@ -21,26 +21,19 @@
 # handling for thread exit.
 
 
-set testfile "print-threads"
-set srcfile ${testfile}.c
-set binfile ${objdir}/${subdir}/${testfile}
+standard_testfile
 
 # regexp for "horizontal" text (i.e. doesn't include newline or
 # carriage return)
 set horiz "\[^\n\r\]*"
 
-if {[gdb_compile_pthreads "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable [list debug "incdir=${objdir}"]] != "" } {
+if {[gdb_compile_pthreads "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable debug] != "" } {
     return -1
 }
 
 # Now we can proceed with the real testing.
 
-# Start with a fresh gdb.
-
-gdb_exit
-gdb_start
-gdb_reinitialize_dir $srcdir/$subdir
-gdb_load ${binfile}
+clean_restart ${binfile}
 
 gdb_test_no_output "set print sevenbit-strings"
 #gdb_test_no_output "set print address off"
Index: gdb.threads/pthread_cond_wait.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.threads/pthread_cond_wait.exp,v
retrieving revision 1.10
diff -u -r1.10 pthread_cond_wait.exp
--- gdb.threads/pthread_cond_wait.exp	16 Jan 2012 16:21:53 -0000	1.10
+++ gdb.threads/pthread_cond_wait.exp	26 Jun 2012 19:19:38 -0000
@@ -19,18 +19,13 @@
 # This file verifies that GDB is able to compute a backtrace for a thread
 # being blocked on a call to pthread_cond_wait(). 
 
-set testfile "pthread_cond_wait"
-set srcfile ${testfile}.c
-set binfile ${objdir}/${subdir}/${testfile}
+standard_testfile
 
-if {[gdb_compile_pthreads "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable [list debug "incdir=${objdir}"]] != "" } {
+if {[gdb_compile_pthreads "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable debug] != "" } {
     return -1
 }
 
-gdb_exit
-gdb_start
-gdb_reinitialize_dir $srcdir/$subdir
-gdb_load ${binfile}
+clean_restart ${binfile}
 runto_main
 
 gdb_test "break break_me" \
Index: gdb.threads/pthreads.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.threads/pthreads.exp,v
retrieving revision 1.27
diff -u -r1.27 pthreads.exp
--- gdb.threads/pthreads.exp	16 Jan 2012 16:21:53 -0000	1.27
+++ gdb.threads/pthreads.exp	26 Jun 2012 19:19:38 -0000
@@ -17,9 +17,7 @@
 # This file was written by Fred Fish. (fnf@cygnus.com)
 
 
-set testfile "pthreads"
-set srcfile ${testfile}.c
-set binfile ${objdir}/${subdir}/${testfile}
+standard_testfile
 
 # regexp for "horizontal" text (i.e. doesn't include newline or
 # carriage return)
@@ -31,17 +29,11 @@
     set target_cflags ""
 }
 
-if {[gdb_compile_pthreads "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable [list debug "incdir=${objdir}"]] != "" } {
+if {[gdb_compile_pthreads "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable debug] != "" } {
     return -1
 }
 
-
-# Start with a fresh gdb.
-
-gdb_exit
-gdb_start
-gdb_reinitialize_dir $srcdir/$subdir
-gdb_load ${binfile}
+clean_restart ${binfile}
 
 gdb_test_no_output "set print sevenbit-strings"
 #gdb_test_no_output "set print address off"
Index: gdb.threads/schedlock.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.threads/schedlock.exp,v
retrieving revision 1.19
diff -u -r1.19 schedlock.exp
--- gdb.threads/schedlock.exp	16 Jan 2012 16:21:53 -0000	1.19
+++ gdb.threads/schedlock.exp	26 Jun 2012 19:19:38 -0000
@@ -20,14 +20,12 @@
 # This test covers the various forms of "set scheduler-locking".
 
 
-set testfile "schedlock"
-set srcfile ${testfile}.c
-set binfile ${objdir}/${subdir}/${testfile}
+standard_testfile
 
 # The number of threads, including the main thread.
 set NUM 2
 
-if {[gdb_compile_pthreads "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable [list debug "incdir=${objdir}"]] != "" } {
+if {[gdb_compile_pthreads "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable debug] != "" } {
     return -1
 }
 
Index: gdb.threads/sigthread.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.threads/sigthread.exp,v
retrieving revision 1.8
diff -u -r1.8 sigthread.exp
--- gdb.threads/sigthread.exp	4 Jan 2012 08:27:55 -0000	1.8
+++ gdb.threads/sigthread.exp	26 Jun 2012 19:19:38 -0000
@@ -14,19 +14,14 @@
 # You should have received a copy of the GNU General Public License
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
-set testfile sigthread
-set srcfile ${testfile}.c
-set binfile ${objdir}/${subdir}/${testfile}
+standard_testfile
 
 if {[gdb_compile_pthreads "${srcdir}/${subdir}/${srcfile}" "${binfile}" \
 	 executable { debug }] != "" } {
     return -1
 }
 
-gdb_exit
-gdb_start
-gdb_reinitialize_dir $srcdir/$subdir
-gdb_load ${binfile}
+clean_restart ${binfile}
 
 if ![runto_main] then {
    fail "Can't run to main"
Index: gdb.threads/staticthreads.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.threads/staticthreads.exp,v
retrieving revision 1.15
diff -u -r1.15 staticthreads.exp
--- gdb.threads/staticthreads.exp	16 Jan 2012 16:21:53 -0000	1.15
+++ gdb.threads/staticthreads.exp	26 Jun 2012 19:19:38 -0000
@@ -19,21 +19,17 @@
 # Hat.
 
 
-set testfile "staticthreads"
-set srcfile ${testfile}.c
-set binfile ${objdir}/${subdir}/${testfile}
+standard_testfile
 set static_flag "-static"
 
 if {[gdb_compile_pthreads "${srcdir}/${subdir}/${srcfile}" "${binfile}" \
 	 executable \
-	 [list debug "incdir=${objdir}" "additional_flags=${static_flag}" \
+	 [list debug "additional_flags=${static_flag}" \
 	     ]] != "" } {
     return -1
 }
 
-gdb_start
-gdb_reinitialize_dir $srcdir/$subdir
-gdb_load ${binfile}
+clean_restart ${binfile}
 gdb_test_no_output "set print sevenbit-strings"
 
 
Index: gdb.threads/switch-threads.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.threads/switch-threads.exp,v
retrieving revision 1.10
diff -u -r1.10 switch-threads.exp
--- gdb.threads/switch-threads.exp	16 Jan 2012 16:21:53 -0000	1.10
+++ gdb.threads/switch-threads.exp	26 Jun 2012 19:19:38 -0000
@@ -23,18 +23,13 @@
 # TODO: we should also test explicitly changing threads with the "thread"
 # command.
 
-set testfile "switch-threads"
-set srcfile ${testfile}.c
-set binfile ${objdir}/${subdir}/${testfile}
+standard_testfile
 
-if {[gdb_compile_pthreads "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable [list debug "incdir=${objdir}"]] != "" } {
+if {[gdb_compile_pthreads "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable debug] != "" } {
     return -1
 }
 
-gdb_exit
-gdb_start
-gdb_reinitialize_dir $srcdir/$subdir
-gdb_load ${binfile}
+clean_restart ${binfile}
 
 runto_main
 
Index: gdb.threads/thread-execl.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.threads/thread-execl.exp,v
retrieving revision 1.4
diff -u -r1.4 thread-execl.exp
--- gdb.threads/thread-execl.exp	4 Jan 2012 08:27:55 -0000	1.4
+++ gdb.threads/thread-execl.exp	26 Jun 2012 19:19:38 -0000
@@ -21,21 +21,14 @@
     return 0
 }
 
-set testfile "thread-execl"
-set srcfile ${testfile}.c
-set binfile ${objdir}/${subdir}/${testfile}
+standard_testfile
 
 if {[gdb_compile_pthreads "${srcdir}/${subdir}/${srcfile}" "${binfile}" \
-	 executable [list debug "incdir=${objdir}"]] != "" } {
+	 executable debug] != "" } {
     return -1
 }
 
-# Start with a fresh gdb.
-
-gdb_exit
-gdb_start
-gdb_reinitialize_dir $srcdir/$subdir
-gdb_load ${binfile}
+clean_restart ${binfile}
 
 runto_main
 
Index: gdb.threads/thread-find.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.threads/thread-find.exp,v
retrieving revision 1.7
diff -u -r1.7 thread-find.exp
--- gdb.threads/thread-find.exp	16 Jan 2012 16:21:53 -0000	1.7
+++ gdb.threads/thread-find.exp	26 Jun 2012 19:19:38 -0000
@@ -16,16 +16,12 @@
 # Please email any bugs, comments, and/or additions to this file to:
 # bug-gdb@gnu.org
 
-set testfile "linux-dp"
-set srcfile ${testfile}.c
-set binfile ${objdir}/${subdir}/${testfile}
+standard_testfile linux-dp.c
 if {[gdb_compile_pthreads "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != ""} {
     return -1
 }
 
-gdb_start
-gdb_reinitialize_dir $srcdir/$subdir
-gdb_load ${binfile}
+clean_restart ${binfile}
 gdb_test_no_output "set print sevenbit-strings"
 runto_main
 
Index: gdb.threads/thread-specific.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.threads/thread-specific.exp,v
retrieving revision 1.17
diff -u -r1.17 thread-specific.exp
--- gdb.threads/thread-specific.exp	16 Jan 2012 16:21:53 -0000	1.17
+++ gdb.threads/thread-specific.exp	26 Jun 2012 19:19:38 -0000
@@ -18,11 +18,9 @@
 # thread-specific breakpoint inserted for several threads.
 
 
-set testfile "thread-specific"
-set srcfile ${testfile}.c
-set binfile ${objdir}/${subdir}/${testfile}
+standard_testfile
 
-if {[gdb_compile_pthreads "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable [list debug "incdir=${objdir}"]] != "" } {
+if {[gdb_compile_pthreads "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable debug] != "" } {
     return -1
 }
 
@@ -63,13 +61,7 @@
   return $thr_list
 }
 
-# Start with a fresh gdb.
-
-gdb_exit
-gdb_start
-gdb_reinitialize_dir $srcdir/$subdir
-
-gdb_load ${binfile}
+clean_restart ${binfile}
 
 gdb_test_no_output "set print sevenbit-strings"
 gdb_test_no_output "set width 0"
Index: gdb.threads/thread-unwindonsignal.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.threads/thread-unwindonsignal.exp,v
retrieving revision 1.9
diff -u -r1.9 thread-unwindonsignal.exp
--- gdb.threads/thread-unwindonsignal.exp	16 Jan 2012 16:21:53 -0000	1.9
+++ gdb.threads/thread-unwindonsignal.exp	26 Jun 2012 19:19:38 -0000
@@ -18,11 +18,9 @@
 
 set NR_THREADS 4
 
-set testfile "interrupted-hand-call"
-set srcfile ${testfile}.c
-set binfile ${objdir}/${subdir}/${testfile}
+standard_testfile interrupted-hand-call.c
 
-if {[gdb_compile_pthreads "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable [list debug "incdir=${objdir}" "additional_flags=-DNR_THREADS=$NR_THREADS"]] != "" } {
+if {[gdb_compile_pthreads "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable [list debug "additional_flags=-DNR_THREADS=$NR_THREADS"]] != "" } {
     return -1
 }
 
@@ -34,10 +32,7 @@
     continue
 }
 
-gdb_exit
-gdb_start
-gdb_reinitialize_dir $srcdir/$subdir
-gdb_load ${binfile}
+clean_restart ${binfile}
 
 if { ![runto_main] } {
     fail "Can't run to main"
Index: gdb.threads/thread_check.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.threads/thread_check.exp,v
retrieving revision 1.12
diff -u -r1.12 thread_check.exp
--- gdb.threads/thread_check.exp	16 Jan 2012 16:21:53 -0000	1.12
+++ gdb.threads/thread_check.exp	26 Jun 2012 19:19:38 -0000
@@ -32,18 +32,14 @@
 # - exit gdb.
 
 
-set testfile "thread_check"
-set srcfile ${testfile}.c
-set binfile ${objdir}/${subdir}/${testfile}
+standard_testfile
 
-if {[gdb_compile_pthreads "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable [list debug "incdir=${objdir}"]] != "" } {
+if {[gdb_compile_pthreads "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable debug] != "" } {
     return -1
 }
 
 
-gdb_start
-gdb_reinitialize_dir $srcdir/$subdir
-gdb_load ${binfile}
+clean_restart ${binfile}
 
 if ![runto_main] then {
    fail "Can't run to main"
Index: gdb.threads/thread_events.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.threads/thread_events.exp,v
retrieving revision 1.8
diff -u -r1.8 thread_events.exp
--- gdb.threads/thread_events.exp	16 Jan 2012 16:21:53 -0000	1.8
+++ gdb.threads/thread_events.exp	26 Jun 2012 19:19:38 -0000
@@ -34,11 +34,9 @@
 }
 
 
-set testfile "thread_events"
-set srcfile ${testfile}.c
-set binfile ${objdir}/${subdir}/${testfile}
+standard_testfile
 
-if {[gdb_compile_pthreads "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable [list debug "incdir=${objdir}"]] != "" } {
+if {[gdb_compile_pthreads "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable debug] != "" } {
     return -1
 }
 
Index: gdb.threads/threadapply.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.threads/threadapply.exp,v
retrieving revision 1.14
diff -u -r1.14 threadapply.exp
--- gdb.threads/threadapply.exp	16 Jan 2012 16:21:53 -0000	1.14
+++ gdb.threads/threadapply.exp	26 Jun 2012 19:19:38 -0000
@@ -20,17 +20,12 @@
 # and will continue for each thread even though an error may occur in
 # backtracing one of the threads.
 
-set testfile "threadapply"
-set srcfile ${testfile}.c
-set binfile ${objdir}/${subdir}/${testfile}
-if {[gdb_compile_pthreads "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable [list debug "incdir=${objdir}"]] != "" } {
+standard_testfile
+if {[gdb_compile_pthreads "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable debug] != "" } {
     return -1
 }
 
-gdb_exit
-gdb_start
-gdb_reinitialize_dir $srcdir/$subdir
-gdb_load ${binfile}
+clean_restart ${binfile}
 
 #
 # Run to `main' where we begin our tests.
Index: gdb.threads/threxit-hop-specific.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.threads/threxit-hop-specific.exp,v
retrieving revision 1.5
diff -u -r1.5 threxit-hop-specific.exp
--- gdb.threads/threxit-hop-specific.exp	4 Jan 2012 08:27:55 -0000	1.5
+++ gdb.threads/threxit-hop-specific.exp	26 Jun 2012 19:19:38 -0000
@@ -16,22 +16,14 @@
 # Test that GDB doesn't get stuck when thread hoping over a thread
 # specific breakpoint when the selected thread has gone away.
 
-set testfile "threxit-hop-specific"
-set srcfile ${testfile}.c
-set binfile ${objdir}/${subdir}/${testfile}
+standard_testfile
 
 if {[gdb_compile_pthreads "${srcdir}/${subdir}/${srcfile}" "${binfile}" \
-	 executable [list debug "incdir=${objdir}"]] != "" } {
+	 executable debug] != "" } {
     return -1
 }
 
-# Start with a fresh gdb.
-
-gdb_exit
-gdb_start
-gdb_reinitialize_dir $srcdir/$subdir
-
-gdb_load ${binfile}
+clean_restart ${binfile}
 
 runto_main
 
Index: gdb.threads/tls-nodebug.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.threads/tls-nodebug.exp,v
retrieving revision 1.9
diff -u -r1.9 tls-nodebug.exp
--- gdb.threads/tls-nodebug.exp	4 Jan 2012 08:27:55 -0000	1.9
+++ gdb.threads/tls-nodebug.exp	26 Jun 2012 19:19:38 -0000
@@ -14,9 +14,7 @@
 # You should have received a copy of the GNU General Public License
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
-set testfile tls-nodebug
-set srcfile ${testfile}.c
-set binfile ${objdir}/${subdir}/${testfile}
+standard_testfile
 
 if [istarget "*-*-linux"] then {
     set target_cflags "-D_MIT_POSIX_THREADS"
@@ -28,11 +26,7 @@
     return -1
 }
 
-gdb_exit
-gdb_start
-gdb_reinitialize_dir $srcdir/$subdir
-
-gdb_load ${binfile}
+clean_restart ${binfile}
 if ![runto_main] then {
    fail "Can't run to main"
    return 0
Index: gdb.threads/tls-shared.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.threads/tls-shared.exp,v
retrieving revision 1.14
diff -u -r1.14 tls-shared.exp
--- gdb.threads/tls-shared.exp	21 Jun 2012 20:46:25 -0000	1.14
+++ gdb.threads/tls-shared.exp	26 Jun 2012 19:19:38 -0000
@@ -16,12 +16,10 @@
 # tls-shared.exp -- Expect script to test thread local storage in gdb, with
 # shared libraries.
 
-set testfile tls-main
+standard_testfile tls-main.c
 set libfile tls-shared
-set srcfile ${testfile}.c
-set binfile ${objdir}/${subdir}/${testfile}
 set srcfile_lib ${libfile}.c
-set binfile_lib ${objdir}/${subdir}/${libfile}.so
+set binfile_lib [standard_output_file ${libfile}.so]
 
 remote_exec build "rm -f ${binfile}"
 
@@ -37,10 +35,7 @@
 }
 
 
-gdb_exit
-gdb_start
-gdb_reinitialize_dir $srcdir/$subdir
-gdb_load ${binfile}
+clean_restart ${binfile}
 gdb_load_shlibs ${binfile_lib}
 
 if ![runto_main] then {
@@ -53,7 +48,7 @@
 gdb_test "ptype i_tls" "int" "ptype of thread local storage variable"
 
 gdb_test "info address i_tls" \
-	"Symbol \\\"i_tls\\\" is a thread-local variable at offset 0x0 in the thread-local storage for .*tls-main.." \
+	"Symbol \\\"i_tls\\\" is a thread-local variable at offset 0x0 in the thread-local storage for .*tls-shared.." \
 	"print storage info for thread local storage variable"
 
 set line_number [gdb_get_line_number "break here to check result"]
Index: gdb.threads/tls-var.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.threads/tls-var.exp,v
retrieving revision 1.2
diff -u -r1.2 tls-var.exp
--- gdb.threads/tls-var.exp	4 Jan 2012 08:27:55 -0000	1.2
+++ gdb.threads/tls-var.exp	26 Jun 2012 19:19:38 -0000
@@ -13,13 +13,11 @@
 # You should have received a copy of the GNU General Public License
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
-set testfile tls-var
-set srcfile ${testfile}.c
+standard_testfile
 set srcmainfile ${testfile}-main.c
-set objfile ${objdir}/${subdir}/${testfile}.o
-set objmainfile ${objdir}/${subdir}/${testfile}-main.o
+set objfile [standard_output_file ${testfile}.o]
+set objmainfile [standard_output_file ${testfile}-main.o]
 set executable ${testfile}
-set binfile ${objdir}/${subdir}/${executable}
 
 if { [gdb_compile ${srcdir}/${subdir}/${srcfile} ${objfile} object {debug}] != ""
      || [gdb_compile ${srcdir}/${subdir}/${srcmainfile} ${objmainfile} object {}] != ""
Index: gdb.threads/tls.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.threads/tls.exp,v
retrieving revision 1.20
diff -u -r1.20 tls.exp
--- gdb.threads/tls.exp	4 Jan 2012 08:27:55 -0000	1.20
+++ gdb.threads/tls.exp	26 Jun 2012 19:19:38 -0000
@@ -14,11 +14,7 @@
 # You should have received a copy of the GNU General Public License
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
-set testfile tls
-set testfile2 tls2
-set srcfile ${testfile}.c
-set srcfile2 ${testfile2}.c
-set binfile ${objdir}/${subdir}/${testfile}
+standard_testfile tls.c tls2.c
 
 if [istarget "*-*-linux"] then {
     set target_cflags "-D_MIT_POSIX_THREADS"
@@ -26,7 +22,7 @@
     set target_cflags ""
 }
 
-if {[gdb_compile_pthreads "${srcdir}/${subdir}/${srcfile} ${srcdir}/${subdir}/${srcfile2}" "${binfile}" executable [list c++ debug "incdir=${objdir}"]] != "" } {
+if {[gdb_compile_pthreads "${srcdir}/${subdir}/${srcfile} ${srcdir}/${subdir}/${srcfile2}" "${binfile}" executable [list c++ debug]] != "" } {
     return -1
 }
 
@@ -142,11 +138,7 @@
     }
 }
 
-gdb_exit
-gdb_start
-gdb_reinitialize_dir $srcdir/$subdir
-
-gdb_load ${binfile}
+clean_restart ${binfile}
 if ![runto_main] then {
    fail "Can't run to main"
    return 0
Index: gdb.threads/watchpoint-fork.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.threads/watchpoint-fork.exp,v
retrieving revision 1.4
diff -u -r1.4 watchpoint-fork.exp
--- gdb.threads/watchpoint-fork.exp	22 Feb 2012 00:07:43 -0000	1.4
+++ gdb.threads/watchpoint-fork.exp	26 Jun 2012 19:19:38 -0000
@@ -23,7 +23,7 @@
 }
 
 proc test {type symbol} { with_test_prefix "$type" {
-    global testfile objdir subdir srcdir gdb_prompt
+    global testfile subdir srcdir gdb_prompt
 
     set srcfile_type ${srcdir}/${subdir}/${testfile}-${type}.c
 
@@ -31,11 +31,13 @@
 
     with_test_prefix "singlethreaded" {
 	set executable ${testfile}-${type}-st
-	set srcfile_main ${srcdir}/${subdir}/${testfile}-st.c
-	if { [gdb_compile "${srcfile_main} ${srcfile_type}" ${objdir}/${subdir}/${executable} executable [list debug additional_flags=-D$symbol]] != "" } {
-	    untested ${testfile}.exp
-	    return
+	set srcfile_main ${testfile}-st.c
+	if {[build_executable $testfile.exp $executable \
+		 [list $srcfile_main ${testfile}-${type}.c] \
+		 [list debug additional_flags=-D$symbol]] == -1} {
+	    return -1
 	}
+
 	clean_restart $executable
 
 	if [target_info exists gdb,no_hardware_watchpoints] {
@@ -90,7 +92,7 @@
     with_test_prefix "multithreaded" {
 	set executable ${testfile}-${type}-mt
 	set srcfile_main ${srcdir}/${subdir}/${testfile}-mt.c
-	if { [gdb_compile_pthreads "${srcfile_main} ${srcfile_type}" ${objdir}/${subdir}/${executable} executable [list debug "additional_flags=-D$symbol -DTHREAD"]] != "" } {
+	if { [gdb_compile_pthreads "${srcfile_main} ${srcfile_type}" [standard_output_file ${executable}] executable [list debug "additional_flags=-D$symbol -DTHREAD"]] != "" } {
 	    untested ${testfile}.exp
 	    return
 	}
Index: gdb.threads/watchthreads-reorder.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.threads/watchthreads-reorder.exp,v
retrieving revision 1.8
diff -u -r1.8 watchthreads-reorder.exp
--- gdb.threads/watchthreads-reorder.exp	21 Feb 2012 22:01:09 -0000	1.8
+++ gdb.threads/watchthreads-reorder.exp	26 Jun 2012 19:19:38 -0000
@@ -31,9 +31,7 @@
     return 0
 }
 
-set testfile "watchthreads-reorder"
-set srcfile ${testfile}.c
-set binfile ${objdir}/${subdir}/${testfile}
+standard_testfile
 if {[gdb_compile_pthreads "${srcdir}/${subdir}/${srcfile}" ${binfile} executable [list debug additional_flags=-lrt]] != "" } {
     return -1
 }
Index: gdb.threads/watchthreads.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.threads/watchthreads.exp,v
retrieving revision 1.17
diff -u -r1.17 watchthreads.exp
--- gdb.threads/watchthreads.exp	16 Jan 2012 16:21:53 -0000	1.17
+++ gdb.threads/watchthreads.exp	26 Jun 2012 19:19:38 -0000
@@ -28,10 +28,8 @@
     return [istarget s390*-*-*]
 }
 
-set testfile "watchthreads"
-set srcfile ${testfile}.c
-set binfile ${objdir}/${subdir}/${testfile}
-if {[gdb_compile_pthreads "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable [list debug "incdir=${objdir}"]] != "" } {
+standard_testfile
+if {[gdb_compile_pthreads "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable debug] != "" } {
     return -1
 }
 
Index: gdb.threads/watchthreads2.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.threads/watchthreads2.exp,v
retrieving revision 1.9
diff -u -r1.9 watchthreads2.exp
--- gdb.threads/watchthreads2.exp	16 Jan 2012 16:21:53 -0000	1.9
+++ gdb.threads/watchthreads2.exp	26 Jun 2012 19:19:38 -0000
@@ -28,17 +28,12 @@
     return 0
 }
 
-set testfile "watchthreads2"
-set srcfile ${testfile}.c
-set binfile ${objdir}/${subdir}/${testfile}
-if {[gdb_compile_pthreads "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable [list debug "incdir=${objdir}" "additional_flags=-DNR_THREADS=$NR_THREADS -DX_INCR_COUNT=$X_INCR_COUNT"]] != "" } {
+standard_testfile
+if {[gdb_compile_pthreads "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable [list debug "additional_flags=-DNR_THREADS=$NR_THREADS -DX_INCR_COUNT=$X_INCR_COUNT"]] != "" } {
     return -1
 }
 
-gdb_exit
-gdb_start
-gdb_reinitialize_dir $srcdir/$subdir
-gdb_load ${binfile}
+clean_restart ${binfile}
 
 gdb_test_no_output "set can-use-hw-watchpoints 1" ""
 



More information about the Gdb-patches mailing list