diff options
-rw-r--r-- | gdb/testsuite/ChangeLog | 21 | ||||
-rw-r--r-- | gdb/testsuite/gdb.server/abspath.exp | 13 | ||||
-rw-r--r-- | gdb/testsuite/gdb.server/connect-without-multi-process.exp | 12 | ||||
-rw-r--r-- | gdb/testsuite/gdb.server/exit-multiple-threads.exp | 12 | ||||
-rw-r--r-- | gdb/testsuite/gdb.server/ext-attach.exp | 12 | ||||
-rw-r--r-- | gdb/testsuite/gdb.server/ext-restart.exp | 12 | ||||
-rw-r--r-- | gdb/testsuite/gdb.server/ext-run.exp | 10 | ||||
-rw-r--r-- | gdb/testsuite/gdb.server/ext-wrapper.exp | 12 | ||||
-rw-r--r-- | gdb/testsuite/gdb.server/multi-ui-errors.exp | 12 | ||||
-rw-r--r-- | gdb/testsuite/gdb.server/no-thread-db.exp | 10 | ||||
-rw-r--r-- | gdb/testsuite/gdb.server/reconnect-ctrl-c.exp | 13 | ||||
-rw-r--r-- | gdb/testsuite/gdb.server/run-without-local-binary.exp | 7 | ||||
-rw-r--r-- | gdb/testsuite/gdb.server/server-kill.exp | 11 | ||||
-rw-r--r-- | gdb/testsuite/gdb.server/server-run.exp | 10 | ||||
-rw-r--r-- | gdb/testsuite/gdb.server/solib-list.exp | 11 | ||||
-rw-r--r-- | gdb/testsuite/gdb.server/stop-reply-no-thread.exp | 12 | ||||
-rw-r--r-- | gdb/testsuite/gdb.server/sysroot.exp | 54 | ||||
-rw-r--r-- | gdb/testsuite/gdb.server/wrapper.exp | 12 |
18 files changed, 208 insertions, 48 deletions
diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog index ac4b6e1..44afe36 100644 --- a/gdb/testsuite/ChangeLog +++ b/gdb/testsuite/ChangeLog @@ -1,5 +1,26 @@ 2021-01-04 Simon Marchi <simon.marchi@efficios.com> + * gdb.server/abspath.exp: Append "set sysroot" to GDBFLAGS. + * gdb.server/connect-without-multi-process.exp: Likewise. + * gdb.server/exit-multiple-threads.exp: Likewise. + * gdb.server/ext-attach.exp: Likewise. + * gdb.server/ext-restart.exp: Likewise. + * gdb.server/ext-run.exp: Likewise. + * gdb.server/ext-wrapper.exp: Likewise. + * gdb.server/multi-ui-errors.exp: Likewise. + * gdb.server/no-thread-db.exp: Likewise. + * gdb.server/reconnect-ctrl-c.exp: Likewise. + * gdb.server/run-without-local-binary.exp: Likewise. + * gdb.server/server-kill.exp: Likewise. + * gdb.server/server-run.exp: Likewise. + * gdb.server/solib-list.exp: Likewise. + * gdb.server/stop-reply-no-thread.exp: Likewise. + * gdb.server/wrapper.exp: Likewise. + * gdb.server/sysroot.exp: Increase timeout when testing the + target: sysroot. + +2021-01-04 Simon Marchi <simon.marchi@efficios.com> + * gdb.server/server-run.exp: Use clean_restart. 2021-01-04 Simon Marchi <simon.marchi@efficios.com> diff --git a/gdb/testsuite/gdb.server/abspath.exp b/gdb/testsuite/gdb.server/abspath.exp index f14bd90..1ccdbe7 100644 --- a/gdb/testsuite/gdb.server/abspath.exp +++ b/gdb/testsuite/gdb.server/abspath.exp @@ -33,8 +33,17 @@ if { [is_remote target] } { return 0 } -if { [prepare_for_testing "failed to prepare" $testfile $srcfile debug] } { - return -1 +save_vars { GDBFLAGS } { + # If GDB and GDBserver are both running locally, set the sysroot to avoid + # reading files via the remote protocol (the `is_remote target` check is + # already done above). + if { ![is_remote host] } { + set GDBFLAGS "$GDBFLAGS -ex \"set sysroot\"" + } + + if { [prepare_for_testing "failed to prepare" $testfile $srcfile debug] } { + return -1 + } } # Make sure we're disconnected, in case we're testing with an diff --git a/gdb/testsuite/gdb.server/connect-without-multi-process.exp b/gdb/testsuite/gdb.server/connect-without-multi-process.exp index c36bd9b..9c03d12 100644 --- a/gdb/testsuite/gdb.server/connect-without-multi-process.exp +++ b/gdb/testsuite/gdb.server/connect-without-multi-process.exp @@ -31,9 +31,17 @@ if {[build_executable "failed to prepare" $testfile $srcfile debug]} { # Test spawning gdbserver with a program, connect to it and run to # main, with both multiprocess extensions on and off. proc do_test {multiprocess} { - global binfile + global binfile GDBFLAGS - clean_restart $binfile + save_vars { GDBFLAGS } { + # If GDB and GDBserver are both running locally, set the sysroot to avoid + # reading files via the remote protocol. + if { ![is_remote host] && ![is_remote target] } { + set GDBFLAGS "$GDBFLAGS -ex \"set sysroot\"" + } + + clean_restart $binfile + } # Make sure we're disconnected, in case we're testing with an # extended-remote board, therefore already connected. diff --git a/gdb/testsuite/gdb.server/exit-multiple-threads.exp b/gdb/testsuite/gdb.server/exit-multiple-threads.exp index c0db6e9..a74f7d1 100644 --- a/gdb/testsuite/gdb.server/exit-multiple-threads.exp +++ b/gdb/testsuite/gdb.server/exit-multiple-threads.exp @@ -39,7 +39,17 @@ standard_testfile # Places a breakpoint in function 'breakpt' and then continues to the # breakpoint, at which point it runs 'info threads'. proc prepare_for_test { executable disable_multi_process } { - clean_restart ${executable} + global GDBFLAGS + + save_vars { GDBFLAGS } { + # If GDB and GDBserver are both running locally, set the sysroot to avoid + # reading files via the remote protocol. + if { ![is_remote host] && ![is_remote target] } { + set GDBFLAGS "$GDBFLAGS -ex \"set sysroot\"" + } + + clean_restart ${executable} + } # Make sure we're disconnected, in case we're testing with an # extended-remote board, therefore already connected. diff --git a/gdb/testsuite/gdb.server/ext-attach.exp b/gdb/testsuite/gdb.server/ext-attach.exp index 9469517..c9766e3 100644 --- a/gdb/testsuite/gdb.server/ext-attach.exp +++ b/gdb/testsuite/gdb.server/ext-attach.exp @@ -30,8 +30,16 @@ if {![can_spawn_for_attach]} { return 0 } -if {[prepare_for_testing "failed to prepare" $testfile $srcfile debug]} { - return -1 +save_vars { GDBFLAGS } { + # If GDB and GDBserver are both running locally, set the sysroot to avoid + # reading files via the remote protocol. + if { ![is_remote host] && ![is_remote target] } { + set GDBFLAGS "$GDBFLAGS -ex \"set sysroot\"" + } + + if {[prepare_for_testing "failed to prepare" $testfile $srcfile debug]} { + return -1 + } } # Make sure we're disconnected, in case we're testing with an diff --git a/gdb/testsuite/gdb.server/ext-restart.exp b/gdb/testsuite/gdb.server/ext-restart.exp index 33b1340..8b175e7 100644 --- a/gdb/testsuite/gdb.server/ext-restart.exp +++ b/gdb/testsuite/gdb.server/ext-restart.exp @@ -25,8 +25,16 @@ if { [skip_gdbserver_tests] } { return 0 } -if { [prepare_for_testing "failed to prepare" $testfile $srcfile debug] } { - return -1 +save_vars { GDBFLAGS } { + # If GDB and GDBserver are both running locally, set the sysroot to avoid + # reading files via the remote protocol. + if { ![is_remote host] && ![is_remote target] } { + set GDBFLAGS "$GDBFLAGS -ex \"set sysroot\"" + } + + if { [prepare_for_testing "failed to prepare" $testfile $srcfile debug] } { + return -1 + } } # Make sure we're disconnected, in case we're testing with an diff --git a/gdb/testsuite/gdb.server/ext-run.exp b/gdb/testsuite/gdb.server/ext-run.exp index 92aef14..268f690 100644 --- a/gdb/testsuite/gdb.server/ext-run.exp +++ b/gdb/testsuite/gdb.server/ext-run.exp @@ -32,7 +32,15 @@ if {[build_executable $testfile.exp $testfile $srcfile debug] == -1} { # gdb_skip_xml_test must be called while gdb is not running. set do_xml_test [expr ![gdb_skip_xml_test]] -clean_restart $binfile +save_vars { GDBFLAGS } { + # If GDB and GDBserver are both running locally, set the sysroot to avoid + # reading files via the remote protocol. + if { ![is_remote host] && ![is_remote target] } { + set GDBFLAGS "$GDBFLAGS -ex \"set sysroot\"" + } + + clean_restart $binfile +} # Make sure we're disconnected, in case we're testing with an # extended-remote board, therefore already connected. diff --git a/gdb/testsuite/gdb.server/ext-wrapper.exp b/gdb/testsuite/gdb.server/ext-wrapper.exp index c6e7786..fc9a77f 100644 --- a/gdb/testsuite/gdb.server/ext-wrapper.exp +++ b/gdb/testsuite/gdb.server/ext-wrapper.exp @@ -27,8 +27,16 @@ if {[build_executable $testfile.exp $testfile $srcfile debug] == -1} { return -1 } -if {[prepare_for_testing "failed to prepare" $testfile $srcfile debug]} { - return -1 +save_vars { GDBFLAGS } { + # If GDB and GDBserver are both running locally, set the sysroot to avoid + # reading files via the remote protocol. + if { ![is_remote host] && ![is_remote target] } { + set GDBFLAGS "$GDBFLAGS -ex \"set sysroot\"" + } + + if {[prepare_for_testing "failed to prepare" $testfile $srcfile debug]} { + return -1 + } } # Make sure we're disconnected, in case we're testing with an diff --git a/gdb/testsuite/gdb.server/multi-ui-errors.exp b/gdb/testsuite/gdb.server/multi-ui-errors.exp index b89defc..073192f 100644 --- a/gdb/testsuite/gdb.server/multi-ui-errors.exp +++ b/gdb/testsuite/gdb.server/multi-ui-errors.exp @@ -28,8 +28,16 @@ if {[skip_gdbserver_tests]} { return 0 } -if {[prepare_for_testing "failed to prepare" ${testfile} ${srcfile}]} { - return -1 +save_vars { GDBFLAGS } { + # If GDB and GDBserver are both running locally, set the sysroot to avoid + # reading files via the remote protocol. + if { ![is_remote host] && ![is_remote target] } { + set GDBFLAGS "$GDBFLAGS -ex \"set sysroot\"" + } + + if {[prepare_for_testing "failed to prepare" ${testfile} ${srcfile}]} { + return -1 + } } # Make sure we're disconnected, in case we're testing with an diff --git a/gdb/testsuite/gdb.server/no-thread-db.exp b/gdb/testsuite/gdb.server/no-thread-db.exp index 5dbb654..19ec89a 100644 --- a/gdb/testsuite/gdb.server/no-thread-db.exp +++ b/gdb/testsuite/gdb.server/no-thread-db.exp @@ -33,7 +33,15 @@ if {[gdb_compile_pthreads "${srcdir}/${subdir}/${srcfile}" "${binfile}" executab return -1 } -clean_restart ${testfile} +save_vars { GDBFLAGS } { + # If GDB and GDBserver are both running locally, set the sysroot to avoid + # reading files via the remote protocol. + if { ![is_remote host] && ![is_remote target] } { + set GDBFLAGS "$GDBFLAGS -ex \"set sysroot\"" + } + + clean_restart ${testfile} +} # Make sure we're disconnected, in case we're testing with an # extended-remote board, therefore already connected. diff --git a/gdb/testsuite/gdb.server/reconnect-ctrl-c.exp b/gdb/testsuite/gdb.server/reconnect-ctrl-c.exp index 9b5b7a8..11aa514 100644 --- a/gdb/testsuite/gdb.server/reconnect-ctrl-c.exp +++ b/gdb/testsuite/gdb.server/reconnect-ctrl-c.exp @@ -30,8 +30,17 @@ if [target_info exists gdb,nointerrupts] { } standard_testfile -if [prepare_for_testing "failed to prepare" $testfile $srcfile] { - return -1 + +save_vars { GDBFLAGS } { + # If GDB and GDBserver are both running locally, set the sysroot to avoid + # reading files via the remote protocol. + if { ![is_remote host] && ![is_remote target] } { + set GDBFLAGS "$GDBFLAGS -ex \"set sysroot\"" + } + + if [prepare_for_testing "failed to prepare" $testfile $srcfile] { + return -1 + } } # Make sure we're disconnected, in case we're testing with an diff --git a/gdb/testsuite/gdb.server/run-without-local-binary.exp b/gdb/testsuite/gdb.server/run-without-local-binary.exp index 6bbdca2..395eddc 100644 --- a/gdb/testsuite/gdb.server/run-without-local-binary.exp +++ b/gdb/testsuite/gdb.server/run-without-local-binary.exp @@ -31,6 +31,13 @@ if {[prepare_for_testing "failed to prepare" $testfile $srcfile debug]} { # remote/21852. save_vars { GDBFLAGS } { set GDBFLAGS "" + + # If GDB and GDBserver are both running locally, set the sysroot to avoid + # reading files via the remote protocol. + if { ![is_remote host] && ![is_remote target] } { + set GDBFLAGS "-ex \"set sysroot\"" + } + gdb_exit gdb_start diff --git a/gdb/testsuite/gdb.server/server-kill.exp b/gdb/testsuite/gdb.server/server-kill.exp index ab82072..80d78f8 100644 --- a/gdb/testsuite/gdb.server/server-kill.exp +++ b/gdb/testsuite/gdb.server/server-kill.exp @@ -36,8 +36,17 @@ if { [build_executable "failed to prepare" ${testfile}] } { proc prepare {} { global binfile gdb_prompt srcfile decimal global server_pid + global GDBFLAGS - clean_restart $binfile + save_vars { GDBFLAGS } { + # If GDB and GDBserver are both running locally, set the sysroot to avoid + # reading files via the remote protocol. + if { ![is_remote host] && ![is_remote target] } { + set GDBFLAGS "$GDBFLAGS -ex \"set sysroot\"" + } + + clean_restart $binfile + } # Make sure we're disconnected, in case we're testing with an # extended-remote board, therefore already connected. diff --git a/gdb/testsuite/gdb.server/server-run.exp b/gdb/testsuite/gdb.server/server-run.exp index 72ba02c..e680ef5 100644 --- a/gdb/testsuite/gdb.server/server-run.exp +++ b/gdb/testsuite/gdb.server/server-run.exp @@ -29,7 +29,15 @@ if {[build_executable $testfile.exp $testfile $srcfile debug] == -1} { return -1 } -clean_restart $binfile +save_vars { GDBFLAGS } { + # If GDB and GDBserver are both running locally, set the sysroot to avoid + # reading files via the remote protocol. + if { ![is_remote host] && ![is_remote target] } { + set GDBFLAGS "$GDBFLAGS -ex \"set sysroot\"" + } + + clean_restart $binfile +} # Make sure we're disconnected, in case we're testing with an # extended-remote board, therefore already connected. diff --git a/gdb/testsuite/gdb.server/solib-list.exp b/gdb/testsuite/gdb.server/solib-list.exp index c4934ed..3a8c739 100644 --- a/gdb/testsuite/gdb.server/solib-list.exp +++ b/gdb/testsuite/gdb.server/solib-list.exp @@ -42,7 +42,16 @@ set interp_system [section_get ${binfile} .interp] verbose -log "system interpreter is: $interp_system" foreach nonstop { 0 1 } { with_test_prefix "non-stop $nonstop" { - clean_restart + save_vars { GDBFLAGS } { + # If GDB and GDBserver are both running locally, set the sysroot to avoid + # reading files via the remote protocol. + if { ![is_remote host] && ![is_remote target] } { + set GDBFLAGS "$GDBFLAGS -ex \"set sysroot\"" + } + + clean_restart + } + gdb_load_shlib ${binlibfile} set remote_binfile [gdb_remote_download target $binfile] diff --git a/gdb/testsuite/gdb.server/stop-reply-no-thread.exp b/gdb/testsuite/gdb.server/stop-reply-no-thread.exp index 5e93b47..68bf42a 100644 --- a/gdb/testsuite/gdb.server/stop-reply-no-thread.exp +++ b/gdb/testsuite/gdb.server/stop-reply-no-thread.exp @@ -34,9 +34,17 @@ if { [build_executable "failed to prepare" $testfile $srcfile] == -1 } { # Run the tests with different features of GDBserver disabled. proc run_test { disable_feature target_nonstop } { - global binfile gdb_prompt decimal + global binfile gdb_prompt decimal GDBFLAGS - clean_restart ${binfile} + save_vars { GDBFLAGS } { + # If GDB and GDBserver are both running locally, set the sysroot to avoid + # reading files via the remote protocol. + if { ![is_remote host] && ![is_remote target] } { + set GDBFLAGS "$GDBFLAGS -ex \"set sysroot\"" + } + + clean_restart ${binfile} + } # Make sure we're disconnected, in case we're testing with an # extended-remote board, therefore already connected. diff --git a/gdb/testsuite/gdb.server/sysroot.exp b/gdb/testsuite/gdb.server/sysroot.exp index 158b7c5..5aea60a 100644 --- a/gdb/testsuite/gdb.server/sysroot.exp +++ b/gdb/testsuite/gdb.server/sysroot.exp @@ -40,39 +40,45 @@ foreach_with_prefix sysroot { "local" "remote" } { if { $sysroot == "local" } { set sysroot_command "/" set reading_symbols "Reading symbols from $binfile..." + set timeout_factor 1 } else { set sysroot_command "target:" set reading_symbols "Reading $binfile from remote target..." + set timeout_factor 5 } - # Restart GDB. - clean_restart + # Reading debug info from the remote target can take a bit of time, so + # increase the timeout in that case. + with_timeout_factor $timeout_factor { + # Restart GDB. + clean_restart - # Make sure we're disconnected, in case we're testing with an - # extended-remote board, therefore already connected. - gdb_test "disconnect" ".*" + # Make sure we're disconnected, in case we're testing with an + # extended-remote board, therefore already connected. + gdb_test "disconnect" ".*" - # Start GDBserver. - set res [gdbserver_start "" $binfile] - set gdbserver_protocol [lindex $res 0] - set gdbserver_gdbport [lindex $res 1] + # Start GDBserver. + set res [gdbserver_start "" $binfile] + set gdbserver_protocol [lindex $res 0] + set gdbserver_gdbport [lindex $res 1] - # Set the sysroot. - gdb_test_no_output "set sysroot $sysroot_command" + # Set the sysroot. + gdb_test_no_output "set sysroot $sysroot_command" - # Connect to gdbserver, making sure GDB reads in the binary correctly. - set test "connect to remote and read binary" - if {[gdb_target_cmd $gdbserver_protocol $gdbserver_gdbport $reading_symbols] == 0} { - pass $test - } else { - fail $test - } + # Connect to gdbserver, making sure GDB reads in the binary correctly. + set test "connect to remote and read binary" + if {[gdb_target_cmd $gdbserver_protocol $gdbserver_gdbport $reading_symbols] == 0} { + pass $test + } else { + fail $test + } - gdb_breakpoint main - gdb_test "continue" "Breakpoint $decimal.* main.*" "continue to main" + gdb_breakpoint main + gdb_test "continue" "Breakpoint $decimal.* main.*" "continue to main" - # Test that we can stop inside a library. - gdb_breakpoint printf - gdb_test "continue" "Breakpoint $decimal.* (__)?printf .*" \ - "continue to printf" + # Test that we can stop inside a library. + gdb_breakpoint printf + gdb_test "continue" "Breakpoint $decimal.* (__)?printf .*" \ + "continue to printf" + } } diff --git a/gdb/testsuite/gdb.server/wrapper.exp b/gdb/testsuite/gdb.server/wrapper.exp index 695deea..27d37ba 100644 --- a/gdb/testsuite/gdb.server/wrapper.exp +++ b/gdb/testsuite/gdb.server/wrapper.exp @@ -31,8 +31,16 @@ if { [istarget *-*-mingw*] return -1 } -if { [prepare_for_testing "failed to prepare" $testfile $srcfile debug] } { - return -1 +save_vars { GDBFLAGS } { + # If GDB and GDBserver are both running locally, set the sysroot to avoid + # reading files via the remote protocol. + if { ![is_remote host] && ![is_remote target] } { + set GDBFLAGS "$GDBFLAGS -ex \"set sysroot\"" + } + + if { [prepare_for_testing "failed to prepare" $testfile $srcfile debug] } { + return -1 + } } # Make sure we're disconnected, in case we're testing with an |