Convert files gdb.base/[ab]*.exp to use standard_output_file et al.
* a2-run.exp, all-bin.exp, annota1.exp, annota3.exp, anon.exp,
args.exp, arithmet.exp, arrayidx.exp, assign.exp, async-shell.exp,
async.exp, attach-pie-misread.exp, attach-pie-noexec.exp,
attach-twice.exp, attach.exp, auxv.exp, bang.exp, bfp-test.exp,
bigcore.exp, bitfields.exp, bitfields2.exp, break-entry.exp,
break-interp.exp, break-on-linker-gcd-function.exp,
breakpoint-shadow.exp: Use standard_testfile,
standard_output_file, prepare_for_testing, clean_restart.
+2013-06-27 Tom Tromey <tromey@redhat.com>
+
+ * a2-run.exp, all-bin.exp, annota1.exp, annota3.exp, anon.exp,
+ args.exp, arithmet.exp, arrayidx.exp, assign.exp, async-shell.exp,
+ async.exp, attach-pie-misread.exp, attach-pie-noexec.exp,
+ attach-twice.exp, attach.exp, auxv.exp, bang.exp, bfp-test.exp,
+ bigcore.exp, bitfields.exp, bitfields2.exp, break-entry.exp,
+ break-interp.exp, break-on-linker-gcd-function.exp,
+ breakpoint-shadow.exp: Use standard_testfile,
+ standard_output_file, prepare_for_testing, clean_restart.
+
2013-06-26 Yao Qi <yao@codesourcery.com>
* gdb.trace/mi-trace-frame-collected.exp: New.
# test running programs
#
-set testfile a2-run
-if { [prepare_for_testing ${testfile}.exp $testfile run.c] } {
+standard_testfile run.c
+
+if { [prepare_for_testing ${testfile}.exp $testfile $srcfile] } {
return -1
}
# test running programs
#
-set testfile "all-types"
-set srcfile ${testfile}.c
-set binfile ${objdir}/${subdir}/${testfile}
-
-if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug nowarnings}] != "" } {
- untested all-bin.exp
- return -1
- }
+standard_testfile all-types.c
if [get_compiler_info] {
return -1
}
-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
+}
#
# set it up at a breakpoint so we can play with the variable values
# test running programs
#
-set testfile "annota1"
-set srcfile ${testfile}.c
-set binfile ${objdir}/${subdir}/${testfile}
+standard_testfile .c
if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug nowarnings}] != "" } {
untested annota1.exp
}
-gdb_exit
-gdb_start
-gdb_reinitialize_dir $srcdir/$subdir
-gdb_load ${binfile}
+clean_restart ${binfile}
# The commands we test here produce many lines of output; disable "press
# <return> to continue" prompts.
}
proc thread_test {} {
- global objdir subdir srcdir testfile
+ global subdir srcdir testfile
global gdb_prompt old_gdb_prompt
set srcfile watch_thread_num.c
- set binfile ${objdir}/${subdir}/${testfile}-watch_thread_num
+ set binfile [standard_output_file ${testfile}-watch_thread_num]
set gdb_prompt $old_gdb_prompt
if { ![get_compiler_info] && [gdb_compile_pthreads "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug nowarnings}] == "" } {
# test running programs
#
-set testfile "annota3"
-set srcfile ${testfile}.c
-set binfile ${objdir}/${subdir}/${testfile}$EXEEXT
+standard_testfile .c
if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug nowarnings}] != "" } {
untested annota3.exp
}
-gdb_exit
-gdb_start
-gdb_reinitialize_dir $srcdir/$subdir
-gdb_load ${binfile}
+clean_restart ${binfile}
# The commands we test here produce many lines of output; disable "press
# <return> to continue" prompts.
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
-set testfile "anon"
-set srcfile $testfile.c
+standard_testfile .c
+
if { [prepare_for_testing $testfile.exp $testfile $srcfile {debug}] } {
return -1
}
return
}
-set testfile "args"
-set srcfile ${testfile}.c
-set binfile ${objdir}/${subdir}/${testfile}
+standard_testfile
-if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug nowarnings}] != "" } {
- untested args.exp
+if {[build_executable $testfile.exp $testfile \
+ $srcfile {debug nowarnings}] == -1} {
+ untested $testfile.exp
return -1
}
proc args_test { name arglist } {
global srcdir
global subdir
- global binfile
+ global testfile
global hex
global decimal
- gdb_exit
- gdb_start
- gdb_reinitialize_dir $srcdir/$subdir
-
- # No loading needs to be done when the target is `exec'. Some targets
- # require that the program be loaded, however, and it doesn't hurt
- # for `exec'.
- gdb_load $binfile
+ clean_restart $testfile
runto_main
gdb_breakpoint [gdb_get_line_number "set breakpoint here"]
# test running programs
#
-set testfile "int-type"
-set srcfile ${testfile}.c
-set binfile ${objdir}/${subdir}/${testfile}
-
-if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug nowarnings}] != "" } {
- untested arithmet.exp
- return -1
- }
-
-gdb_exit
-gdb_start
-gdb_reinitialize_dir $srcdir/$subdir
-gdb_load ${binfile}
+standard_testfile int-type.c
+
+if {[prepare_for_testing $testfile.exp $testfile $srcfile {debug nowarnings}]} {
+ untested $testfile.exp
+ return -1
+}
#
# gdb can correctly print arrays with indexes for each element of the
# array.
-set testfile "arrayidx"
-set srcfile ${testfile}.c
-set binfile ${objdir}/${subdir}/${testfile}
+standard_testfile .c
+
if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } {
untested "Couldn't compile ${srcfile}"
return -1
}
-gdb_exit
-gdb_start
-gdb_reinitialize_dir $srcdir/$subdir
-gdb_load ${binfile}
+clean_restart ${binfile}
if ![runto_main] then {
perror "couldn't run to breakpoint"
# test running programs
#
-set testfile "all-types"
-set srcfile ${testfile}.c
-set binfile ${objdir}/${subdir}/${testfile}
+standard_testfile all-types.c
if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug nowarnings}] != "" } {
untested assign.exp
}
-
-gdb_exit
-gdb_start
-gdb_reinitialize_dir $srcdir/$subdir
-gdb_load ${binfile}
+clean_restart ${binfile}
#
# 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 async-shell
+standard_testfile
if { ![support_displaced_stepping] } {
unsupported "displaced stepping"
return 0
}
-if { [prepare_for_testing ${testfile}.exp ${testfile}] } {
+if { [prepare_for_testing ${testfile}.exp ${testfile} $srcfile] } {
return -1
}
# test running programs
#
-set testfile "async"
-set srcfile ${testfile}.c
-set binfile ${objdir}/${subdir}/${testfile}
+standard_testfile
-if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug nowarnings}] != "" } {
- untested async.exp
+if [get_compiler_info] {
return -1
}
-if [get_compiler_info] {
+if {[build_executable $testfile.exp $testfile $srcfile debug] == -1} {
+ untested $testfile.exp
return -1
}
load_lib prelink-support.exp
-set test "attach-pie-misread"
-set srcfile ${test}.c
-set genfile ${objdir}/${subdir}/${test}-gen.h
-set executable ${test}
-set binfile ${objdir}/${subdir}/${executable}
+standard_testfile .c
+set genfile [standard_output_file ${testfile}-gen.h]
+set executable $testfile
-if {[build_executable_own_libs ${test}.exp $executable $srcfile [list additional_flags=-fPIE ldflags=-pie]] == ""} {
+if {[build_executable_own_libs ${testfile}.exp $executable $srcfile [list additional_flags=-fPIE ldflags=-pie]] == ""} {
return -1
}
return 0
}
-set testfile attach-pie-noexec
+standard_testfile .c
set executable ${testfile}
-set binfile ${objdir}/${subdir}/${executable}
if { [prepare_for_testing ${testfile}.exp $executable "" [list debug "additional_flags=-fPIE -pie"]] } {
return -1
return 0
}
-set testfile attach-twice
+standard_testfile
set executable ${testfile}
-set binfile ${objdir}/${subdir}/${executable}
if { [prepare_for_testing ${testfile}.exp $executable] } {
return -1
return 0
}
-set testfile "attach"
-set srcfile ${testfile}.c
-set srcfile2 ${testfile}2.c
-set binfile ${objdir}/${subdir}/${testfile}
-set binfile2 ${objdir}/${subdir}/${testfile}2
-set escapedbinfile [string_to_regexp ${objdir}/${subdir}/${testfile}]
+standard_testfile attach.c attach2.c
+set binfile2 ${binfile}2
+set escapedbinfile [string_to_regexp $binfile]
#execute_anywhere "rm -f ${binfile} ${binfile2}"
remote_exec build "rm -f ${binfile} ${binfile2}"
global escapedbinfile
global srcfile
global testfile
- global objdir
global subdir
global timeout
# when we're cd'd to some directory that doesn't contain the
# a.out. (We use the source path set by the "dir" command.)
- gdb_test "dir ${objdir}/${subdir}" "Source directories searched: .*" \
+ gdb_test "dir [standard_output_file {}]" "Source directories searched: .*" \
"set source path"
gdb_test "cd /tmp" "Working directory /tmp." \
}
-set testfile "auxv"
-set srcfile ${testfile}.c
-set binfile ${objdir}/${subdir}/${testfile}
-set corefile ${objdir}/${subdir}/${testfile}.corefile
-set gcorefile ${objdir}/${subdir}/${testfile}.gcore
+standard_testfile .c
+
+set corefile ${binfile}.corefile
+set gcorefile ${binfile}.gcore
if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable \
{debug additional_flags=-DUSE_RLIMIT}] != ""
# Use a fresh directory to confine the native core dumps.
# Make it the working directory for gdb and its child.
-set coredir "${objdir}/${subdir}/coredir.[getpid]"
+set coredir [standard_output_file coredir.[getpid]]
file mkdir $coredir
set core_works [expr [isnative] && ! [is_remote target]]
# Run GDB on the test program up to where it will dump core.
-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"
# This is a test that verifies that GDB is able to "run" when the name
# of the executable file contains a '!'.
-set testfile "args"
-set srcfile ${testfile}.c
-set binfile ${objdir}/${subdir}/bang!
+standard_testfile args.c
-if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug nowarnings}] != "" } {
+if {[prepare_for_testing $testfile.exp ${testfile}! $srcfile \
+ {debug nowarnings}]} {
untested bang.exp
return -1
}
-gdb_exit
-gdb_start
-gdb_reinitialize_dir $srcdir/$subdir
-gdb_load ${binfile}
-
# Verify that we can run the program and that it terminates normally.
gdb_run_cmd
# This file is part of the gdb testsuite. It is intended to test that
# gdb could correctly handle floating point constant with a suffix.
-set testfile "bfp-test"
-set srcfile ${testfile}.c
-set binfile ${objdir}/${subdir}/${testfile}
+standard_testfile .c
+
if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } {
untested "Couldn't compile ${srcfile}"
return -1
}
-gdb_exit
-gdb_start
-gdb_reinitialize_dir $srcdir/$subdir
-gdb_load ${binfile}
+clean_restart ${binfile}
if ![runto_main] then {
perror "couldn't run to breakpoint"
return
}
-set testfile "bigcore"
-set srcfile ${testfile}.c
-set binfile ${objdir}/${subdir}/${testfile}
-set corefile ${objdir}/${subdir}/${testfile}.corefile
+standard_testfile .c
+set corefile ${binfile}.corefile
if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } {
untested bigcore.exp
# Run GDB on the bigcore program up-to where it will dump core.
-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"
# This file was written by Fred Fish. (fnf@cygnus.com)
-set testfile "bitfields"
-set srcfile ${testfile}.c
-set binfile ${objdir}/${subdir}/${testfile}
-if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } {
- untested bitfields.exp
+standard_testfile
+
+if {[prepare_for_testing $testfile.exp $testfile $srcfile debug]} {
+ untested $testfile.exp
return -1
}
gdb_test "print \$myvar.f" "\\$\[0-9\]\+ = -1"
}
-gdb_start
-gdb_reinitialize_dir $srcdir/$subdir
-gdb_load ${binfile}
-
gdb_test_no_output "set print sevenbit-strings"
bitfield_uniqueness
#
-set testfile "bitfields2"
-set srcfile ${testfile}.c
-set binfile ${objdir}/${subdir}/${testfile}
+standard_testfile .c
+
if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } {
untested bitfields2.exp
return -1
gdb_stop_suppressing_tests
}
-gdb_start
-gdb_reinitialize_dir $srcdir/$subdir
-gdb_load ${binfile}
+clean_restart ${binfile}
gdb_test_no_output "set print sevenbit-strings"
runto_main
# continues the process with the equivalent of "jump *$PC", which
# triggers any breakpoint at $PC. The latter is what we want to test.
-set testfile break-entry
+standard_testfile start.c
if [target_info exists use_gdb_stub] {
untested ${testfile}.exp
return
}
-if { [prepare_for_testing ${testfile}.exp ${testfile} start.c {additional_flags=-static}] } {
+if { [prepare_for_testing ${testfile}.exp ${testfile} $srcfile {additional_flags=-static}] } {
return -1
}
load_lib prelink-support.exp
set test "break-interp"
-set binprefix ${objdir}/${subdir}/${test}
+set binprefix [standard_output_file ${test}]
# Only to get the $interp_system name.
set srcfile_test "start.c"
set binfile_test ${test}-test
-set binfile_lib ${objdir}/${subdir}/${test}.so
+set binfile_lib ${binprefix}.so
set srcfile "${test}-main.c"
set srcfile_lib "${test}-lib.c"
}
}
-set interp_system [section_get ${objdir}/${subdir}/$binfile_test .interp]
+set interp_system [section_get [standard_output_file $binfile_test] .interp]
set interp_system_debug [system_debug_get $interp_system]
verbose -log "$interp_system has debug $interp_system_debug"
if $ifmain {
gdb_test_no_output "set args segv"
} else {
- global objdir binfile_test
+ global binfile_test
# ld.so needs some executable to run to reach _dl_debug_state.
- gdb_test_no_output "set args ${objdir}/${subdir}/$binfile_test" "set args OBJDIR/${subdir}/$binfile_test"
+ gdb_test_no_output "set args [standard_output_file $binfile_test]" \
+ "set args OBJDIR/${subdir}/$binfile_test"
}
reach $solib_bp "run" $displacement
#
if { [skip_cplus_tests] } { continue }
-set testfile "break-on-linker-gcd-function"
-set srcfile ${testfile}.cc
-set binfile ${objdir}/${subdir}/${testfile}
+standard_testfile .cc
if [get_compiler_info "c++"] {
return -1
}
set additional_flags {-ffunction-sections -Wl,--gc-sections}
-if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable \
- [list debug c++ additional_flags=$additional_flags]] != "" } {
- untested $srcfile
+if {[prepare_for_testing $testfile.exp $testfile $srcfile \
+ [list debug c++ additional_flags=$additional_flags]]} {
+ untested $testfile.exp
return -1
}
-clean_restart $testfile
-
# Single hex digit
set xd {[0-9a-f]}
# 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 breakpoint-shadow
-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}
-
# We need to start the inferior to place the breakpoints in the memory at all.
if ![runto_main] {
untested start