Convert files gdb.base/[t-z]*.exp to use standard_output_file et al.
	* gdb.base/testenv.exp, gdb.base/tui-layout.exp,
	gdb.base/twice.exp, gdb.base/type-opaque.exp, gdb.base/unload.exp,
	gdb.base/unwindonsignal.exp, gdb.base/valgrind-db-attach.exp,
	gdb.base/valgrind-infcall.exp, gdb.base/value-double-free.exp,
	gdb.base/varargs.exp, gdb.base/watch-cond-infcall.exp,
	gdb.base/watch-cond.exp, gdb.base/watch-non-mem.exp,
	gdb.base/watch-read.exp, gdb.base/watch-vfork.exp,
	gdb.base/watch_thread_num.exp, gdb.base/watchpoint-cond-gone.exp,
	gdb.base/watchpoint-delete.exp, gdb.base/watchpoint-hw.exp,
	gdb.base/watchpoint-solib.exp, gdb.base/watchpoint.exp,
	gdb.base/watchpoints.exp, gdb.base/wchar.exp, gdb.base/whatis.exp:
	Use standard_testfile, standard_output_file, prepare_for_testing,
	clean_restart.
+2013-06-27  Tom Tromey  <tromey@redhat.com>
+
+       * gdb.base/testenv.exp, gdb.base/tui-layout.exp,
+       gdb.base/twice.exp, gdb.base/type-opaque.exp, gdb.base/unload.exp,
+       gdb.base/unwindonsignal.exp, gdb.base/valgrind-db-attach.exp,
+       gdb.base/valgrind-infcall.exp, gdb.base/value-double-free.exp,
+       gdb.base/varargs.exp, gdb.base/watch-cond-infcall.exp,
+       gdb.base/watch-cond.exp, gdb.base/watch-non-mem.exp,
+       gdb.base/watch-read.exp, gdb.base/watch-vfork.exp,
+       gdb.base/watch_thread_num.exp, gdb.base/watchpoint-cond-gone.exp,
+       gdb.base/watchpoint-delete.exp, gdb.base/watchpoint-hw.exp,
+       gdb.base/watchpoint-solib.exp, gdb.base/watchpoint.exp,
+       gdb.base/watchpoints.exp, gdb.base/wchar.exp, gdb.base/whatis.exp:
+       Use standard_testfile, standard_output_file, prepare_for_testing,
+       clean_restart.
+
 2013-06-27  Tom Tromey  <tromey@redhat.com>
 
        * gdb.base/save-bp.exp, gdb.base/savedregs.exp,
 
     return 0
 }
 
-set testfile "testenv"
-set srcfile ${testfile}.c
-set binfile ${testfile}
+standard_testfile .c
 
 # Compile binary
 # and start with a fresh gdb
 
 # 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 tui-layout
