From e89845987beaf9a448e24de213e7446a0c539b27 Mon Sep 17 00:00:00 2001 From: Tom de Vries Date: Tue, 8 Nov 2022 09:44:31 +0100 Subject: [PATCH 10/11] [gdb/testsuite] Use remote gdbserver in remote-gdbserver-on-localhost.exp Currently for the remote target remote-gdbserver-on-localhost we use the gdbserver file on build, even though it's a target executable. Fix this by using a remote copy of gdbserver instead. This allows us to be more restrictive about which files REMOTE_TARGET_USERNAME can access: ... - remote_exec build "chmod go-rx $objdir/outputs" + remote_exec build "chmod go-rx $objdir" ... Tested on x86_64-linux. --- .../boards/remote-gdbserver-on-localhost.exp | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/gdb/testsuite/boards/remote-gdbserver-on-localhost.exp b/gdb/testsuite/boards/remote-gdbserver-on-localhost.exp index f74b549f28f..ded73c67cfb 100644 --- a/gdb/testsuite/boards/remote-gdbserver-on-localhost.exp +++ b/gdb/testsuite/boards/remote-gdbserver-on-localhost.exp @@ -42,10 +42,8 @@ if { [board_info $board username] != $env(USER) } { # We're pretending that some local user account is remote target. # Make things a bit more realistic by restricting file permissions. - # Make sure remote target can't see files on build. Note that we're - # currently using $objdir/output instead of $objdir because of gdbserver - # being accessed on the target using $objdir/../../gdbserver/gdbserver. - remote_exec build "chmod go-rx $objdir/outputs" + # Make sure remote target can't see files on build. + remote_exec build "chmod go-rx $objdir" # Make sure build can't see files on remote target. We can't use # remote_exec target, because we're in the middle of parsing the @@ -57,6 +55,11 @@ if { [board_info $board username] != $env(USER) } { chmod go-rx ." } +set gdb_server_prog [board_info $board gdb_server_prog] +set gdb_server_prog [remote_download $board $gdb_server_prog] +unset_board_info gdb_server_prog +set_board_info gdb_server_prog $gdb_server_prog +unset gdb_server_prog proc ${board}_spawn { board cmd } { global board_info -- 2.35.3