Convert files gdb.base/[cd]*.exp to use standard_output_file et al.
* call-ar-st.exp, call-rt-st.exp, call-sc.exp,
call-signal-resume.exp, call-strs.exp, callexit.exp,
callfuncs.exp, catch-load.exp, catch-syscall.exp, charset.exp,
checkpoint.exp, chng-syms.exp, code-expr.exp, code_elim.exp,
commands.exp, completion.exp, complex.exp, cond-expr.exp,
condbreak.exp, consecutive.exp, constvars.exp, corefile.exp,
ctxobj.exp, cursal.exp, cvexpr.exp, dbx.exp, default.exp,
define.exp, del.exp, detach.exp, dfp-test.exp, display.exp,
dmsym.exp, dump.exp, dup-sect.exp: Use standard_testfile,
standard_output_file, prepare_for_testing, clean_restart.
+2013-06-27 Tom Tromey <tromey@redhat.com>
+
+ * call-ar-st.exp, call-rt-st.exp, call-sc.exp,
+ call-signal-resume.exp, call-strs.exp, callexit.exp,
+ callfuncs.exp, catch-load.exp, catch-syscall.exp, charset.exp,
+ checkpoint.exp, chng-syms.exp, code-expr.exp, code_elim.exp,
+ commands.exp, completion.exp, complex.exp, cond-expr.exp,
+ condbreak.exp, consecutive.exp, constvars.exp, corefile.exp,
+ ctxobj.exp, cursal.exp, cvexpr.exp, dbx.exp, default.exp,
+ define.exp, del.exp, detach.exp, dfp-test.exp, display.exp,
+ dmsym.exp, dump.exp, dup-sect.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,
-set testfile "call-ar-st"
-set srcfile ${testfile}.c
-set binfile ${objdir}/${subdir}/${testfile}
+standard_testfile
# Test depends on printf, which the sparclet stub doesn't support.
if { [istarget "sparclet-*-*"] } {
return 0
}
-if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } {
- untested "couldn't compile ${srcdir}/${subdir}/${srcfile}"
- return -1
+# Some targets can't call functions, so don't even bother with this
+# test.
+if [target_info exists gdb,cannot_call_functions] {
+ setup_xfail "*-*-*" 2416
+ fail "This target can not call functions"
+ continue
}
-
# Create and source the file that provides information about the compiler
# used to compile the test case.
return -1
}
-# Some targets can't call functions, so don't even bother with this
-# test.
-if [target_info exists gdb,cannot_call_functions] {
- setup_xfail "*-*-*" 2416
- fail "This target can not call functions"
- continue
+if {[prepare_for_testing $testfile.exp $testfile $srcfile debug]} {
+ untested $testfile.exp
+ return -1
}
+
set oldtimeout $timeout
set timeout [expr "$timeout + 60"]
-# Start with a fresh gdb.
-
-gdb_exit
-gdb_start
-gdb_reinitialize_dir $srcdir/$subdir
-gdb_load ${binfile}
gdb_test_no_output "set print sevenbit-strings"
gdb_test_no_output "set print address off"
gdb_test_no_output "set width 0"
-set testfile "call-rt-st"
-set srcfile ${testfile}.c
-set binfile ${objdir}/${subdir}/${testfile}
-
+standard_testfile .c
# Test depends on printf, which the sparclet stub doesn't support.
if { [istarget "sparclet-*-*"] } {
# 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"
continue
}
-set testfile "call-sc"
-set srcfile ${testfile}.c
-set binfile ${objdir}/${subdir}/${testfile}
+standard_testfile .c
# Create and source the file that provides information about the
# compiler used to compile the test case.
global testfile
global srcfile
global binfile
- global objdir
global subdir
global srcdir
global gdb_prompt
set flags "debug additional_flags=-DT=${type}"
set testfile "call-sc-${type}"
- set binfile ${objdir}/${subdir}/${testfile}
+ set binfile [standard_output_file ${testfile}]
if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable "${flags}"] != "" } {
# built the second test case since we can't use prototypes
warning "Prototypes not supported, rebuilding with -DNO_PROTOTYPES"
}
-set testfile "call-signals"
-set srcfile ${testfile}.c
-set binfile ${objdir}/${subdir}/${testfile}
+standard_testfile call-signals.c
if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } {
untested call-signal-resume.exp
# Start with a fresh gdb.
-gdb_exit
-gdb_start
-gdb_reinitialize_dir $srcdir/$subdir
-gdb_load ${binfile}
+clean_restart ${binfile}
if { ![runto_main] } {
fail "Can't run to main"
#debug strarg
-set testfile "call-strs"
-set srcfile ${testfile}.c
-set binfile ${objdir}/${subdir}/${testfile}
+standard_testfile
# Test depends on printf, which the sparclet stub doesn't support.
if { [istarget "sparclet-*-*"] } {
return 0
}
-if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } {
- untested call-strs.exp
- return -1
-}
-
-
-
# Some targets can't call functions, so don't even bother with this
# test.
if [target_info exists gdb,cannot_call_functions] {
}
-# Start with a fresh gdb.
+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}
gdb_test_no_output "set print sevenbit-strings"
gdb_test_no_output "set print address off"
gdb_test_no_output "set print symbol off"
# along with this program. If not, see <http://www.gnu.org/licenses/>.
-set testfile "callexit"
-set srcfile ${testfile}.c
-set binfile ${objdir}/${subdir}/${testfile}
+standard_testfile .c
if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } {
untested callexit.exp
# Start with a fresh gdb.
-gdb_exit
-gdb_start
-gdb_reinitialize_dir $srcdir/$subdir
-gdb_load ${binfile}
+clean_restart ${binfile}
if { ![runto_main] } {
fail "Can't run to main"
# This file was written by Fred Fish. (fnf@cygnus.com)
# and modified by Bob Manson. (manson@cygnus.com)
-set testfile "callfuncs"
-set srcfile ${testfile}.c
-set binfile ${objdir}/${subdir}/${testfile}
+standard_testfile
set compile_flags {debug}
if [support_complex_tests] {
return -1
}
-set testfile catch-load
-set srcfile ${testfile}.c
-set binfile ${objdir}/${subdir}/${testfile}
+standard_testfile .c
if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug shlib_load}] != "" } {
untested catch-load.exp
return -1
set testfile2 catch-load-so
set srcfile2 ${testfile2}.c
-set binfile2 ${objdir}/${subdir}/${testfile2}.so
+set binfile2 [standard_output_file ${testfile2}.so]
set binfile2_dlopen [shlib_target_file ${testfile2}.so]
if { [gdb_compile_shlib "${srcdir}/${subdir}/${srcfile2}" ${binfile2} {debug}] != "" } {
untested catch-load.exp
continue
}
-global srcfile
-set testfile "catch-syscall"
-set srcfile ${testfile}.c
-set binfile ${objdir}/${subdir}/${testfile}
+standard_testfile
# All (but the last) syscalls from the example code
# They are ordered according to the file, so do not change this.
# Test GDB's character set support.
-set testfile "charset"
-set srcfile ${testfile}.c
-set srcmallocfile ${testfile}-malloc.c
-if { [prepare_for_testing ${testfile}.exp ${testfile} [list $srcfile $srcmallocfile]] } {
+standard_testfile .c charset-malloc.c
+
+if { [prepare_for_testing ${testfile}.exp ${testfile} [list $srcfile $srcfile2]] } {
return -1
}
}
-set testfile "checkpoint"
-set srcfile ${testfile}.c
-set binfile ${objdir}/${subdir}/${testfile}
+standard_testfile .c
if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } {
untested checkpoint.exp
# Start with a fresh gdb
-gdb_exit
-gdb_start
-gdb_reinitialize_dir $srcdir/$subdir
-gdb_load ${binfile}
+clean_restart ${binfile}
global gdb_prompt
# Test that GDB cleans up properly after errors that result when a
# breakpoint is reset.
-set testfile "chng-syms"
-set srcfile ${testfile}.c
-set binfile ${objdir}/${subdir}/${testfile}
+standard_testfile .c
if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug additional_flags=-DVARIABLE=var1}] != "" } {
untested chng-syms.exp
return 1
}
-gdb_exit
-gdb_start
-gdb_reinitialize_dir $srcdir/$subdir
-gdb_load ${binfile}
+clean_restart ${binfile}
gdb_test "break stop_here if (var1 == 42)" \
"Breakpoint.*at.* file .*$srcfile, line.*" \
# test running programs
#
-set testfile "cvexpr"
-set srcfile ${testfile}.c
-set binfile ${objdir}/${subdir}/${testfile}
+standard_testfile cvexpr.c
if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } {
untested code-expr.exp
return -1
}
-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"
set testfile2 code_elim2
set srcfile1 ${testfile1}.c
set srcfile2 ${testfile2}.c
-set binfile1 ${objdir}/${subdir}/${testfile1}
-set binfile2 ${objdir}/${subdir}/${testfile2}
+set binfile1 [standard_output_file ${testfile1}]
+set binfile2 [standard_output_file ${testfile2}]
set opts [list debug]
lappend opts "additional_flags=-ffunction-sections"
lappend opts "additional_flags=-fdata-sections"
# test special commands (if, while, etc)
#
+standard_testfile
+
if { [prepare_for_testing commands.exp commands run.c {debug additional_flags=-DFAKEARGV}] } {
return -1
}
# Test that GDB is able to source a file with an indented comment.
proc source_file_with_indented_comment {} {
- set fd [open "file1" w]
+ set file1 [standard_output_file file1]
+
+ set fd [open "$file1" w]
puts $fd \
{define my_fun
#indented comment
echo Done!\n}
close $fd
- gdb_test "source file1" "Done!" "source file with indented comment"
+ gdb_test "source $file1" "Done!" "source file with indented comment"
}
# Test that GDB can handle arguments when sourcing files recursively.
# If the arguments are overwritten with ####### then the test has failed.
proc recursive_source_test {} {
- set fd [open "file1" w]
+ set file1 [standard_output_file file1]
+ set file2 [standard_output_file file2]
+ set file3 [standard_output_file file3]
+
+ set fd [open "$file1" w]
puts $fd \
-{source file2
-abcdef qwerty}
+"source $file2
+abcdef qwerty"
close $fd
- set fd [open "file2" w]
+ set fd [open "$file2" w]
puts $fd \
-{define abcdef
- echo 1: <<<$arg0>>>\n
- source file3
- echo 2: <<<$arg0>>>\n
-end}
+"define abcdef
+ echo 1: <<<\$arg0>>>\\n
+ source $file3
+ echo 2: <<<\$arg0>>>\\n
+end"
close $fd
- set fd [open "file3" w]
+ set fd [open "$file3" w]
puts $fd \
"echo in file3\\n
#################################################################"
close $fd
- gdb_test "source file1" \
+ gdb_test "source $file1" \
"1: <<<qwerty>>>\[\r\n]+in file3\[\r\n]+2: <<<qwerty>>>" \
"recursive source test"
- file delete file1
- file delete file2
- file delete file3
+ file delete $file1
+ file delete $file2
+ file delete $file3
}
proc gdb_test_no_prompt { command result msg } {
# test running programs
#
-set testfile "break"
-set srcfile ${testfile}.c
-set srcfile1 ${testfile}1.c
-set binfile ${objdir}/${subdir}/${testfile}
-
-if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}0.o" object {debug nowarnings}] != "" } {
- untested completion.exp
- return -1
-}
-
-if { [gdb_compile "${srcdir}/${subdir}/${srcfile1}" "${binfile}1.o" object {debug nowarnings}] != "" } {
- untested completion.exp
- return -1
-}
-
-if { [gdb_compile "${binfile}0.o ${binfile}1.o" "${binfile}" executable {debug nowarnings}] != "" } {
- untested completion.exp
- return -1
-}
+standard_testfile break.c break1.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 \
+ [list $srcfile $srcfile2] {debug nowarnings}]} {
+ untested $testfile.exp
+ return -1
+}
if ![runto_main] then {
perror "tests suppressed"
# along with this program. If not, see <http://www.gnu.org/licenses/>.
-set testfile complex
-set srcfile ${testfile}.c
-set binfile ${objdir}/${subdir}/${testfile}
-set options debug
-
-if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable $options] != "" } {
- # No support for __complex__, presumably.
- unsupported "print complex packed value in C"
- unsupported "print complex value in C"
- return 0
-}
-
-# Start with a fresh gdb.
+standard_testfile
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
+}
if [runto f2] then {
get_debug_format
# haven't tried to compile one, or the compilation failed for some reason.
# In either case, just notify the user and skip the tests in this file.
-set testfile "int-type"
-set srcfile ${testfile}.c
-set binfile ${objdir}/${subdir}/${testfile}
+standard_testfile int-type.c
+
if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug nowarnings}] != "" } {
untested cond-expr.exp
return -1
}
-gdb_exit
-gdb_start
-gdb_reinitialize_dir $srcdir/$subdir
-gdb_load ${binfile}
+clean_restart ${binfile}
if ![runto_main] then {
# test running programs
#
-set testfile "break"
-set srcfile ${testfile}.c
-set srcfile1 ${testfile}1.c
-set binfile ${objdir}/${subdir}/${testfile}
-
-if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}0.o" object {debug nowarnings}] != "" } {
- untested condbreak.exp
- return -1
-}
-
-if { [gdb_compile "${srcdir}/${subdir}/${srcfile1}" "${binfile}1.o" object {debug nowarnings}] != "" } {
- untested condbreak.exp
- return -1
-}
+standard_testfile break.c break1.c
-if { [gdb_compile "${binfile}0.o ${binfile}1.o" "${binfile}" executable {debug nowarnings}] != "" } {
- untested condbreak.exp
- return -1
+if {[prepare_for_testing ${testfile}.exp $testfile [list $srcfile $srcfile2] \
+ {debug nowarnings}]} {
+ return -1
}
if [get_compiler_info] {
return -1
}
-gdb_exit
-gdb_start
-gdb_reinitialize_dir $srcdir/$subdir
-gdb_load ${binfile}
+clean_restart ${binfile}
set bp_location1 [gdb_get_line_number "set breakpoint 1 here"]
set bp_location6 [gdb_get_line_number "set breakpoint 6 here"]
-set bp_location8 [gdb_get_line_number "set breakpoint 8 here" $srcfile1]
-set bp_location9 [gdb_get_line_number "set breakpoint 9 here" $srcfile1]
-set bp_location13 [gdb_get_line_number "set breakpoint 13 here" $srcfile1]
-set bp_location14 [gdb_get_line_number "set breakpoint 14 here" $srcfile1]
-set bp_location15 [gdb_get_line_number "set breakpoint 15 here" $srcfile1]
-set bp_location16 [gdb_get_line_number "set breakpoint 16 here" $srcfile1]
-set bp_location17 [gdb_get_line_number "set breakpoint 17 here" $srcfile1]
-set bp_location18 [gdb_get_line_number "set breakpoint 18 here" $srcfile1]
+set bp_location8 [gdb_get_line_number "set breakpoint 8 here" $srcfile2]
+set bp_location9 [gdb_get_line_number "set breakpoint 9 here" $srcfile2]
+set bp_location13 [gdb_get_line_number "set breakpoint 13 here" $srcfile2]
+set bp_location14 [gdb_get_line_number "set breakpoint 14 here" $srcfile2]
+set bp_location15 [gdb_get_line_number "set breakpoint 15 here" $srcfile2]
+set bp_location16 [gdb_get_line_number "set breakpoint 16 here" $srcfile2]
+set bp_location17 [gdb_get_line_number "set breakpoint 17 here" $srcfile2]
+set bp_location18 [gdb_get_line_number "set breakpoint 18 here" $srcfile2]
#
# test break at function
# test conditional break at function
#
gdb_test "break marker1 if 1==1" \
- "Breakpoint.*at.* file .*$srcfile1, line.*"
+ "Breakpoint.*at.* file .*$srcfile2, line.*"
gdb_test_no_output "delete 2"
# test conditional break at function
#
gdb_test "break marker1 if (1==1)" \
- "Breakpoint.*at.* file .*$srcfile1, line.*"
+ "Breakpoint.*at.* file .*$srcfile2, line.*"
#
# test conditional break at line number
"Breakpoint.*at.* file .*$srcfile, line $bp_location1\\."
gdb_test "break marker2 if (a==43)" \
- "Breakpoint.*at.* file .*$srcfile1, line.*"
+ "Breakpoint.*at.* file .*$srcfile2, line.*"
#
# Check break involving inferior function call.
# Ensure there is at least one additional breakpoint with higher VMA.
#
gdb_test "break marker3 if (multi_line_if_conditional(1,1,1)==0)" \
- "Breakpoint.*at.* file .*$srcfile1, line.*"
+ "Breakpoint.*at.* file .*$srcfile2, line.*"
gdb_test "break marker4" \
- "Breakpoint.*at.* file .*$srcfile1, line.*"
+ "Breakpoint.*at.* file .*$srcfile2, line.*"
#
# check to see what breakpoints are set
gdb_test "info break" \
"Num Type\[ \]+Disp Enb Address\[ \]+What.*
\[0-9\]+\[\t \]+breakpoint keep y.* in main at .*$srcfile:$bp_location6.*
-\[0-9\]+\[\t \]+breakpoint keep y.* in marker1$marker1_proto at .*$srcfile1:($bp_location15|$bp_location16).*
+\[0-9\]+\[\t \]+breakpoint keep y.* in marker1$marker1_proto at .*$srcfile2:($bp_location15|$bp_location16).*
\[\t \]+stop only if \\(1==1\\).*
\[0-9\]+\[\t \]+breakpoint keep y.* in main at .*$srcfile:$bp_location1.*
\[\t \]+stop only if \\(1==1\\).*
-\[0-9\]+\[\t \]+breakpoint keep y.* in marker2$marker2_proto at .*$srcfile1:($bp_location8|$bp_location9).*
+\[0-9\]+\[\t \]+breakpoint keep y.* in marker2$marker2_proto at .*$srcfile2:($bp_location8|$bp_location9).*
\[\t \]+stop only if \\(a==43\\).*
-\[0-9\]+\[\t \]+breakpoint keep y.* in marker3$marker3_proto at .*$srcfile1:($bp_location17|$bp_location18).*
+\[0-9\]+\[\t \]+breakpoint keep y.* in marker3$marker3_proto at .*$srcfile2:($bp_location17|$bp_location18).*
\[\t \]+stop only if \\(multi_line_if_conditional\\(1,1,1\\)==0\\).*
-\[0-9\]+\[\t \]+breakpoint keep y.* in marker4$marker4_proto at .*$srcfile1:($bp_location13|$bp_location14).*" \
+\[0-9\]+\[\t \]+breakpoint keep y.* in marker4$marker4_proto at .*$srcfile2:($bp_location13|$bp_location14).*" \
"breakpoint info"
#
# Until the Dwarf2 writer gets fixed, I'm going to XFAIL its behavior.
gdb_test_multiple "continue" "run until breakpoint at marker1" {
- -re "Continuing\\..*Breakpoint \[0-9\]+, marker1 \\(\\) at .*$srcfile1:($bp_location15|$bp_location16).*($bp_location15|$bp_location16)\[\t \]+.*$gdb_prompt $" {
+ -re "Continuing\\..*Breakpoint \[0-9\]+, marker1 \\(\\) at .*$srcfile2:($bp_location15|$bp_location16).*($bp_location15|$bp_location16)\[\t \]+.*$gdb_prompt $" {
pass "run until breakpoint at marker1"
}
- -re "Continuing\\..*Breakpoint \[0-9\]+, $hex in marker1 \\(\\) at .*$srcfile1:($bp_location15|$bp_location16).*($bp_location15|$bp_location16)\[\t \]+.*$gdb_prompt $" {
+ -re "Continuing\\..*Breakpoint \[0-9\]+, $hex in marker1 \\(\\) at .*$srcfile2:($bp_location15|$bp_location16).*($bp_location15|$bp_location16)\[\t \]+.*$gdb_prompt $" {
xfail "run until breakpoint at marker1"
}
}
# Same issues here as above.
setup_xfail hppa2.0w-*-* 11512CLLbs
gdb_test_multiple "continue" "run until breakpoint at marker2" {
- -re "Continuing\\..*Breakpoint \[0-9\]+, marker2 \\(a=43\\) at .*$srcfile1:($bp_location8|$bp_location9).*($bp_location8|$bp_location9)\[\t \]+.*$gdb_prompt $" {
+ -re "Continuing\\..*Breakpoint \[0-9\]+, marker2 \\(a=43\\) at .*$srcfile2:($bp_location8|$bp_location9).*($bp_location8|$bp_location9)\[\t \]+.*$gdb_prompt $" {
pass "run until breakpoint at marker2"
}
- -re "Continuing\\..*Breakpoint \[0-9\]+, $hex in marker2 \\(a=43\\) at .*$srcfile1:($bp_location8|$bp_location9).*($bp_location8|$bp_location9)\[\t \]+.*$gdb_prompt $" {
+ -re "Continuing\\..*Breakpoint \[0-9\]+, $hex in marker2 \\(a=43\\) at .*$srcfile2:($bp_location8|$bp_location9).*($bp_location8|$bp_location9)\[\t \]+.*$gdb_prompt $" {
xfail "run until breakpoint at marker2"
}
}
set test "run until breakpoint at marker3"
gdb_test_multiple "continue" $test {
- -re "Continuing\\..*Breakpoint \[0-9\]+, marker3 \\(a=$hex \"stack\", b=$hex \"trace\"\\) at .*$srcfile1:($bp_location17|$bp_location18).*($bp_location17|$bp_location18)\[\t \]+.*$gdb_prompt $" {
+ -re "Continuing\\..*Breakpoint \[0-9\]+, marker3 \\(a=$hex \"stack\", b=$hex \"trace\"\\) at .*$srcfile2:($bp_location17|$bp_location18).*($bp_location17|$bp_location18)\[\t \]+.*$gdb_prompt $" {
pass $test
}
- -re "Continuing\\..*Breakpoint \[0-9\]+, $hex in marker3 \\(a=$hex \"stack\", b=$hex \"trace\"\\) at .*$srcfile1:($bp_location17|$bp_location18).*($bp_location17|$bp_location18)\[\t \]+.*$gdb_prompt $" {
+ -re "Continuing\\..*Breakpoint \[0-9\]+, $hex in marker3 \\(a=$hex \"stack\", b=$hex \"trace\"\\) at .*$srcfile2:($bp_location17|$bp_location18).*($bp_location17|$bp_location18)\[\t \]+.*$gdb_prompt $" {
xfail $test
}
}
set test "run until breakpoint at marker4"
gdb_test_multiple "continue" $test {
- -re "Continuing\\..*Breakpoint \[0-9\]+, marker4 \\(d=177601976\\) at .*$srcfile1:($bp_location13|$bp_location14).*($bp_location13|$bp_location14)\[\t \]+.*$gdb_prompt $" {
+ -re "Continuing\\..*Breakpoint \[0-9\]+, marker4 \\(d=177601976\\) at .*$srcfile2:($bp_location13|$bp_location14).*($bp_location13|$bp_location14)\[\t \]+.*$gdb_prompt $" {
pass $test
}
- -re "Continuing\\..*Breakpoint \[0-9\]+, $hex in marker4 \\(d=177601976\\) at .*$srcfile1:($bp_location13|$bp_location14).*($bp_location13|$bp_location14)\[\t \]+.*$gdb_prompt $" {
+ -re "Continuing\\..*Breakpoint \[0-9\]+, $hex in marker4 \\(d=177601976\\) at .*$srcfile2:($bp_location13|$bp_location14).*($bp_location13|$bp_location14)\[\t \]+.*$gdb_prompt $" {
xfail $test
}
}
#
-set testfile "consecutive"
-set srcfile ${testfile}.c
-set binfile ${objdir}/${subdir}/${testfile}
+standard_testfile
-if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug nowarnings}] != "" } {
- untested consecutive.exp
+if [get_compiler_info] {
return -1
}
-if [get_compiler_info] {
+if {[prepare_for_testing $testfile.exp $testfile $srcfile {debug nowarnings}]} {
+ untested $testfile.exp
return -1
}
-gdb_exit
-gdb_start
-gdb_reinitialize_dir $srcdir/$subdir
-gdb_load ${binfile}
-
if ![runto_main] then {
perror "couldn't run to breakpoint"
continue
# test running programs
#
-set testfile "constvars"
-set srcfile ${testfile}.c
-set binfile ${objdir}/${subdir}/${testfile}
+standard_testfile .c
# Create and source the file that provides information about the compiler
# used to compile the test case.
return -1
}
-gdb_exit
-gdb_start
-gdb_reinitialize_dir $srcdir/$subdir
-gdb_load ${binfile}
+clean_restart ${binfile}
#
return
}
-set testfile "coremaker"
-set srcfile ${testfile}.c
-set binfile ${objdir}/${subdir}/${testfile}
-if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } {
- untested corefile.exp
- return -1
-}
+standard_testfile coremaker.c
# Create and source the file that provides information about the compiler
# used to compile the test case.
return -1
}
+if {[build_executable $testfile.exp $testfile $srcfile debug] == -1} {
+ untested $testfile.exp
+ return -1
+}
+
set corefile [core_find $binfile {coremmap.data}]
if {$corefile == ""} {
return 0
#
# Another problem is that on some systems (solaris for example), there
# is apparently a limit on the length of a fully specified path to
-# the coremaker executable, at about 80 chars. For this case, consider
+# the corefile executable, at about 80 chars. For this case, consider
# it a pass, but note that the program name is bad.
gdb_exit
-re "Couldn't find .* registers in core file.*$gdb_prompt $" {
fail "args: -core=[file tail $corefile] (couldn't find regs)"
}
- -re "Core was generated by .*coremaker.*\r\n\#0 .*\(\).*\r\n$gdb_prompt $" {
+ -re "Core was generated by .*corefile.*\r\n\#0 .*\(\).*\r\n$gdb_prompt $" {
pass "args: -core=[file tail $corefile]"
}
-re "Core was generated by .*\r\n\#0 .*\(\).*\r\n$gdb_prompt $" {
eval "spawn $GDB $INTERNAL_GDBFLAGS $GDBFLAGS $binfile -core=$corefile"
expect {
- -re "Core was generated by .*coremaker.*\r\n\#0 .*\(\).*\r\n$gdb_prompt $" {
+ -re "Core was generated by .*corefile.*\r\n\#0 .*\(\).*\r\n$gdb_prompt $" {
pass "args: execfile -core=[file tail $corefile]"
}
-re "Core was generated by .*\r\n\#0 .*\(\).*\r\n$gdb_prompt $" {
send_gdb "y\n"
exp_continue
}
- -re "Core was generated by .*coremaker.*\r\n\#0 .*\(\).*\r\n$gdb_prompt $" {
+ -re "Core was generated by .*corefile.*\r\n\#0 .*\(\).*\r\n$gdb_prompt $" {
pass "core-file command"
}
-re "Core was generated by .*\r\n\#0 .*\(\).*\r\n$gdb_prompt $" {
set libsrc [list "${srcdir}/${subdir}/ctxobj-v.c" \
"${srcdir}/${subdir}/ctxobj-f.c"]
-set libobj1 "${objdir}/${subdir}/libctxobj1.so"
-set libobj2 "${objdir}/${subdir}/libctxobj2.so"
+set libobj1 [standard_output_file libctxobj1.so]
+set libobj2 [standard_output_file libctxobj2.so]
set libobj1_opts { debug additional_flags=-fPIC
additional_flags=-DVERSION=104
return -1
}
if { [gdb_compile "${srcdir}/${subdir}/${executable}.c" \
- "${objdir}/${subdir}/${executable}" \
+ [standard_output_file ${executable}] \
executable \
[list debug shlib=${libobj1} shlib=${libobj2}]]
!= ""} {
# along with this program. If not, see <http://www.gnu.org/licenses/>.
-set testfile "cursal"
-set srcfile ${testfile}.c
-set binfile ${objdir}/${subdir}/${testfile}
+standard_testfile
if {[gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != ""} {
untested "Couldn't compile $srcfile"
# test running programs
#
-set testfile "cvexpr"
-set srcfile ${testfile}.c
-set binfile ${objdir}/${subdir}/${testfile}
+standard_testfile .c
if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } {
untested cvexpr.exp
return -1
}
-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"
# along with this program. If not, see <http://www.gnu.org/licenses/>. */
-set testfile1 "average"
-set testfile2 "sum"
-set testfile "dbx-test"
-set binfile1 ${objdir}/${subdir}/${testfile1}
-set binfile2 ${objdir}/${subdir}/${testfile2}
-set binfile ${objdir}/${subdir}/${testfile}
+standard_testfile average.c sum.c
-
-
-if { [gdb_compile "${srcdir}/${subdir}/average.c" "${binfile1}.o" object {debug}] != "" } {
- untested dbx.exp
- return -1
-}
-
-if { [gdb_compile "${srcdir}/${subdir}/sum.c" "${binfile2}.o" object {debug}] != "" } {
- untested dbx.exp
- return -1
-}
-
-if { [gdb_compile "${binfile1}.o ${binfile2}.o" ${binfile} executable {debug}] != "" } {
- untested dbx.exp
- return -1
+if {[build_executable $testfile.exp $testfile \
+ [list $srcfile $srcfile2] debug] == -1} {
+ untested $testfile.exp
+ return -1
}
#
gdb_test_no_output "set history expansion" "set history expansion"
#test set history filename
gdb_test "set history filename" "Argument required .filename to set it to.*" "set history filename"
+# Make sure the history ends up in the right place.
+gdb_test_no_output "set history filename [standard_output_file .gdb_history]" \
+ "set the history filename"
#test set history save
gdb_test_no_output "set history save" "set history save"
#test set history size
# test running programs
#
-set testfile "break"
-set srcfile ${testfile}.c
-set srcfile1 ${testfile}1.c
-set binfile ${objdir}/${subdir}/${testfile}
-
-if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}0.o" object {debug nowarnings}] != "" } {
- untested define.exp
- return -1
-}
-
-if { [gdb_compile "${srcdir}/${subdir}/${srcfile1}" "${binfile}1.o" object {debug nowarnings}] != "" } {
- untested define.exp
- return -1
-}
+standard_testfile break.c break1.c
-if { [gdb_compile "${binfile}0.o ${binfile}1.o" "${binfile}" executable {debug nowarnings}] != "" } {
- untested define.exp
- return -1
+if {[prepare_for_testing ${testfile}.exp ${testfile} \
+ [list $srcfile $srcfile2] {debug nowarnings}]} {
+ return -1
}
-gdb_exit
-gdb_start
-gdb_reinitialize_dir $srcdir/$subdir
-gdb_load ${binfile}
-
set bp_location1 [gdb_get_line_number "set breakpoint 1 here"]
set bp_location11 [gdb_get_line_number "set breakpoint 11 here"]
# shortcuts of the "delete" command never stop working.
-set testfile del
-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}
-
# A function to test that ALIAS is working as a shortcut of the "delete"
# command.
return 0
}
-set testfile "attach"
-set srcfile ${testfile}.c
-set binfile ${objdir}/${subdir}/${testfile}
-set escapedbinfile [string_to_regexp ${objdir}/${subdir}/${testfile}]
+standard_testfile attach.c
+set escapedbinfile [string_to_regexp ${binfile}]
if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } {
untested detach.exp
# This file is part of the gdb testsuite. It is intended to test that
# gdb could correctly handle decimal floating point introduced in IEEE 754R.
-set testfile "dfp-test"
-set srcfile ${testfile}.c
-set binfile ${objdir}/${subdir}/${testfile}
+standard_testfile .c
# Try to compile the test case. If we can't, assume the
# toolchain does not yet provide DFP support and bail out.
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"
# display.exp Test display commands
# Also do some printing stuff for coverage's sake.
#
-set testfile display
-set srcfile ${testfile}.c
-set binfile ${objdir}/${subdir}/${testfile}
+standard_testfile
-
-
-if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug nowarnings}] != "" } {
+if {[prepare_for_testing $testfile.exp $testfile $srcfile \
+ {debug nowarnings}]} {
untested display.exp
return -1
}
# use this to debug:
#log_user 1
-gdb_exit
-gdb_start
-gdb_reinitialize_dir $srcdir/$subdir
-gdb_load ${binfile}
-
# Some coverage stuff
#
if !$use_gdb_stub {
# This is why we use gdb_compile instead of relying on the usual
# call to prepare_for_testing.
+set dmsym_o [standard_output_file dmsym.o]
+
if {[gdb_compile "${srcdir}/${subdir}/dmsym.c" \
- ${objdir}/${subdir}/dmsym.o \
+ $dmsym_o \
object {}] != ""} {
untested dmsym.exp
return -1
}
if {[gdb_compile \
- [list ${srcdir}/${subdir}/dmsym_main.c ${objdir}/${subdir}/dmsym.o] \
- ${objdir}/${subdir}/${testfile} \
+ [list ${srcdir}/${subdir}/dmsym_main.c $dmsym_o] \
+ [standard_output_file ${testfile}] \
executable {debug}] != ""} {
untested dmsym.exp
return -1
# This is a test for the gdb command "dump".
-set testfile "dump"
+standard_testfile
-set srcfile ${testfile}.c
-set binfile ${objdir}/${subdir}/${testfile}
set options {debug}
set is64bitonly "no"
return 0
}
-set testfile dup-sect
-set srcfile ${testfile}.S
+standard_testfile .S
set srcmainfile start.c
set executable ${testfile}
-set binfile ${objdir}/${subdir}/${executable}
if {[build_executable ${testfile}.exp $executable [list ${srcfile} ${srcmainfile}] {}] == -1} {
return -1