+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.
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
# 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.
# 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.
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
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
# 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.
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
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
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.
}
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
# 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
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.
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.
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]
# 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.
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"
+ }
}
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