-if { [prepare_for_testing ${testfile}.exp ${testfile} start.c] } {
+standard_testfile start.c
+
+if { [prepare_for_testing ${testfile}.exp ${testfile} $srcfile] } {
     return -1
 }
 
 
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
 
-set testfile twice-tmp
-set srcfile ${testfile}.c
-set binfile ${objdir}/${subdir}/${testfile}
+standard_output_file twice.c
 set options debug
 lappend options "additional_flags=-I."
 
-set fileid [open ${objdir}/${subdir}/${srcfile} w]
+set local_srcfile [standard_output_file twice-tmp.c]
+set fileid [open $local_srcfile w]
 puts $fileid "#include \"twice.c\""
 close $fileid
 
 remote_download host ${srcdir}/${subdir}/twice.c twice.c
 
-if  { [gdb_compile "${objdir}/${subdir}/${srcfile}" "${binfile}" executable $options] != "" } {
+if  { [gdb_compile $local_srcfile "${binfile}" executable $options] != "" } {
      untested twice.exp
      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 {
     # Test that GDB can still detect whether we have line numbers
 
     return -1
 }
 
-set testfile type-opaque-main
-set libfile type-opaque-lib
-set srcfile ${testfile}.c
-set binfile ${objdir}/${subdir}/${testfile}
+standard_testfile type-opaque-main.c
 
+set libfile type-opaque-lib
 set libsrc "${srcdir}/${subdir}/${libfile}.c"
-set libobj "${objdir}/${subdir}/${libfile}.so"
+set libobj [standard_output_file ${libfile}.so]
 set execsrc "${srcdir}/${subdir}/${srcfile}"
 
 remote_exec build "rm -f ${binfile}"
     return -1
 }
 
-gdb_exit
-gdb_start
-gdb_reinitialize_dir $srcdir/$subdir
-gdb_load ${binfile}
+clean_restart ${binfile}
 gdb_load_shlibs ${libobj}
 
 if ![runto_main] then {
 
 set libsrcfile ${libfile}.c
 set libsrcfile2 ${libfile2}.c
 set srcfile $srcdir/$subdir/$testfile.c
-set binfile $objdir/$subdir/$testfile
-set shlibdir ${objdir}/${subdir}
+set binfile [standard_output_file $testfile]
+set shlibdir [standard_output_file {}]
 set libsrc  $srcdir/$subdir/$libfile.c
 set libsrc2  $srcdir/$subdir/$libfile2.c
-set lib_sl  $objdir/$subdir/$libname
-set lib_sl2  $objdir/$subdir/$libname2
+set lib_sl  [standard_output_file $libname]
+set lib_sl2  [standard_output_file $libname2]
 set lib_dlopen [shlib_target_file ${libname}]
 set lib_dlopen2 [shlib_target_file ${libname2}]
 set lib_syms [shlib_symbol_file ${libname}]
 
 }
 
 
-set testfile "unwindonsignal"
-set srcfile ${testfile}.c
-set binfile ${objdir}/${subdir}/${testfile}
-
-if  { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } {
-     untested unwindonsignal.exp
-     return -1
-}
-
 # Some targets can't do function calls, so don't even bother with this
 # test.
 if [target_info exists gdb,cannot_call_functions] {
     continue
 }
 
-# Start with a fresh gdb.
+standard_testfile
 
-gdb_exit
-gdb_start
-gdb_reinitialize_dir $srcdir/$subdir
-gdb_load ${binfile}
+if {[prepare_for_testing $testfile.exp $testfile $srcfile debug]} {
+    untested $testfile.exp
+    return -1
+}
 
 if { ![runto_main] } {
     fail "Can't run to main"
 
     return 0
 }
 
-set test valgrind-db-attach
-set srcfile $test.c
-set executable $test
-set binfile ${objdir}/${subdir}/${executable}
-if {[build_executable $test.exp $executable $srcfile {debug}] == -1} {
+standard_testfile .c
+if {[build_executable $testfile.exp $testfile $srcfile {debug}] == -1} {
     return -1
 }
 
 
     return 0
 }
 
-set test valgrind-infcall
-set srcfile $test.c
-set executable $test
-set binfile ${objdir}/${subdir}/${executable}
-if {[build_executable $test.exp $executable $srcfile {debug}] == -1} {
+standard_testfile .c
+if {[build_executable $testfile.exp $testfile $srcfile {debug}] == -1} {
     return -1
 }
 
 set board [host_info name]
 unset_board_info fileid
 
-clean_restart $executable
+clean_restart $testfile
 
 gdb_test "$vgdbcmd" " in \\.?_start .*" "target remote for vgdb"
 
 
 # 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 value-double-free
-set srcfile ${testfile}.c
-set binfile ${objdir}/${subdir}/${testfile}
-if  { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } {
-    untested "Couldn't compile test program"
+standard_testfile
+
+if {[prepare_for_testing $testfile.exp $testfile $srcfile debug]} {
+    untested $testfile.exp
     return -1
 }
 
-# Get things started.
-
-gdb_exit
-gdb_start
-gdb_reinitialize_dir $srcdir/$subdir
-gdb_load ${binfile}
-
 if ![runto_main] {
     return -1
 }
 
 
 
 set prototypes 0
-set testfile "varargs"
-set srcfile ${testfile}.c
-set binfile ${objdir}/${subdir}/${testfile}
+
+standard_testfile .c
 
 if [get_compiler_info] {
     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"
 gdb_test_no_output "set width 0"
 
 # Test for watchpoints with conditions that involve inferior function
 # calls.
 
-set testfile "watch-cond-infcall"
-set srcfile ${testfile}.c
-set binfile ${objdir}/${subdir}/${testfile}
+standard_testfile
 
 if { [build_executable ${testfile}.exp ${testfile} ${testfile}.c {debug}] } {
     untested ${testfile}.exp
 
 # Tests involving watchpoint conditions with local expressions.
 #
 
-set testfile "watch-cond"
-set srcfile ${testfile}.c
-set binfile ${objdir}/${subdir}/${testfile}
+standard_testfile .c
 
 if { [prepare_for_testing ${testfile}.exp ${testfile} ${srcfile}] } {
     untested ${testfile}.exp
 
 # Tests watchpoints that watch expressions that don't involve memory.
 #
 
-set testfile "watch-non-mem"
-set srcfile ${testfile}.c
-set binfile ${objdir}/${subdir}/${testfile}
+standard_testfile
 
 if { [prepare_for_testing ${testfile}.exp ${testfile} ${srcfile}] } {
     untested ${testfile}.exp
 
 # watching the same memory as read watchpoints.
 #
 
-set testfile "watch-read"
-set srcfile ${testfile}.c
+standard_testfile .c
 
 if {[skip_hw_watchpoint_access_tests]} {
     return 0
 
     return 0
 }
 
-global srcfile
-set testfile "watch-vfork"
-if { [build_executable ${testfile}.exp ${testfile} ${testfile}.c {debug}] } {
+standard_testfile .c
+
+if { [build_executable ${testfile}.exp ${testfile} $srcfile {debug}] } {
     untested ${testfile}.exp
     return -1
 }
 
     return 0
 }
 
-set testfile watch_thread_num
-set srcfile ${testfile}.c
-set binfile ${objdir}/${subdir}/${testfile}
+standard_testfile .c
 
 # What compiler are we using?
 #
     return -1
 }
 
-gdb_exit
-gdb_start
-gdb_reinitialize_dir $srcdir/$subdir
-gdb_load ${binfile}
+clean_restart ${binfile}
 
 if { ![runto main] } then {
    fail "run to main"
 
 # 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 "watchpoint-cond-gone"
-set srcfile ${testfile}.c
-set srcfilestripped ${testfile}-stripped.c
-set objfilestripped ${objdir}/${subdir}/${testfile}-stripped.o
-set binfile ${objdir}/${subdir}/${testfile}
+standard_testfile .c watchpoint-cond-gone-stripped.c
 
 # We need to generate a function without DWARF to crash older GDB.
 # Stepping into a dynamic function trampoline or stepping out of MAIN may work
 # but it is not a reliable FAIL case.
 
-if  { [gdb_compile "${srcdir}/${subdir}/${srcfilestripped}" "${objfilestripped}" object {}] != ""
-      || [gdb_compile "${srcdir}/${subdir}/${srcfile} ${objfilestripped}" "${binfile}" executable {debug}] != "" } {
-    untested watchpoint-cond-gone.exp
+if {[prepare_for_testing_full $testfile.exp \
+        [list $testfile debug $srcfile debug $srcfile2 {}]]} {
+    untested $testfile.exp
     return -1
 }
 
-clean_restart ${testfile}
-
 # Problem does not occur otherwise.
 gdb_test_no_output "set can-use-hw-watchpoints 0"
 
 
 # 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 "watchpoint-delete"
-set srcfile ${testfile}.c
-set binfile ${objdir}/${subdir}/${testfile}
+standard_testfile .c
 
 if { [prepare_for_testing ${testfile}.exp ${testfile} ${srcfile}] } {
     untested ${testfile}.exp
 
     return 0
 }
 
-set testfile watchpoint-hw
-set srcfile ${testfile}.c
-set binfile ${objdir}/${subdir}/${testfile}
-if  { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } {
-    untested "Couldn't compile test program"
+standard_testfile
+
+if {[prepare_for_testing $testfile.exp $testfile $srcfile debug]} {
+    untested $testfile.exp
     return -1
 }
 
-gdb_exit
-gdb_start
-gdb_reinitialize_dir $srcdir/$subdir
-gdb_load ${binfile}
-
 # Create the watchpoint before the inferior gets started.  Now the native CPU
 # target is still not active and its `to_can_use_hw_breakpoint' is not
 # installed, therefore only a software watchpoint gets created.
 
 set libname "${libfile}.sl"
 set libsrcfile ${libfile}.c
 set srcfile $srcdir/$subdir/$testfile.c
-set binfile $objdir/$subdir/$testfile
-set shlibdir ${objdir}/${subdir}
+set binfile [standard_output_file $testfile]
+set shlibdir [standard_output_file {}]
 set libsrc  $srcdir/$subdir/$libfile.c
-set lib_sl  $objdir/$subdir/$libname
+set lib_sl  [standard_output_file $libname]
 set lib_dlopen [shlib_target_file ${libname}]
 set lib_syms [shlib_symbol_file ${libname}]
 
 
 # This file was written by Fred Fish. (fnf@cygnus.com)
 
 
-set testfile "watchpoint"
-set srcfile ${testfile}.c
-set binfile ${objdir}/${subdir}/${testfile}
+standard_testfile
 
 if [get_compiler_info] {
     return -1
 
 # This file was written by Pierre Muller. (muller@ics.u-strasbg.fr)
 
 
-set testfile "watchpoints"
-set srcfile ${testfile}.c
-set binfile ${objdir}/${subdir}/${testfile}
+standard_testfile
 
 set wp_set 1
 
     return -1
 }
 
-if  { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } {
-     untested watchpoint.exp
-     return -1
+if {[prepare_for_testing $testfile.exp $testfile $srcfile debug]} {
+    untested $testfile.exp
+    return -1
 }
 
-# Start with a fresh gdb.
-
-gdb_exit
-gdb_start
-gdb_reinitialize_dir $srcdir/$subdir
-gdb_load $binfile
-
     # Disable hardware watchpoints if necessary.
     if [target_info exists gdb,no_hardware_watchpoints] {
         gdb_test_no_output "set can-use-hw-watchpoints 0" ""
 
 # 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 wchar
-set srcfile ${testfile}.c
+standard_testfile .c
+
 if { [prepare_for_testing ${testfile}.exp ${testfile} ${srcfile}] } {
     return -1
 }
 
     set exec_opts [list debug]
 }
 
-set testfile whatis
-set srcfile ${testfile}.c
-set binfile ${objdir}/${subdir}/${testfile}
+standard_testfile .c
+
 if  { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable $exec_opts] != "" } {
      untested whatis.exp
      return -1
 
 # Start with a fresh gdb.
 
-gdb_exit
-gdb_start
-gdb_reinitialize_dir $srcdir/$subdir
-gdb_load $binfile
+clean_restart $binfile
 
 # Define a procedure to set up an xfail for all targets that put out a
 # `long' type as an `int' type.