summaryrefslogtreecommitdiff
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-gdb-0efbbabc9c1075209244805e34b46db646d95bf3.tar.gz
* 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 f98906b1292..c74fafa4842 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 cba19d83f48..f4c05baeadb 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 0ec7054eee0..7b6182ca6fa 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 2dd117336bd..6700017a1b0 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 4a8fb4d9401..9b9116a9b0c 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 e94fcbb4b55..b8c198c16df 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 3c0a4af19a4..e2b4cc32d6f 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 dfb231477ae..a47f931dc9a 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 ba0e74b98da..e179390c8bc 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 e14c6852fda..a1ae60dcea5 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 926c612a73b..7b838afce4b 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 fa99e6e9c1b..2e22886a689 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 d4b8c1f30e9..140b025bd36 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 d74cded8ce3..38f78efb6da 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 a8897a53ea5..942922fc2c6 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 42333e6b7f0..c863ee19c6e 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 ed5cb301309..7d1f3eae80b 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 86c9259b91a..22efc36cc7f 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 8dc9bf42905..2d0b802398d 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 2d49773b9b6..476e48e902f 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 7d6841dea9f..9d674a68e50 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 aecf10745fb..7543e20ed93 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 eb052cdf762..b5987dd5794 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 b5a99fee0c2..8336e29ae8e 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 fc2942e07a0..bf8730bc3b8 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 e216993cd5f..14aa41099bf 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 522559c1b29..2d0552afcb5 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 d3b491830f4..7e9fb0644e0 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 a073d556fd2..d26f3e8c52d 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 1561e5b0fef..c0ccb5825e7 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 3886846a61e..449e3033ea8 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 f39886c0018..42932ffccda 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 6e22dded0aa..e41f12ff263 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 bacbe4c0f7c..cb904793ead 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 1a4526d8e24..8d94046925b 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 2b69eb8449d..61bf69d2671 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 a46ceebc1d2..1ec1a3af2cd 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 315dabc27e9..4985d455daf 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 40709f24110..186a9da2f6c 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 c0538d3beb2..e659d51aeb1 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 00540492194..fdc267a6c18 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 411b24bd35c..62ef4efe2ea 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 09563a5bb53..f6f1567aa52 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 51979830335..283c4caf1ad 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 c18505e394a..b74b291661a 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 aaa3430715d..d67b9f094ed 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" ""