aboutsummaryrefslogtreecommitdiff
path: root/gdb/testsuite/gdb.threads
diff options
context:
space:
mode:
authorTom Tromey <tromey@redhat.com>2012-06-26 19:23:20 +0000
committerTom Tromey <tromey@redhat.com>2012-06-26 19:23:20 +0000
commit0efbbabc9c1075209244805e34b46db646d95bf3 (patch)
tree15787dbb58f70b06b3fd2c0621bafef6a4cd6bd2 /gdb/testsuite/gdb.threads
parent497a5eb0393355660ba219e968dd5ef655d081b5 (diff)
downloadbinutils-0efbbabc9c1075209244805e34b46db646d95bf3.zip
binutils-0efbbabc9c1075209244805e34b46db646d95bf3.tar.gz
binutils-0efbbabc9c1075209244805e34b46db646d95bf3.tar.bz2
* 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.
Diffstat (limited to 'gdb/testsuite/gdb.threads')
-rw-r--r--gdb/testsuite/gdb.threads/attach-into-signal.exp16
-rw-r--r--gdb/testsuite/gdb.threads/attach-stopped.exp6
-rw-r--r--gdb/testsuite/gdb.threads/bp_in_thread.exp12
-rw-r--r--gdb/testsuite/gdb.threads/corethreads.exp4
-rw-r--r--gdb/testsuite/gdb.threads/execl.exp11
-rw-r--r--gdb/testsuite/gdb.threads/fork-child-threads.exp9
-rw-r--r--gdb/testsuite/gdb.threads/fork-thread-pending.exp9
-rw-r--r--gdb/testsuite/gdb.threads/gcore-thread.exp12
-rw-r--r--gdb/testsuite/gdb.threads/hand-call-in-threads.exp11
-rw-r--r--gdb/testsuite/gdb.threads/ia64-sigill.exp4
-rw-r--r--gdb/testsuite/gdb.threads/interrupted-hand-call.exp11
-rw-r--r--gdb/testsuite/gdb.threads/killed.exp10
-rw-r--r--gdb/testsuite/gdb.threads/leader-exit.exp4
-rw-r--r--gdb/testsuite/gdb.threads/linux-dp.exp8
-rw-r--r--gdb/testsuite/gdb.threads/local-watch-wrong-thread.exp9
-rw-r--r--gdb/testsuite/gdb.threads/manythreads.exp10
-rw-r--r--gdb/testsuite/gdb.threads/multi-create.exp8
-rw-r--r--gdb/testsuite/gdb.threads/no-unwaited-for-left.exp4
-rw-r--r--gdb/testsuite/gdb.threads/non-ldr-exc-1.exp4
-rw-r--r--gdb/testsuite/gdb.threads/non-ldr-exc-2.exp4
-rw-r--r--gdb/testsuite/gdb.threads/non-ldr-exc-3.exp4
-rw-r--r--gdb/testsuite/gdb.threads/non-ldr-exc-4.exp4
-rw-r--r--gdb/testsuite/gdb.threads/pending-step.exp13
-rw-r--r--gdb/testsuite/gdb.threads/print-threads.exp13
-rw-r--r--gdb/testsuite/gdb.threads/pthread_cond_wait.exp11
-rw-r--r--gdb/testsuite/gdb.threads/pthreads.exp14
-rw-r--r--gdb/testsuite/gdb.threads/schedlock.exp6
-rw-r--r--gdb/testsuite/gdb.threads/sigthread.exp9
-rw-r--r--gdb/testsuite/gdb.threads/staticthreads.exp10
-rw-r--r--gdb/testsuite/gdb.threads/switch-threads.exp11
-rw-r--r--gdb/testsuite/gdb.threads/thread-execl.exp13
-rw-r--r--gdb/testsuite/gdb.threads/thread-find.exp8
-rw-r--r--gdb/testsuite/gdb.threads/thread-specific.exp14
-rw-r--r--gdb/testsuite/gdb.threads/thread-unwindonsignal.exp11
-rw-r--r--gdb/testsuite/gdb.threads/thread_check.exp10
-rw-r--r--gdb/testsuite/gdb.threads/thread_events.exp6
-rw-r--r--gdb/testsuite/gdb.threads/threadapply.exp11
-rw-r--r--gdb/testsuite/gdb.threads/threxit-hop-specific.exp14
-rw-r--r--gdb/testsuite/gdb.threads/tls-nodebug.exp10
-rw-r--r--gdb/testsuite/gdb.threads/tls-shared.exp13
-rw-r--r--gdb/testsuite/gdb.threads/tls-var.exp8
-rw-r--r--gdb/testsuite/gdb.threads/tls.exp14
-rw-r--r--gdb/testsuite/gdb.threads/watchpoint-fork.exp14
-rw-r--r--gdb/testsuite/gdb.threads/watchthreads-reorder.exp4
-rw-r--r--gdb/testsuite/gdb.threads/watchthreads.exp6
-rw-r--r--gdb/testsuite/gdb.threads/watchthreads2.exp11
46 files changed, 118 insertions, 310 deletions
diff --git a/gdb/testsuite/gdb.threads/attach-into-signal.exp b/gdb/testsuite/gdb.threads/attach-into-signal.exp
index f98906b..c74fafa 100644
--- a/gdb/testsuite/gdb.threads/attach-into-signal.exp
+++ b/gdb/testsuite/gdb.threads/attach-into-signal.exp
@@ -22,29 +22,21 @@ if { ![isnative] || [is_remote host] || [target_info exists use_gdb_stub]
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 @@ corefunc nonthreaded ${executable_nothr}
# 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
}
diff --git a/gdb/testsuite/gdb.threads/attach-stopped.exp b/gdb/testsuite/gdb.threads/attach-stopped.exp
index cba19d8..f4c05ba 100644
--- a/gdb/testsuite/gdb.threads/attach-stopped.exp
+++ b/gdb/testsuite/gdb.threads/attach-stopped.exp
@@ -23,10 +23,8 @@ if { ![isnative] || [is_remote host] || [target_info exists use_gdb_stub]
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}"
diff --git a/gdb/testsuite/gdb.threads/bp_in_thread.exp b/gdb/testsuite/gdb.threads/bp_in_thread.exp
index 0ec7054e..7b6182c 100644
--- a/gdb/testsuite/gdb.threads/bp_in_thread.exp
+++ b/gdb/testsuite/gdb.threads/bp_in_thread.exp
@@ -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" \
diff --git a/gdb/testsuite/gdb.threads/corethreads.exp b/gdb/testsuite/gdb.threads/corethreads.exp
index 2dd1173..6700017 100644
--- a/gdb/testsuite/gdb.threads/corethreads.exp
+++ b/gdb/testsuite/gdb.threads/corethreads.exp
@@ -19,10 +19,8 @@ if {![isnative] || ![istarget "*-*-linux*"]} {
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
diff --git a/gdb/testsuite/gdb.threads/execl.exp b/gdb/testsuite/gdb.threads/execl.exp
index 4a8fb4d..9b9116a 100644
--- a/gdb/testsuite/gdb.threads/execl.exp
+++ b/gdb/testsuite/gdb.threads/execl.exp
@@ -20,9 +20,7 @@ if { [is_remote target] } then {
}
# 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 @@ if {[gdb_compile_pthreads "${srcdir}/${subdir}/${srcfile}" "${binfile}" executab
# 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
diff --git a/gdb/testsuite/gdb.threads/fork-child-threads.exp b/gdb/testsuite/gdb.threads/fork-child-threads.exp
index e94fcbb..b8c198c 100644
--- a/gdb/testsuite/gdb.threads/fork-child-threads.exp
+++ b/gdb/testsuite/gdb.threads/fork-child-threads.exp
@@ -22,19 +22,14 @@ if { [is_remote target] || ![isnative] } then {
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
diff --git a/gdb/testsuite/gdb.threads/fork-thread-pending.exp b/gdb/testsuite/gdb.threads/fork-thread-pending.exp
index 3c0a4af..e2b4cc3 100644
--- a/gdb/testsuite/gdb.threads/fork-thread-pending.exp
+++ b/gdb/testsuite/gdb.threads/fork-thread-pending.exp
@@ -25,19 +25,14 @@ if { ! [istarget "*-*-linux*"] } {
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
diff --git a/gdb/testsuite/gdb.threads/gcore-thread.exp b/gdb/testsuite/gdb.threads/gcore-thread.exp
index dfb2314..a47f931 100644
--- a/gdb/testsuite/gdb.threads/gcore-thread.exp
+++ b/gdb/testsuite/gdb.threads/gcore-thread.exp
@@ -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 @@ if [istarget "*-*-linux"] then {
# 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] != "") } {
diff --git a/gdb/testsuite/gdb.threads/hand-call-in-threads.exp b/gdb/testsuite/gdb.threads/hand-call-in-threads.exp
index ba0e74b..e179390 100644
--- a/gdb/testsuite/gdb.threads/hand-call-in-threads.exp
+++ b/gdb/testsuite/gdb.threads/hand-call-in-threads.exp
@@ -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 @@ proc get_dummy_frame_number { } {
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"
diff --git a/gdb/testsuite/gdb.threads/ia64-sigill.exp b/gdb/testsuite/gdb.threads/ia64-sigill.exp
index e14c685..a1ae60d 100644
--- a/gdb/testsuite/gdb.threads/ia64-sigill.exp
+++ b/gdb/testsuite/gdb.threads/ia64-sigill.exp
@@ -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
}
diff --git a/gdb/testsuite/gdb.threads/interrupted-hand-call.exp b/gdb/testsuite/gdb.threads/interrupted-hand-call.exp
index 926c612..7b838af 100644
--- a/gdb/testsuite/gdb.threads/interrupted-hand-call.exp
+++ b/gdb/testsuite/gdb.threads/interrupted-hand-call.exp
@@ -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 @@ if [target_info exists gdb,cannot_call_functions] {
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"
diff --git a/gdb/testsuite/gdb.threads/killed.exp b/gdb/testsuite/gdb.threads/killed.exp
index fa99e6e..2e22886 100644
--- a/gdb/testsuite/gdb.threads/killed.exp
+++ b/gdb/testsuite/gdb.threads/killed.exp
@@ -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 {
diff --git a/gdb/testsuite/gdb.threads/leader-exit.exp b/gdb/testsuite/gdb.threads/leader-exit.exp
index d4b8c1f..140b025 100644
--- a/gdb/testsuite/gdb.threads/leader-exit.exp
+++ b/gdb/testsuite/gdb.threads/leader-exit.exp
@@ -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
diff --git a/gdb/testsuite/gdb.threads/linux-dp.exp b/gdb/testsuite/gdb.threads/linux-dp.exp
index d74cded..38f78ef 100644
--- a/gdb/testsuite/gdb.threads/linux-dp.exp
+++ b/gdb/testsuite/gdb.threads/linux-dp.exp
@@ -39,16 +39,12 @@ if ![istarget *-*-linux-gnu*] then {
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
diff --git a/gdb/testsuite/gdb.threads/local-watch-wrong-thread.exp b/gdb/testsuite/gdb.threads/local-watch-wrong-thread.exp
index a8897a5..942922f 100644
--- a/gdb/testsuite/gdb.threads/local-watch-wrong-thread.exp
+++ b/gdb/testsuite/gdb.threads/local-watch-wrong-thread.exp
@@ -23,19 +23,14 @@ if {[skip_hw_watchpoint_multi_tests]} {
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" ""
diff --git a/gdb/testsuite/gdb.threads/manythreads.exp b/gdb/testsuite/gdb.threads/manythreads.exp
index 42333e6..c863ee1 100644
--- a/gdb/testsuite/gdb.threads/manythreads.exp
+++ b/gdb/testsuite/gdb.threads/manythreads.exp
@@ -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
diff --git a/gdb/testsuite/gdb.threads/multi-create.exp b/gdb/testsuite/gdb.threads/multi-create.exp
index ed5cb30..7d1f3ea 100644
--- a/gdb/testsuite/gdb.threads/multi-create.exp
+++ b/gdb/testsuite/gdb.threads/multi-create.exp
@@ -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
diff --git a/gdb/testsuite/gdb.threads/no-unwaited-for-left.exp b/gdb/testsuite/gdb.threads/no-unwaited-for-left.exp
index 86c9259..22efc36 100644
--- a/gdb/testsuite/gdb.threads/no-unwaited-for-left.exp
+++ b/gdb/testsuite/gdb.threads/no-unwaited-for-left.exp
@@ -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
diff --git a/gdb/testsuite/gdb.threads/non-ldr-exc-1.exp b/gdb/testsuite/gdb.threads/non-ldr-exc-1.exp
index 8dc9bf4..2d0b802 100644
--- a/gdb/testsuite/gdb.threads/non-ldr-exc-1.exp
+++ b/gdb/testsuite/gdb.threads/non-ldr-exc-1.exp
@@ -21,10 +21,8 @@ if { [is_remote target] } then {
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
diff --git a/gdb/testsuite/gdb.threads/non-ldr-exc-2.exp b/gdb/testsuite/gdb.threads/non-ldr-exc-2.exp
index 2d49773..476e48e 100644
--- a/gdb/testsuite/gdb.threads/non-ldr-exc-2.exp
+++ b/gdb/testsuite/gdb.threads/non-ldr-exc-2.exp
@@ -22,10 +22,8 @@ if { [is_remote target] } then {
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
diff --git a/gdb/testsuite/gdb.threads/non-ldr-exc-3.exp b/gdb/testsuite/gdb.threads/non-ldr-exc-3.exp
index 7d6841d..9d674a6 100644
--- a/gdb/testsuite/gdb.threads/non-ldr-exc-3.exp
+++ b/gdb/testsuite/gdb.threads/non-ldr-exc-3.exp
@@ -24,10 +24,8 @@ if { [is_remote target] } then {
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
diff --git a/gdb/testsuite/gdb.threads/non-ldr-exc-4.exp b/gdb/testsuite/gdb.threads/non-ldr-exc-4.exp
index aecf107..7543e20 100644
--- a/gdb/testsuite/gdb.threads/non-ldr-exc-4.exp
+++ b/gdb/testsuite/gdb.threads/non-ldr-exc-4.exp
@@ -23,10 +23,8 @@ if { [is_remote target] } then {
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
diff --git a/gdb/testsuite/gdb.threads/pending-step.exp b/gdb/testsuite/gdb.threads/pending-step.exp
index eb052cd..b5987dd 100644
--- a/gdb/testsuite/gdb.threads/pending-step.exp
+++ b/gdb/testsuite/gdb.threads/pending-step.exp
@@ -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"
diff --git a/gdb/testsuite/gdb.threads/print-threads.exp b/gdb/testsuite/gdb.threads/print-threads.exp
index b5a99fe..8336e29 100644
--- a/gdb/testsuite/gdb.threads/print-threads.exp
+++ b/gdb/testsuite/gdb.threads/print-threads.exp
@@ -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"
diff --git a/gdb/testsuite/gdb.threads/pthread_cond_wait.exp b/gdb/testsuite/gdb.threads/pthread_cond_wait.exp
index fc2942e..bf8730b 100644
--- a/gdb/testsuite/gdb.threads/pthread_cond_wait.exp
+++ b/gdb/testsuite/gdb.threads/pthread_cond_wait.exp
@@ -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" \
diff --git a/gdb/testsuite/gdb.threads/pthreads.exp b/gdb/testsuite/gdb.threads/pthreads.exp
index e216993..14aa410 100644
--- a/gdb/testsuite/gdb.threads/pthreads.exp
+++ b/gdb/testsuite/gdb.threads/pthreads.exp
@@ -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 @@ if [istarget "*-*-linux"] then {
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"
diff --git a/gdb/testsuite/gdb.threads/schedlock.exp b/gdb/testsuite/gdb.threads/schedlock.exp
index 522559c..2d0552a 100644
--- a/gdb/testsuite/gdb.threads/schedlock.exp
+++ b/gdb/testsuite/gdb.threads/schedlock.exp
@@ -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
}
diff --git a/gdb/testsuite/gdb.threads/sigthread.exp b/gdb/testsuite/gdb.threads/sigthread.exp
index d3b4918..7e9fb06 100644
--- a/gdb/testsuite/gdb.threads/sigthread.exp
+++ b/gdb/testsuite/gdb.threads/sigthread.exp
@@ -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"
diff --git a/gdb/testsuite/gdb.threads/staticthreads.exp b/gdb/testsuite/gdb.threads/staticthreads.exp
index a073d55..d26f3e8 100644
--- a/gdb/testsuite/gdb.threads/staticthreads.exp
+++ b/gdb/testsuite/gdb.threads/staticthreads.exp
@@ -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"
diff --git a/gdb/testsuite/gdb.threads/switch-threads.exp b/gdb/testsuite/gdb.threads/switch-threads.exp
index 1561e5b..c0ccb58 100644
--- a/gdb/testsuite/gdb.threads/switch-threads.exp
+++ b/gdb/testsuite/gdb.threads/switch-threads.exp
@@ -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
diff --git a/gdb/testsuite/gdb.threads/thread-execl.exp b/gdb/testsuite/gdb.threads/thread-execl.exp
index 3886846..449e303 100644
--- a/gdb/testsuite/gdb.threads/thread-execl.exp
+++ b/gdb/testsuite/gdb.threads/thread-execl.exp
@@ -21,21 +21,14 @@ if { [is_remote target] } {
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
diff --git a/gdb/testsuite/gdb.threads/thread-find.exp b/gdb/testsuite/gdb.threads/thread-find.exp
index f39886c..42932ff 100644
--- a/gdb/testsuite/gdb.threads/thread-find.exp
+++ b/gdb/testsuite/gdb.threads/thread-find.exp
@@ -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
diff --git a/gdb/testsuite/gdb.threads/thread-specific.exp b/gdb/testsuite/gdb.threads/thread-specific.exp
index 6e22dde..e41f12ff 100644
--- a/gdb/testsuite/gdb.threads/thread-specific.exp
+++ b/gdb/testsuite/gdb.threads/thread-specific.exp
@@ -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 @@ proc get_thread_list { } {
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"
diff --git a/gdb/testsuite/gdb.threads/thread-unwindonsignal.exp b/gdb/testsuite/gdb.threads/thread-unwindonsignal.exp
index bacbe4c..cb90479 100644
--- a/gdb/testsuite/gdb.threads/thread-unwindonsignal.exp
+++ b/gdb/testsuite/gdb.threads/thread-unwindonsignal.exp
@@ -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 @@ if [target_info exists gdb,cannot_call_functions] {
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"
diff --git a/gdb/testsuite/gdb.threads/thread_check.exp b/gdb/testsuite/gdb.threads/thread_check.exp
index 1a4526d..8d94046 100644
--- a/gdb/testsuite/gdb.threads/thread_check.exp
+++ b/gdb/testsuite/gdb.threads/thread_check.exp
@@ -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"
diff --git a/gdb/testsuite/gdb.threads/thread_events.exp b/gdb/testsuite/gdb.threads/thread_events.exp
index 2b69eb8..61bf69d 100644
--- a/gdb/testsuite/gdb.threads/thread_events.exp
+++ b/gdb/testsuite/gdb.threads/thread_events.exp
@@ -34,11 +34,9 @@ if [is_remote target] then {
}
-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
}
diff --git a/gdb/testsuite/gdb.threads/threadapply.exp b/gdb/testsuite/gdb.threads/threadapply.exp
index a46ceeb..1ec1a3a 100644
--- a/gdb/testsuite/gdb.threads/threadapply.exp
+++ b/gdb/testsuite/gdb.threads/threadapply.exp
@@ -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.
diff --git a/gdb/testsuite/gdb.threads/threxit-hop-specific.exp b/gdb/testsuite/gdb.threads/threxit-hop-specific.exp
index 315dabc..4985d45 100644
--- a/gdb/testsuite/gdb.threads/threxit-hop-specific.exp
+++ b/gdb/testsuite/gdb.threads/threxit-hop-specific.exp
@@ -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
diff --git a/gdb/testsuite/gdb.threads/tls-nodebug.exp b/gdb/testsuite/gdb.threads/tls-nodebug.exp
index 40709f2..186a9da 100644
--- a/gdb/testsuite/gdb.threads/tls-nodebug.exp
+++ b/gdb/testsuite/gdb.threads/tls-nodebug.exp
@@ -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 @@ if {[gdb_compile_pthreads "${srcdir}/${subdir}/${srcfile}" "${binfile}" executab
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
diff --git a/gdb/testsuite/gdb.threads/tls-shared.exp b/gdb/testsuite/gdb.threads/tls-shared.exp
index c0538d3..e659d51 100644
--- a/gdb/testsuite/gdb.threads/tls-shared.exp
+++ b/gdb/testsuite/gdb.threads/tls-shared.exp
@@ -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 @@ if { [gdb_compile_shlib_pthreads ${srcdir}/${subdir}/${srcfile_lib} ${binfile_li
}
-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 "print i_tls" "2" "print thread local storage variable"
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"]
diff --git a/gdb/testsuite/gdb.threads/tls-var.exp b/gdb/testsuite/gdb.threads/tls-var.exp
index 0054049..fdc267a 100644
--- a/gdb/testsuite/gdb.threads/tls-var.exp
+++ b/gdb/testsuite/gdb.threads/tls-var.exp
@@ -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 {}] != ""
diff --git a/gdb/testsuite/gdb.threads/tls.exp b/gdb/testsuite/gdb.threads/tls.exp
index 411b24b..62ef4ef 100644
--- a/gdb/testsuite/gdb.threads/tls.exp
+++ b/gdb/testsuite/gdb.threads/tls.exp
@@ -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 @@ if [istarget "*-*-linux"] then {
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 @@ proc check_thread_stack {number spin_threads spin_threads_level} {
}
}
-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
diff --git a/gdb/testsuite/gdb.threads/watchpoint-fork.exp b/gdb/testsuite/gdb.threads/watchpoint-fork.exp
index 09563a5..f6f1567 100644
--- a/gdb/testsuite/gdb.threads/watchpoint-fork.exp
+++ b/gdb/testsuite/gdb.threads/watchpoint-fork.exp
@@ -23,7 +23,7 @@ if [is_remote target] {
}
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 @@ proc test {type symbol} { with_test_prefix "$type" {
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 @@ proc test {type symbol} { with_test_prefix "$type" {
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
}
diff --git a/gdb/testsuite/gdb.threads/watchthreads-reorder.exp b/gdb/testsuite/gdb.threads/watchthreads-reorder.exp
index 5197983..283c4ca 100644
--- a/gdb/testsuite/gdb.threads/watchthreads-reorder.exp
+++ b/gdb/testsuite/gdb.threads/watchthreads-reorder.exp
@@ -31,9 +31,7 @@ if {[skip_hw_watchpoint_access_tests]
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
}
diff --git a/gdb/testsuite/gdb.threads/watchthreads.exp b/gdb/testsuite/gdb.threads/watchthreads.exp
index c18505e..b74b291 100644
--- a/gdb/testsuite/gdb.threads/watchthreads.exp
+++ b/gdb/testsuite/gdb.threads/watchthreads.exp
@@ -28,10 +28,8 @@ proc target_no_stopped_data { } {
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
}
diff --git a/gdb/testsuite/gdb.threads/watchthreads2.exp b/gdb/testsuite/gdb.threads/watchthreads2.exp
index aaa3430..d67b9f0 100644
--- a/gdb/testsuite/gdb.threads/watchthreads2.exp
+++ b/gdb/testsuite/gdb.threads/watchthreads2.exp
@@ -28,17 +28,12 @@ if {[skip_hw_watchpoint_tests]} {
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" ""