gdb/testsuite: respect GDBSERVER variable in remote-stdio-gdbserver "board"
authorJan Vrany <jan.vrany@labware.com>
Fri, 10 Dec 2021 11:43:20 +0000 (11:43 +0000)
committerJan Vrany <jan.vrany@labware.com>
Fri, 10 Dec 2021 11:43:20 +0000 (11:43 +0000)
The comment on top of gdb/testsuite/boards/remote-stdio-gdbserver.exp says
that user can specify path to gdbserver on remote system by setting
GDBSERVER variable. However, this variable was ignored and /usr/bin/gdbserver
was used unconditionally.

This commit updates the code to respect GDBSERVER if set and fall back to
/usr/bin/gdbserver if not.

gdb/testsuite/boards/remote-stdio-gdbserver.exp

index 79a0e9803d7c613b28a100c5895db3a2793b9469..9fc4e2d5ce544140bb8794cf6e26002ad7e806ce 100644 (file)
@@ -56,6 +56,13 @@ if [info exists REMOTE_TMPDIR] {
     set_board_info remotedir $REMOTE_TMPDIR
 }
 
+unset_board_info gdb_server_prog
+if [info exists GDBSERVER] {
+    set_board_info gdb_server_prog $GDBSERVER
+} else {
+    set_board_info gdb_server_prog /usr/bin/gdbserver
+}
+
 proc get_remote_login { } {
     set result ""
     if {[board_info [target_info name] exists username]} {
@@ -70,7 +77,8 @@ proc get_remote_login { } {
 proc get_target_remote_pipe_cmd { } {
     set target_exec [gdbserver_download_current_prog]
     set rsh_cmd "[board_info [target_info name] rsh_prog] [get_remote_login]"
-    return "$rsh_cmd /usr/bin/gdbserver --once stdio $target_exec"
+    set gdbserver "[board_info [target_info name] gdb_server_prog]"
+    return "$rsh_cmd $gdbserver --once stdio $target_exec"
 }
 
 proc ${board}_file { dest op args } {