From patchwork Thu Mar 9 09:45:39 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom de Vries X-Patchwork-Id: 66156 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 8D547385086F for ; Thu, 9 Mar 2023 09:45:59 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 8D547385086F DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1678355159; bh=FmCOEt99Rmznt3d6RRsP9suklz7ge32wZknha4/dHyQ=; h=To:Subject:Date:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=sgABfTPyW7DgR5CTC/6K7inoOB0CzmguLbiiLnjARFlBg9r28+jzQkdIO0K9vINwv FIUtnyxPlToDegoMY22Ih9okFc3Puxm0Ief1xNGTMf7qYc0fNjoeQuK72MWOVxwxKg FEd98jct6tvTXvGPvvwaoAE+yu8VN7XBRWXZaR9g= X-Original-To: gdb-patches@sourceware.org Delivered-To: gdb-patches@sourceware.org Received: from smtp-out1.suse.de (smtp-out1.suse.de [IPv6:2001:67c:2178:6::1c]) by sourceware.org (Postfix) with ESMTPS id B00F03858C3A for ; Thu, 9 Mar 2023 09:45:35 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org B00F03858C3A Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id E839521DA8 for ; Thu, 9 Mar 2023 09:45:34 +0000 (UTC) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id D40941391B for ; Thu, 9 Mar 2023 09:45:34 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id rLdzMr6qCWS8FwAAMHmgww (envelope-from ) for ; Thu, 09 Mar 2023 09:45:34 +0000 To: gdb-patches@sourceware.org Subject: [PATCH 1/7] [gdb/testsuite] Fix gdb.server/connect-with-no-symbol-file.exp for remote target Date: Thu, 9 Mar 2023 10:45:39 +0100 Message-Id: <20230309094545.4537-1-tdevries@suse.de> X-Mailer: git-send-email 2.35.3 MIME-Version: 1.0 X-Spam-Status: No, score=-12.4 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Tom de Vries via Gdb-patches From: Tom de Vries Reply-To: Tom de Vries Errors-To: gdb-patches-bounces+patchwork=sourceware.org@sourceware.org Sender: "Gdb-patches" Test-case gdb.server/connect-with-no-symbol-file.exp fails with target board remote-gdbserver-on-localhost. The problem is here: ... set target_exec [gdb_remote_download target $binfile.bak $binfile] ... A "gdb_remote_download target" copies from build to target. So $binfile is assumed to be a target path, but it's actually a build path. Fix this by: - fist copying $binfile.bak to $binfile, and - simply doing [gdb_remote_download target $binfile]. Then, $binfile.bak is created here: ... # Make sure we have the original symbol file in a safe place to copy from. gdb_remote_download host $binfile $binfile.bak ... and since "gdb_remote_download host" copies from build to host, $binfile.bak is assumed to be a host path, but it's actually a build path. This happens to cause no problems in this configuration (because build == host), but it would for a remote host configuration. So let's fix this by making build rather than host the "safe place to copy from". Tested on x86_64-linux. --- gdb/testsuite/gdb.server/connect-with-no-symbol-file.exp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) base-commit: bf0e35375461ef2a17e2872e7f5c1446a5924b64 diff --git a/gdb/testsuite/gdb.server/connect-with-no-symbol-file.exp b/gdb/testsuite/gdb.server/connect-with-no-symbol-file.exp index b98e566e2d6..efddccd2a19 100644 --- a/gdb/testsuite/gdb.server/connect-with-no-symbol-file.exp +++ b/gdb/testsuite/gdb.server/connect-with-no-symbol-file.exp @@ -43,8 +43,11 @@ proc connect_no_symbol_file { sysroot action } { global binfile with_test_prefix "setup" { + # Restore original $binfile. + gdb_remote_download build $binfile.bak $binfile + # Copy the symbol file to the target. - set target_exec [gdb_remote_download target $binfile.bak $binfile] + set target_exec [gdb_remote_download target $binfile] # Make sure we're disconnected, in case we're testing with an # extended-remote board, therefore already connected. @@ -89,7 +92,7 @@ proc connect_no_symbol_file { sysroot action } { } # Make sure we have the original symbol file in a safe place to copy from. -gdb_remote_download host $binfile $binfile.bak +gdb_remote_download build $binfile $binfile.bak # Start with no executable loaded. clean_restart From patchwork Thu Mar 9 09:45:40 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom de Vries X-Patchwork-Id: 66160 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id E0B0B384F023 for ; Thu, 9 Mar 2023 09:46:34 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org E0B0B384F023 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1678355194; bh=qk0WSK8ncrT8tSewj2+6ejX6X0062ZD3F7r9fHClsJk=; h=To:Subject:Date:In-Reply-To:References:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=yZ0x8RsTzeMY2CbXx1+v53hsnO02SGyvxMOb5ZedkN5ugv8StCbn0xh3HecXNpeql 21GdbPDKdm0xizCcShAtsg7rIuN41QrYST17WYZaj/6ci1GAy7B3Eq5ONRXB4Ua1tJ 107XNGEEXVzUfFrExHmy/abtYUfIMvhb0bAV/VhY= X-Original-To: gdb-patches@sourceware.org Delivered-To: gdb-patches@sourceware.org Received: from smtp-out1.suse.de (smtp-out1.suse.de [IPv6:2001:67c:2178:6::1c]) by sourceware.org (Postfix) with ESMTPS id DC9F93858298 for ; Thu, 9 Mar 2023 09:45:35 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org DC9F93858298 Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id 0D1A121DA9 for ; Thu, 9 Mar 2023 09:45:35 +0000 (UTC) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id EDA9A1391B for ; Thu, 9 Mar 2023 09:45:34 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id oOPUOL6qCWS8FwAAMHmgww (envelope-from ) for ; Thu, 09 Mar 2023 09:45:34 +0000 To: gdb-patches@sourceware.org Subject: [PATCH 2/7] [gdb/testsuite] Fix gdb.server/server-kill.exp for remote target Date: Thu, 9 Mar 2023 10:45:40 +0100 Message-Id: <20230309094545.4537-2-tdevries@suse.de> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20230309094545.4537-1-tdevries@suse.de> References: <20230309094545.4537-1-tdevries@suse.de> MIME-Version: 1.0 X-Spam-Status: No, score=-12.4 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Tom de Vries via Gdb-patches From: Tom de Vries Reply-To: Tom de Vries Errors-To: gdb-patches-bounces+patchwork=sourceware.org@sourceware.org Sender: "Gdb-patches" In commit 80dc83fd0e7 ("gdb/remote: handle target dying just before a stepi") an observation is made that test-case gdb.server/server-kill.exp claims to kill gdbserver, but actually kills the inferior. Consequently, the commit adds testing of killing gdbserver alongside. The problem is that: - the original observation is incorrect (possibly caused by misreading getppid as getpid) - consequently, the test-case doesn't test killing the inferior, instead it tests killing gdbserver twice - the method to get the gdbserver PID added in the commit doesn't work for target board remote-gdbserver-on-localhost, it returns the PID of the ssh client session instead. Fixing the method for getting the inferior PID gives us fails, and there's no evidence that killing the inferior ever worked. So, fix this by reverting the commit and just killing gdbserver, using the original method of getting the gdbserver PID which does work for target board remote-gdbserver-on-localhost. Tested on x86_64-linux. --- gdb/testsuite/gdb.server/server-kill.exp | 47 +++++------------------- 1 file changed, 10 insertions(+), 37 deletions(-) diff --git a/gdb/testsuite/gdb.server/server-kill.exp b/gdb/testsuite/gdb.server/server-kill.exp index 5622b27f6bf..0e9df6e1a5f 100644 --- a/gdb/testsuite/gdb.server/server-kill.exp +++ b/gdb/testsuite/gdb.server/server-kill.exp @@ -28,21 +28,6 @@ if { [build_executable "failed to prepare" ${testfile}] } { return -1 } -# Global control variable used by the proc prepare. Should be set to -# either 'inferior' or 'server'. -# -# In the proc prepare we start gdbserver and extract a pid, which will -# later be killed by calling the proc kill_server. -# -# When KILL_PID_OF is set to 'inferior' then the pid we kill is that -# of the inferior running under gdbserver, when this process dies -# gdbserver itself will exit. -# -# When KILL_PID_OF is set to 'server' then the pid we kill is that of -# the gdbserver itself, this is a much more aggressive strategy and -# exposes different bugs within GDB. -set kill_pid_of "inferior" - # Spawn GDBserver, run to main, extract GDBserver's PID and save it in # the SERVER_PID global. @@ -67,24 +52,16 @@ proc prepare {} { gdbserver_run "" - # Continue past server_pid assignment. We do this for both scenarios, - # to avoid doing a backtrace from _start, which may not trigger remote - # communication. gdb_breakpoint ${srcfile}:[gdb_get_line_number "i = 0;"] gdb_continue_to_breakpoint "after server_pid assignment" - if { $::kill_pid_of == "inferior" } { - # Get the pid of GDBServer. - set test "p server_pid" - set server_pid 0 - gdb_test_multiple $test $test { - -re " = ($decimal)\r\n$gdb_prompt $" { - set server_pid $expect_out(1,string) - pass $test - } + # Get the pid of GDBServer. + set server_pid 0 + gdb_test_multiple "p server_pid" "" { + -re -wrap " = ($decimal)" { + set server_pid $expect_out(1,string) + pass $gdb_test_name } - } else { - set server_pid [exp_pid -i $::server_spawn_id] } if {$server_pid == 0} { @@ -165,12 +142,8 @@ proc_with_prefix test_stepi {} { gdb_test "stepi" "(Target disconnected|Remote connection closed|Remote communication error).*" } -# Run each test twice, see the description of KILL_PID_OF earlier in -# this file for more details. +test_tstatus +test_unwind_nosyms +test_unwind_syms +test_stepi -foreach_with_prefix kill_pid_of { "inferior" "server" } { - test_tstatus - test_unwind_nosyms - test_unwind_syms - test_stepi -} From patchwork Thu Mar 9 09:45:41 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom de Vries X-Patchwork-Id: 66161 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 8989B384D156 for ; Thu, 9 Mar 2023 09:46:40 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 8989B384D156 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1678355200; bh=sbvqsjNSBa1l/d7KGKlXpL6H9wCpgp9v2XQ7QNOMPno=; h=To:Subject:Date:In-Reply-To:References:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=MxKDU14jc0nunVZYZ3sHeNGIC8vabuQHqIcA2FIEqdVmtq3sa8Ua/fYSnTHASWEOE 3qBDFqIt9L2S7jCdYS6q2DNEigx5MliMZeVVA5WY+M0gqsfLddTta1w5r2pk35Gr1P 7a+oOYJ+iUKPdNCG8Zwot9TbNH8xR0qJsDxHq4ic= X-Original-To: gdb-patches@sourceware.org Delivered-To: gdb-patches@sourceware.org Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) by sourceware.org (Postfix) with ESMTPS id E118438582B0 for ; Thu, 9 Mar 2023 09:45:35 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org E118438582B0 Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id 2525E1FFC7 for ; Thu, 9 Mar 2023 09:45:35 +0000 (UTC) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 129581391B for ; Thu, 9 Mar 2023 09:45:35 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id oEthA7+qCWS8FwAAMHmgww (envelope-from ) for ; Thu, 09 Mar 2023 09:45:35 +0000 To: gdb-patches@sourceware.org Subject: [PATCH 3/7] [gdb/testsuite] Fix gdb.server/multi-ui-errors.exp for remote target Date: Thu, 9 Mar 2023 10:45:41 +0100 Message-Id: <20230309094545.4537-3-tdevries@suse.de> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20230309094545.4537-1-tdevries@suse.de> References: <20230309094545.4537-1-tdevries@suse.de> MIME-Version: 1.0 X-Spam-Status: No, score=-12.5 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Tom de Vries via Gdb-patches From: Tom de Vries Reply-To: Tom de Vries Errors-To: gdb-patches-bounces+patchwork=sourceware.org@sourceware.org Sender: "Gdb-patches" Test-case gdb.server/multi-ui-errors.exp fails for target board remote-gdbserver-on-localhost with REMOTE_TARGET_USERNAME=remote-target: ... (gdb) PASS: gdb.server/multi-ui-errors.exp: interact with GDB's main UI Executing on target: kill -9 6447 (timeout = 300) builtin_spawn [open ...]^M XYZ1ZYX sh: line 0: kill: (6447) - Operation not permitted ... The problem is that the kill command: ... remote_exec target "kill -9 $gdbserver_pid" ... intended to kill gdbserver instead tries to kill the ssh client session in which the gdbserver runs, and fails because it's trying as the remote target user (remote-target on localhost) to kill a pid owned by the the build user ($USER on localhost). Fix this by getting the gdbserver pid using the ppid trick from server-kill.exp. Likewise in gdb.server/server-kill-python.exp. Tested on x86_64-linux. --- gdb/testsuite/gdb.server/multi-ui-errors.c | 5 ++++ gdb/testsuite/gdb.server/multi-ui-errors.exp | 29 +++++++++++++++++++ .../gdb.server/server-kill-python.exp | 23 ++++++++++++++- 3 files changed, 56 insertions(+), 1 deletion(-) diff --git a/gdb/testsuite/gdb.server/multi-ui-errors.c b/gdb/testsuite/gdb.server/multi-ui-errors.c index 09739198cc1..afa1815fbee 100644 --- a/gdb/testsuite/gdb.server/multi-ui-errors.c +++ b/gdb/testsuite/gdb.server/multi-ui-errors.c @@ -17,12 +17,17 @@ #include #include +#include + +pid_t server_pid; int main (void) { int i; + server_pid = getppid (); + printf ("@@XX@@ Inferior Starting @@XX@@\n"); for (i = 0; i < 120; ++i) diff --git a/gdb/testsuite/gdb.server/multi-ui-errors.exp b/gdb/testsuite/gdb.server/multi-ui-errors.exp index 9cc5239d888..266207a5f4b 100644 --- a/gdb/testsuite/gdb.server/multi-ui-errors.exp +++ b/gdb/testsuite/gdb.server/multi-ui-errors.exp @@ -100,6 +100,35 @@ with_spawn_id $gdb_main_spawn_id { gdb_test "echo hello\\n" "hello" "interact with GDB's main UI" } +# Get the gdbserver PID. +set gdbserver_pid 0 +with_spawn_id $gdb_main_spawn_id { + gdb_test "interrupt" + + gdb_test_multiple "" "interrupt arrived" { + -re "Program received signal SIGINT, Interrupt\\.\r\n" { + pass $gdb_test_name + } + } + + gdb_test_multiple "p server_pid" "" { + -re -wrap " = ($decimal)" { + set gdbserver_pid $expect_out(1,string) + pass $gdb_test_name + } + } + + gdb_test_multiple continue "" { + -re "Continuing\\.\r\n" { + pass $gdb_test_name + } + } +} + +if { $gdbserver_pid == 0 } { + return +} + # Now kill the gdbserver. remote_exec target "kill -9 $gdbserver_pid" diff --git a/gdb/testsuite/gdb.server/server-kill-python.exp b/gdb/testsuite/gdb.server/server-kill-python.exp index 7b8f29b2890..f6b373065a8 100644 --- a/gdb/testsuite/gdb.server/server-kill-python.exp +++ b/gdb/testsuite/gdb.server/server-kill-python.exp @@ -30,12 +30,16 @@ if {[build_executable "failed to prepare" ${testfile} \ return -1 } +set target_binfile [gdb_remote_download target $binfile] + # Start gdbserver. -set res [gdbserver_spawn "${binfile}"] +set res [gdbserver_spawn "${target_binfile}"] set gdbserver_protocol [lindex $res 0] set gdbserver_gdbport [lindex $res 1] set gdbserver_pid [exp_pid -i $server_spawn_id] +set break_linenr [gdb_get_line_number "@@XX@@ Inferior Starting @@XX@@"] + # Generate a python script we will later source. set file1 [standard_output_file file1.py] set fd [open "$file1" w] @@ -44,6 +48,9 @@ puts $fd \ def do_gdb_stuff (): gdb.execute ('target $gdbserver_protocol $gdbserver_gdbport') + gdb.execute ('break $srcfile:$break_linenr') + gdb.execute ('continue') + gdb.execute ('p server_pid') gdb.execute ('continue') do_gdb_stuff()" @@ -57,8 +64,22 @@ if {[gdb_spawn_with_cmdline_opts \ return } +# Get the gdbserver PID. +set gdbserver_pid 0 + # Wait for the inferior to start up. with_spawn_id $server_spawn_id { + gdb_test_multiple "" "get gdbserver PID" { + -re " = ($decimal)\r\n" { + set gdbserver_pid $expect_out(1,string) + pass $gdb_test_name + } + } + + if { $gdbserver_pid == 0 } { + return + } + gdb_test_multiple "" "ensure inferior is running" { -re "@@XX@@ Inferior Starting @@XX@@" { pass $gdb_test_name From patchwork Thu Mar 9 09:45:42 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom de Vries X-Patchwork-Id: 66158 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 39BCA384F00F for ; Thu, 9 Mar 2023 09:46:28 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 39BCA384F00F DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1678355188; bh=sN9up/5d0OD9S0hVmp8XLSSoWdHplL1SFl5OAo5CbA8=; h=To:Subject:Date:In-Reply-To:References:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=jQwZlCsN/6XnZVaSRl9z5cgT4ea+YRpwWcAhGcdfbb4qfNDd0GXaLzUpX3JIVIbN8 1+Ug55EuVM1UgWzSobgkor6YyoUGnv829mSKivcCEosbAc+3cbuQMREC0ucsuOTzVK v/qteq4OFMdsHZbylTI2Eknar0og9uhbhB54C79U= X-Original-To: gdb-patches@sourceware.org Delivered-To: gdb-patches@sourceware.org Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) by sourceware.org (Postfix) with ESMTPS id 0854B38582BE for ; Thu, 9 Mar 2023 09:45:36 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 0854B38582BE Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id 3E9031FFC8 for ; Thu, 9 Mar 2023 09:45:35 +0000 (UTC) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 2AF521391B for ; Thu, 9 Mar 2023 09:45:35 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id MNNhCb+qCWS8FwAAMHmgww (envelope-from ) for ; Thu, 09 Mar 2023 09:45:35 +0000 To: gdb-patches@sourceware.org Subject: [PATCH 4/7] [gdb/testsuite] Fix gdb.server/sysroot.exp for remote target Date: Thu, 9 Mar 2023 10:45:42 +0100 Message-Id: <20230309094545.4537-4-tdevries@suse.de> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20230309094545.4537-1-tdevries@suse.de> References: <20230309094545.4537-1-tdevries@suse.de> MIME-Version: 1.0 X-Spam-Status: No, score=-12.5 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Tom de Vries via Gdb-patches From: Tom de Vries Reply-To: Tom de Vries Errors-To: gdb-patches-bounces+patchwork=sourceware.org@sourceware.org Sender: "Gdb-patches" Fix test-case gdb.server/sysroot.exp with target board remote-gdbserver-on-localhost, by: - using gdb_remote_download, and - disabling the "local" scenario for remote host. Tested on x86_64-linux. --- gdb/testsuite/gdb.server/sysroot.exp | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/gdb/testsuite/gdb.server/sysroot.exp b/gdb/testsuite/gdb.server/sysroot.exp index 715d6001020..ac2a03d0c8f 100644 --- a/gdb/testsuite/gdb.server/sysroot.exp +++ b/gdb/testsuite/gdb.server/sysroot.exp @@ -27,9 +27,17 @@ if {[build_executable "failed to prepare" $testfile $srcfile "additional_flags=- return -1 } +set target_binfile [gdb_remote_download target $binfile] + # Run once with sysroot set to the local filesystem and once set to the remote # target. -foreach_with_prefix sysroot { "local" "remote" } { +set modes {} +if { ![is_remote target] } { + lappend modes "local" +} +lappend modes "remote" + +foreach_with_prefix sysroot $modes { global srcdir global subdir global binfile @@ -40,7 +48,7 @@ foreach_with_prefix sysroot { "local" "remote" } { set timeout_factor 1 } else { set sysroot_command "target:" - set reading_symbols "Reading $binfile from remote target..." + set reading_symbols "Reading .*$target_binfile from remote target..." set timeout_factor 5 } @@ -55,7 +63,7 @@ foreach_with_prefix sysroot { "local" "remote" } { gdb_test "disconnect" ".*" # Start GDBserver. - set res [gdbserver_start "" $binfile] + set res [gdbserver_start "" $target_binfile] set gdbserver_protocol [lindex $res 0] set gdbserver_gdbport [lindex $res 1] From patchwork Thu Mar 9 09:45:43 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom de Vries X-Patchwork-Id: 66157 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id C05673850222 for ; Thu, 9 Mar 2023 09:46:10 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org C05673850222 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1678355170; bh=i3kUGhZTDt2h4PmGMNcsa0rKF/QMOjtoNWvQgzPNcNQ=; h=To:Subject:Date:In-Reply-To:References:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=XVReLBUwgHsB2tdmKyFHr8y+r5u1Qz3MxsFeOfn9G4ZG7bUCQO6dAhnPB65PwGZyZ iv32qht/m2O+skael7T3txOLKIi/at3pNnVRFs2WX81o2R7gvzI5kfFlKHKsPBNPnD dXibvh32P/HV+IMb72GDdvasGz+OkR7r8h+rfv50= X-Original-To: gdb-patches@sourceware.org Delivered-To: gdb-patches@sourceware.org Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) by sourceware.org (Postfix) with ESMTPS id 1CAA63858C5E for ; Thu, 9 Mar 2023 09:45:36 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 1CAA63858C5E Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id 56C6F1FFC9 for ; Thu, 9 Mar 2023 09:45:35 +0000 (UTC) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 431E31391B for ; Thu, 9 Mar 2023 09:45:35 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id CLA9D7+qCWS8FwAAMHmgww (envelope-from ) for ; Thu, 09 Mar 2023 09:45:35 +0000 To: gdb-patches@sourceware.org Subject: [PATCH 5/7] [gdb/testsuite] Fix gdbserver path in remote-stdio-gdbserver.exp Date: Thu, 9 Mar 2023 10:45:43 +0100 Message-Id: <20230309094545.4537-5-tdevries@suse.de> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20230309094545.4537-1-tdevries@suse.de> References: <20230309094545.4537-1-tdevries@suse.de> MIME-Version: 1.0 X-Spam-Status: No, score=-12.5 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Tom de Vries via Gdb-patches From: Tom de Vries Reply-To: Tom de Vries Errors-To: gdb-patches-bounces+patchwork=sourceware.org@sourceware.org Sender: "Gdb-patches" With test-case gdb.server/unittest.exp and target board remote-stdio-gdbserver I run into: ... (gdb) builtin_spawn /usr/bin/ssh -t -l vries localhost /usr/bin/gdbserver \ --selftest^M Selftests have been disabled for this build.^M UNSUPPORTED: gdb.server/unittest.exp: unit tests ... due to using the system gdbserver /usr/bin/gdbserver rather than the one from the build. Fix this by removing the hard-coding of /usr/bin/gdbserver in remote-stdio-gdbserver, allowing find_gdbserver to do its work, such that we have instead: ... (gdb) builtin_spawn /usr/bin/ssh -t -l vries localhost \ /data/vries/gdb/leap-15-4/build/gdbserver/gdbserver --selftest^M Running selftest remote_memory_tagging.^M Ran 1 unit tests, 0 failed^M Connection to localhost closed.^M^M PASS: gdb.server/unittest.exp: unit tests ... Tested on x86_64-linux. --- gdb/testsuite/boards/remote-stdio-gdbserver.exp | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/gdb/testsuite/boards/remote-stdio-gdbserver.exp b/gdb/testsuite/boards/remote-stdio-gdbserver.exp index 47a0577733c..479dfb066a4 100644 --- a/gdb/testsuite/boards/remote-stdio-gdbserver.exp +++ b/gdb/testsuite/boards/remote-stdio-gdbserver.exp @@ -47,11 +47,9 @@ if [info exists REMOTE_TMPDIR] { set_board_info remotedir $REMOTE_TMPDIR } -unset_board_info gdb_server_prog if [info exists GDBSERVER] { + unset_board_info gdb_server_prog set_board_info gdb_server_prog $GDBSERVER -} else { - set_board_info gdb_server_prog /usr/bin/gdbserver } proc get_remote_login { } { From patchwork Thu Mar 9 09:45:44 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom de Vries X-Patchwork-Id: 66159 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id ED0843850214 for ; Thu, 9 Mar 2023 09:46:33 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org ED0843850214 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1678355194; bh=ktK2/JkOObNRs4TecmXEAjPscz4k7AN8nWvgjBt0Q5I=; h=To:Subject:Date:In-Reply-To:References:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=QV2wh2PBmhjgMrdPamG8LnplFs/WY752LA0h0HAv9Q2uIy4X3mJoB5HdfresayQqF KGfMEYA7CLffUxfNffVjYebrZfN7FB4Wi6Eon90ZEh5ML12sPVWxO2NFhAgH/6efEW oazpoBwxB9HUa2jKe0vYIzM72dfEI0Io7Vn7YmhM= X-Original-To: gdb-patches@sourceware.org Delivered-To: gdb-patches@sourceware.org Received: from smtp-out2.suse.de (smtp-out2.suse.de [IPv6:2001:67c:2178:6::1d]) by sourceware.org (Postfix) with ESMTPS id 369EC3858C78 for ; Thu, 9 Mar 2023 09:45:36 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 369EC3858C78 Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id 6FC0B1FFCA for ; Thu, 9 Mar 2023 09:45:35 +0000 (UTC) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 5C5841391B for ; Thu, 9 Mar 2023 09:45:35 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id aFtjFb+qCWS8FwAAMHmgww (envelope-from ) for ; Thu, 09 Mar 2023 09:45:35 +0000 To: gdb-patches@sourceware.org Subject: [PATCH 6/7] [gdb/testsuite] Fix gdb.server/unittest.exp for remote target Date: Thu, 9 Mar 2023 10:45:44 +0100 Message-Id: <20230309094545.4537-6-tdevries@suse.de> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20230309094545.4537-1-tdevries@suse.de> References: <20230309094545.4537-1-tdevries@suse.de> MIME-Version: 1.0 X-Spam-Status: No, score=-12.4 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Tom de Vries via Gdb-patches From: Tom de Vries Reply-To: Tom de Vries Errors-To: gdb-patches-bounces+patchwork=sourceware.org@sourceware.org Sender: "Gdb-patches" With test-case gdb.server/unittest.exp and a build with --disable-unit-tests I get: ... (gdb) builtin_spawn /data/vries/gdb/leap-15-4/build/gdbserver/gdbserver \ --selftest^M Selftests have been disabled for this build.^M UNSUPPORTED: gdb.server/unittest.exp: unit tests ... but with target board remote-stdio-gdbserver I get instead: ... (gdb) builtin_spawn /usr/bin/ssh -t -l vries localhost \ /data/vries/gdb/leap-15-4/build/gdbserver/gdbserver --selftest^M Selftests have been disabled for this build.^M Connection to localhost closed.^M^M FAIL: gdb.server/unittest.exp: unit tests ... Fix this by making the regexp less strict. Tested on x86_64-linux. --- gdb/testsuite/gdb.server/unittest.exp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gdb/testsuite/gdb.server/unittest.exp b/gdb/testsuite/gdb.server/unittest.exp index d25ee362644..2ef2865a11a 100644 --- a/gdb/testsuite/gdb.server/unittest.exp +++ b/gdb/testsuite/gdb.server/unittest.exp @@ -36,7 +36,7 @@ expect { gdb_assert "$num_ran >= 0" $test } - -re "Selftests have been disabled for this build.\r\n$" { + -re "Selftests have been disabled for this build.\r\n" { unsupported $test } From patchwork Thu Mar 9 09:45:45 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom de Vries X-Patchwork-Id: 66162 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 028E13850214 for ; Thu, 9 Mar 2023 09:47:05 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 028E13850214 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1678355225; bh=LHbDur0HFCIwmvjFOV+jg2HhkjHcmyA5cm+99O5WzU4=; h=To:Subject:Date:In-Reply-To:References:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=n5eXnTmjnwmMm+8h6lZIFP2pWjAoyBXK2uoPMwYbsisLeXfnsWDSevjWebHpRUddo fikAAB4zerbNGy6+jJOBi5T+eEd4MpYGXnfcY+qgNCnSYCMn7Jxu0CAedYY/C+dNl1 hqwxt4yP53oQ60WzouZawWHMSceTi5rAEaLfG+WU= X-Original-To: gdb-patches@sourceware.org Delivered-To: gdb-patches@sourceware.org Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.220.28]) by sourceware.org (Postfix) with ESMTPS id 5E5E6385842B for ; Thu, 9 Mar 2023 09:45:36 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 5E5E6385842B Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id 88CA721DAA for ; Thu, 9 Mar 2023 09:45:35 +0000 (UTC) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 7520E1391B for ; Thu, 9 Mar 2023 09:45:35 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id KOx1G7+qCWS8FwAAMHmgww (envelope-from ) for ; Thu, 09 Mar 2023 09:45:35 +0000 To: gdb-patches@sourceware.org Subject: [PATCH 7/7] [gdb/testsuite] Fix gdb.server/*.exp for remote target Date: Thu, 9 Mar 2023 10:45:45 +0100 Message-Id: <20230309094545.4537-7-tdevries@suse.de> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20230309094545.4537-1-tdevries@suse.de> References: <20230309094545.4537-1-tdevries@suse.de> MIME-Version: 1.0 X-Spam-Status: No, score=-12.5 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Tom de Vries via Gdb-patches From: Tom de Vries Reply-To: Tom de Vries Errors-To: gdb-patches-bounces+patchwork=sourceware.org@sourceware.org Sender: "Gdb-patches" Fix test-cases for target board remote-gdbserver-on-localhost by using gdb_remote_download. Tested on x86_64-linux. --- .../gdb.server/exit-multiple-threads.exp | 16 +++++++++------- gdb/testsuite/gdb.server/reconnect-ctrl-c.exp | 4 +++- .../gdb.server/run-without-local-binary.exp | 4 +++- .../gdb.server/stop-reply-no-thread-multi.exp | 4 +++- .../gdb.server/stop-reply-no-thread.exp | 4 +++- gdb/testsuite/gdb.server/twice-connect.exp | 4 +++- 6 files changed, 24 insertions(+), 12 deletions(-) diff --git a/gdb/testsuite/gdb.server/exit-multiple-threads.exp b/gdb/testsuite/gdb.server/exit-multiple-threads.exp index 87867f00e66..4e55873b1b5 100644 --- a/gdb/testsuite/gdb.server/exit-multiple-threads.exp +++ b/gdb/testsuite/gdb.server/exit-multiple-threads.exp @@ -35,7 +35,7 @@ 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 } { +proc prepare_for_test { executable target_executable disable_multi_process } { global GDBFLAGS save_vars { GDBFLAGS } { @@ -65,7 +65,7 @@ proc prepare_for_test { executable disable_multi_process } { } # Start gdbserver and connect. - set res [gdbserver_start "" $executable] + set res [gdbserver_start "" $target_executable] set gdbserver_protocol [lindex $res 0] set gdbserver_gdbport [lindex $res 1] set res [gdb_target_cmd $gdbserver_protocol $gdbserver_gdbport] @@ -83,10 +83,10 @@ proc prepare_for_test { executable disable_multi_process } { # we have multiple-threads. EXECUTABLE is the binary under test, and # DISABLE_MULTI_PROCESS indicates if we should disable GDB's remote # multi-process support. -proc run_exit_test { executable disable_multi_process } { +proc run_exit_test { executable target_executable disable_multi_process } { global decimal - prepare_for_test ${executable} ${disable_multi_process} + prepare_for_test ${executable} $target_executable ${disable_multi_process} # Finally, continue until the process exits, ensure we don't see # any warnings between "Continuing." and the final process has @@ -107,10 +107,10 @@ proc run_exit_test { executable disable_multi_process } { # while we have multiple-threads. EXECUTABLE is the binary under # test, and DISABLE_MULTI_PROCESS indicates if we should disable GDB's # remote multi-process support. -proc run_signal_test { executable disable_multi_process } { +proc run_signal_test { executable target_executable disable_multi_process } { global decimal gdb_prompt - prepare_for_test ${executable} ${disable_multi_process} + prepare_for_test ${executable} $target_executable ${disable_multi_process} set inf_pid [get_valueof "/d" "global_pid" "unknown"] gdb_assert ![string eq ${inf_pid} "unknown"] "read the pid" @@ -142,7 +142,9 @@ foreach_with_prefix test { exit signal } { return -1 } + set target_executable [gdb_remote_download target $executable] + foreach_with_prefix multi_process { 0 1 } { - $func ${executable} ${multi_process} + $func ${executable} $target_executable ${multi_process} } } diff --git a/gdb/testsuite/gdb.server/reconnect-ctrl-c.exp b/gdb/testsuite/gdb.server/reconnect-ctrl-c.exp index c8ef81443e5..6146cc3888e 100644 --- a/gdb/testsuite/gdb.server/reconnect-ctrl-c.exp +++ b/gdb/testsuite/gdb.server/reconnect-ctrl-c.exp @@ -40,6 +40,8 @@ save_vars { GDBFLAGS } { } } +set target_binfile [gdb_remote_download target $binfile] + # Make sure we're disconnected, in case we're testing with an # extended-remote board, therefore already connected. with_test_prefix "preparation" { @@ -70,7 +72,7 @@ proc connect_continue_ctrl_c {} { with_test_prefix "first" { # Start GDBserver. set gdbserver_reconnect_p 1 - set res [gdbserver_start "" $binfile] + set res [gdbserver_start "" $target_binfile] set gdbserver_protocol [lindex $res 0] set gdbserver_gdbport [lindex $res 1] diff --git a/gdb/testsuite/gdb.server/run-without-local-binary.exp b/gdb/testsuite/gdb.server/run-without-local-binary.exp index c390eeb435a..08620e0ec3e 100644 --- a/gdb/testsuite/gdb.server/run-without-local-binary.exp +++ b/gdb/testsuite/gdb.server/run-without-local-binary.exp @@ -23,6 +23,8 @@ if {[build_executable "failed to prepare" $testfile $srcfile debug]} { return -1 } +set target_binfile [gdb_remote_download target $binfile] + # Test running GDB without providing a local binary for it. In order # to do that, we unset GDBFLAGS before running GDB. We also start # gdbserver "by hand". For more details about this test, see PR @@ -39,7 +41,7 @@ save_vars { GDBFLAGS } { gdb_exit gdb_start - gdb_test_no_output "set remote exec-file $binfile" \ + gdb_test_no_output "set remote exec-file $target_binfile" \ "set remote exec-file" # Make sure we're disconnected, in case we're testing with an diff --git a/gdb/testsuite/gdb.server/stop-reply-no-thread-multi.exp b/gdb/testsuite/gdb.server/stop-reply-no-thread-multi.exp index 042c285d98a..cf6be64fab3 100644 --- a/gdb/testsuite/gdb.server/stop-reply-no-thread-multi.exp +++ b/gdb/testsuite/gdb.server/stop-reply-no-thread-multi.exp @@ -37,6 +37,8 @@ if { [build_executable "failed to prepare" $testfile $srcfile {debug pthreads}] return -1 } +set target_binfile [gdb_remote_download target $binfile] + # Run the tests with different features of GDBserver disabled. # TARGET_NON_STOP is passed to "maint set target-non-stop". proc run_test { target_non_stop disable_feature } { @@ -63,7 +65,7 @@ proc run_test { target_non_stop disable_feature } { if { $disable_feature != "" } { set packet_arg "--disable-packet=${disable_feature}" } - set res [gdbserver_start $packet_arg $binfile] + set res [gdbserver_start $packet_arg $::target_binfile] set gdbserver_protocol [lindex $res 0] set gdbserver_gdbport [lindex $res 1] diff --git a/gdb/testsuite/gdb.server/stop-reply-no-thread.exp b/gdb/testsuite/gdb.server/stop-reply-no-thread.exp index 3ef512bc637..65db483e8de 100644 --- a/gdb/testsuite/gdb.server/stop-reply-no-thread.exp +++ b/gdb/testsuite/gdb.server/stop-reply-no-thread.exp @@ -29,6 +29,8 @@ if { [build_executable "failed to prepare" $testfile $srcfile] == -1 } { return -1 } +set target_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 GDBFLAGS @@ -51,7 +53,7 @@ proc run_test { disable_feature target_nonstop } { if { $disable_feature != "" } { set packet_arg "--disable-packet=${disable_feature}" } - set res [gdbserver_start $packet_arg $binfile] + set res [gdbserver_start $packet_arg $::target_binfile] set gdbserver_protocol [lindex $res 0] set gdbserver_gdbport [lindex $res 1] diff --git a/gdb/testsuite/gdb.server/twice-connect.exp b/gdb/testsuite/gdb.server/twice-connect.exp index 8ff8334f5f2..fd76ea0ce3e 100644 --- a/gdb/testsuite/gdb.server/twice-connect.exp +++ b/gdb/testsuite/gdb.server/twice-connect.exp @@ -29,9 +29,11 @@ if { [build_executable "failed to prepare" $::testfile $::srcfile \ # Don't use $binfile arg, to make sure we use the remote file target:$binfile. clean_restart +set target_binfile [gdb_remote_download target $binfile] + # Start gdbserver, and connect to it, twice. foreach_with_prefix session {first second} { - lassign [gdbserver_start "" "$binfile"] unused gdbserver_address + lassign [gdbserver_start "" "$target_binfile"] unused gdbserver_address gdb_test "disconnect" set res [gdb_target_cmd "remote" $gdbserver_address] gdb_assert { $res == 0 } "gdbserver started"