diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog index 622fd587e7..1eeeeb29e7 100644 --- a/gdb/testsuite/ChangeLog +++ b/gdb/testsuite/ChangeLog @@ -1,3 +1,14 @@ +2011-07-26 Ulrich Weigand + + * gdb.python/py-mi.exp: Avoid '+' in filenames. Call C version of + executable file "${binfile}", C++ version "${binfile}-cxx". + * gdb.python/py-prettyprint.exp: Likewise. + * gdb.python/py-symbol.exp: Likewise. + * gdb.python/py-type.exp: Likewise. + * gdb.python/py-value.exp: Likewise. + * gdb.python/py-template.exp (test_template_arg): Pass full executable + file name instead of just suffix. + 2011-07-25 Jan Kratochvil Fix implicit pointer offsets. diff --git a/gdb/testsuite/gdb.python/py-mi.exp b/gdb/testsuite/gdb.python/py-mi.exp index 749cb93083..b232fc3c72 100644 --- a/gdb/testsuite/gdb.python/py-mi.exp +++ b/gdb/testsuite/gdb.python/py-mi.exp @@ -286,7 +286,7 @@ mi_list_varobj_children nstype2 { # C++ MI tests gdb_exit -if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}-c++" \ +if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}-cxx" \ executable {debug c++ additional_flags=-DMI}] != "" } { untested "Couldn't compile ${srcfile} in c++ mode" return -1 @@ -297,7 +297,7 @@ if [mi_gdb_start] { } mi_delete_breakpoints mi_gdb_reinitialize_dir $srcdir/$subdir -mi_gdb_load ${binfile}-c++ +mi_gdb_load ${binfile}-cxx if {[lsearch -exact [mi_get_features] python] < 0} { unsupported "python support is disabled" diff --git a/gdb/testsuite/gdb.python/py-prettyprint.exp b/gdb/testsuite/gdb.python/py-prettyprint.exp index f3a5e5e924..b0e7d627d1 100644 --- a/gdb/testsuite/gdb.python/py-prettyprint.exp +++ b/gdb/testsuite/gdb.python/py-prettyprint.exp @@ -33,9 +33,9 @@ gdb_start # Skip all tests if Python scripting is not enabled. if { [skip_python_tests] } { continue } -proc run_lang_tests {lang} { - global srcdir subdir srcfile binfile testfile hex - if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}-${lang}" executable "debug $lang"] != "" } { +proc run_lang_tests {exefile lang} { + global srcdir subdir srcfile testfile hex + if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${exefile}" executable "debug $lang"] != "" } { untested "Couldn't compile ${srcfile} in $lang mode" return -1 } @@ -46,7 +46,7 @@ proc run_lang_tests {lang} { gdb_exit gdb_start gdb_reinitialize_dir $srcdir/$subdir - gdb_load ${binfile}-${lang} + gdb_load ${exefile} if ![runto_main ] then { perror "couldn't run to breakpoint" @@ -113,16 +113,11 @@ proc run_lang_tests {lang} { remote_file host delete ${remote_python_file} } -run_lang_tests "c" -run_lang_tests "c++" +run_lang_tests "${binfile}" "c" +run_lang_tests "${binfile}-cxx" "c++" # Run various other tests. -if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable "debug"] != "" } { - untested "Couldn't compile ${srcfile}" - return -1 -} - # Start with a fresh gdb. gdb_exit gdb_start diff --git a/gdb/testsuite/gdb.python/py-symbol.exp b/gdb/testsuite/gdb.python/py-symbol.exp index 2feff6a250..09d6bf027d 100644 --- a/gdb/testsuite/gdb.python/py-symbol.exp +++ b/gdb/testsuite/gdb.python/py-symbol.exp @@ -99,7 +99,7 @@ gdb_test "python print t\[0\].symtab" "gdb.python/py-symbol.c.*" "Get symtab" # C++ tests # Recompile binary. - if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}-c++" executable "debug c++"] != "" } { + if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}-cxx" executable "debug c++"] != "" } { untested "Couldn't compile ${srcfile} in c++ mode" return -1 } @@ -108,7 +108,7 @@ gdb_test "python print t\[0\].symtab" "gdb.python/py-symbol.c.*" "Get symtab" gdb_exit gdb_start gdb_reinitialize_dir $srcdir/$subdir -gdb_load ${binfile}-c++ +gdb_load ${binfile}-cxx if ![runto_main] then { fail "Can't run to main" diff --git a/gdb/testsuite/gdb.python/py-template.exp b/gdb/testsuite/gdb.python/py-template.exp index ab49ca95f8..ef93f8cbbb 100644 --- a/gdb/testsuite/gdb.python/py-template.exp +++ b/gdb/testsuite/gdb.python/py-template.exp @@ -40,15 +40,15 @@ gdb_reinitialize_dir $srcdir/$subdir # Skip all tests if Python scripting is not enabled. if { [skip_python_tests] } { continue } -proc test_template_arg {name type} { - global testfile srcdir subdir srcfile binfile - if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}-${name}" \ +proc test_template_arg {exefile type} { + global testfile srcdir subdir srcfile + if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${exefile}" \ executable \ [list debug c++ additional_flags="-DTYPE=$type"]] != "" } { untested $type return -1 } - gdb_load ${binfile}-${name} + gdb_load ${exefile} if ![runto_main ] then { perror "couldn't run to breakpoint" return @@ -62,11 +62,11 @@ proc test_template_arg {name type} { gdb_test "python print foo.type.template_argument(0)" $t $type } -test_template_arg "ci" "const int" -test_template_arg "vi" "volatile int" -test_template_arg "cir" "const int &" -test_template_arg "vir" "volatile int &" -test_template_arg "vipc" "volatile int * const" -test_template_arg "vipcp" "volatile int * const *" -test_template_arg "cipv" "const int * volatile" -test_template_arg "cipvpcpvp" "const int * volatile * const * volatile *" +test_template_arg "${binfile}-ci" "const int" +test_template_arg "${binfile}-vi" "volatile int" +test_template_arg "${binfile}-cir" "const int &" +test_template_arg "${binfile}-vir" "volatile int &" +test_template_arg "${binfile}-vipc" "volatile int * const" +test_template_arg "${binfile}-vipcp" "volatile int * const *" +test_template_arg "${binfile}-cipv" "const int * volatile" +test_template_arg "${binfile}-cipvpcpvp" "const int * volatile * const * volatile *" diff --git a/gdb/testsuite/gdb.python/py-type.exp b/gdb/testsuite/gdb.python/py-type.exp index 41d4594492..f7437d8459 100644 --- a/gdb/testsuite/gdb.python/py-type.exp +++ b/gdb/testsuite/gdb.python/py-type.exp @@ -31,23 +31,23 @@ if [get_compiler_info not-used c++] { } # Build inferior to language specification. -proc build_inferior {lang} { - global srcdir subdir srcfile binfile testfile hex +proc build_inferior {exefile lang} { + global srcdir subdir srcfile testfile hex - if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}-${lang}" executable "debug $lang"] != "" } { + if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${exefile}" executable "debug $lang"] != "" } { untested "Couldn't compile ${srcfile} in $lang mode" return -1 } } # Restart GDB. -proc restart_gdb {lang} { - global srcdir subdir srcfile binfile testfile hex +proc restart_gdb {exefile} { + global srcdir subdir srcfile testfile hex gdb_exit gdb_start gdb_reinitialize_dir $srcdir/$subdir - gdb_load ${binfile}-${lang} + gdb_load ${exefile} if ![runto_main ] then { perror "couldn't run to breakpoint" @@ -161,8 +161,8 @@ proc test_template {} { } # Perform C Tests. -build_inferior "c" -restart_gdb "c" +build_inferior "${binfile}" "c" +restart_gdb "${binfile}" # Skip all tests if Python scripting is not enabled. if { [skip_python_tests] } { continue } @@ -171,8 +171,8 @@ runto_bp "break to inspect struct and array." test_fields "c" # Perform C++ Tests. -build_inferior "c++" -restart_gdb "c++" +build_inferior "${binfile}-cxx" "c++" +restart_gdb "${binfile}-cxx" runto_bp "break to inspect struct and array." test_fields "c++" test_base_class diff --git a/gdb/testsuite/gdb.python/py-value.exp b/gdb/testsuite/gdb.python/py-value.exp index cd8b9a5d4e..bb9bed5440 100644 --- a/gdb/testsuite/gdb.python/py-value.exp +++ b/gdb/testsuite/gdb.python/py-value.exp @@ -25,9 +25,15 @@ load_lib gdb-python.exp set testfile "py-value" set srcfile ${testfile}.c set binfile ${objdir}/${subdir}/${testfile} -if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } { - untested "Couldn't compile ${srcfile}" - return -1 + +# Build inferior to language specification. +proc build_inferior {exefile lang} { + global srcdir subdir srcfile testfile hex + + if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${exefile}" executable "debug $lang"] != "" } { + untested "Couldn't compile ${srcfile} in $lang mode" + return -1 + } } proc test_value_creation {} { @@ -323,19 +329,15 @@ proc test_value_after_death {} { # the type of the value was not being checked before allowing a # subscript operation to proceed. -proc test_subscript_regression {lang} { +proc test_subscript_regression {exefile lang} { - global srcdir subdir srcfile binfile testfile hex - if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}-${lang}" executable "debug $lang"] != "" } { - untested "Couldn't compile ${srcfile} in $lang mode" - return -1 - } + global srcdir subdir # Start with a fresh gdb. gdb_exit gdb_start gdb_reinitialize_dir $srcdir/$subdir - gdb_load ${binfile}-${lang} + gdb_load ${exefile} if ![runto_main ] then { perror "couldn't run to breakpoint" @@ -426,6 +428,9 @@ proc test_value_hash {} { gdb_test "python print one.__hash__() == hash(one)" "True" "Test inbuilt hash" } +# Build C and C++ versions of executable +build_inferior "${binfile}" "c" +build_inferior "${binfile}-cxx" "c++" # Start with a fresh gdb. @@ -457,7 +462,6 @@ test_inferior_function_call test_lazy_strings test_value_after_death -# The following test recompiles the binary to test either C or C++ -# values. -test_subscript_regression "c++" -test_subscript_regression "c" +# Test either C or C++ values. +test_subscript_regression "${binfile}" "c" +test_subscript_regression "${binfile}-cxx" "c++"