From patchwork Mon Nov 7 16:13:25 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom de Vries X-Patchwork-Id: 60118 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 D2FF93858432 for ; Mon, 7 Nov 2022 16:14:03 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org D2FF93858432 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1667837643; bh=fviF6b8QimUrS6TFvfJtpQZaYfu9kp+Swp3foq2PhkM=; 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=KIiYmH2hhZSvwTz8U+27KfL73uSVrRPRtqBbPWpDJese6oD15olNrJXIz9muO4jbZ d0ELf3TDOdou+XDrAWgPR5JukCc9JFwF/qpzxwrYxaPFjoCb+j66FSr/lKwkmW15CA haSiKY0LNTVm2mDpMYOqoGKfpDmfWxpPPbTJlcVg= 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 B73F73858D28 for ; Mon, 7 Nov 2022 16:13:34 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org B73F73858D28 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 F268922562 for ; Mon, 7 Nov 2022 16:13:33 +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 DFDBD13494 for ; Mon, 7 Nov 2022 16:13:33 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id WIKQNa0uaWPsTwAAMHmgww (envelope-from ) for ; Mon, 07 Nov 2022 16:13:33 +0000 To: gdb-patches@sourceware.org Subject: [PATCH 1/9] [gdb/testsuite] Fix gdb.base/foll-exec.exp for remote target Date: Mon, 7 Nov 2022 17:13:25 +0100 Message-Id: <20221107161333.16999-2-tdevries@suse.de> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20221107161333.16999-1-tdevries@suse.de> References: <20221107161333.16999-1-tdevries@suse.de> MIME-Version: 1.0 X-Spam-Status: No, score=-12.6 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" When running test-case gdb.base/foll-exec.exp with target board remote-gdbserver-on-localhost.exp, I run into: ... (gdb) PASS: gdb.base/foll-exec.exp: insert first exec catchpoint continue^M Continuing.^M [Inferior 1 (process 4476) exited normally]^M (gdb) FAIL: gdb.base/foll-exec.exp: continue to first exec catchpoint (the program e\ xited) ... The problem is that the foll-exec executable expects the exec-ed executable execd-prog alongside it, but it's missing. Fix this by adding the missing gdb_remote_download. Likewise in a few other test-cases. Tested on x86_64-linux. --- gdb/testsuite/gdb.base/exec-invalid-sysroot.exp | 4 ++++ gdb/testsuite/gdb.base/foll-exec.exp | 4 ++++ gdb/testsuite/gdb.base/foll-vfork.exp | 4 ++++ 3 files changed, 12 insertions(+) diff --git a/gdb/testsuite/gdb.base/exec-invalid-sysroot.exp b/gdb/testsuite/gdb.base/exec-invalid-sysroot.exp index cacd5a092a2..7f7599cbf86 100644 --- a/gdb/testsuite/gdb.base/exec-invalid-sysroot.exp +++ b/gdb/testsuite/gdb.base/exec-invalid-sysroot.exp @@ -33,6 +33,10 @@ if { [gdb_compile "${srcdir}/${subdir}/${srcfile2}" "${binfile2}" executable $c return -1 } +if { [is_remote target] } { + gdb_remote_download target $binfile2 +} + if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable $compile_options] != "" } { untested "failed to compile main testcase" return -1 diff --git a/gdb/testsuite/gdb.base/foll-exec.exp b/gdb/testsuite/gdb.base/foll-exec.exp index 8cddfa52c3b..a3d1a8781e9 100644 --- a/gdb/testsuite/gdb.base/foll-exec.exp +++ b/gdb/testsuite/gdb.base/foll-exec.exp @@ -36,6 +36,10 @@ if { [gdb_compile "${srcdir}/${subdir}/${srcfile2}" "${binfile2}" executable $c return -1 } +if { [is_remote target] } { + gdb_remote_download target $binfile2 +} + if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable $compile_options] != "" } { untested "failed to compile" return -1 diff --git a/gdb/testsuite/gdb.base/foll-vfork.exp b/gdb/testsuite/gdb.base/foll-vfork.exp index e4f75728600..9627a177896 100644 --- a/gdb/testsuite/gdb.base/foll-vfork.exp +++ b/gdb/testsuite/gdb.base/foll-vfork.exp @@ -42,6 +42,10 @@ if {[build_executable $testfile.exp $testfile2 $srcfile2 $compile_options] == -1 return -1 } +if { [is_remote target] } { + gdb_remote_download target [standard_output_file $testfile2] +} + # A few of these tests require a little more time than the standard # timeout allows. set oldtimeout $timeout From patchwork Mon Nov 7 16:13:26 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom de Vries X-Patchwork-Id: 60121 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 3A1943857835 for ; Mon, 7 Nov 2022 16:14:29 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 3A1943857835 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1667837669; bh=Sel1zO5yw4hrG+U87cPmGDEWD9vRF5TSCRXqKGNiOts=; 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=xN+Vo7yfmnQXhlGBb9GZd/xHKzBNk5G1wNGHqekfSR2jaVfdf/n341KtXviyfm/10 cSV70UsxLPqjVMygRhCy072+gg7Sv2dce5vCyRSVsaf7UfHFKEJrcBVMGGNGIe8eaB xMyief8gmvEkRcDr9sLJYvp+HR4azhmsxiY+GH1c= 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 E46D83858D38 for ; Mon, 7 Nov 2022 16:13:34 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org E46D83858D38 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 1983A22626 for ; Mon, 7 Nov 2022 16:13: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 0340713494 for ; Mon, 7 Nov 2022 16:13:33 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id eDBdO60uaWPsTwAAMHmgww (envelope-from ) for ; Mon, 07 Nov 2022 16:13:33 +0000 To: gdb-patches@sourceware.org Subject: [PATCH 2/9] [gdb/testsuite] Fix gdb.base/info_sources_2.exp for remote target Date: Mon, 7 Nov 2022 17:13:26 +0100 Message-Id: <20221107161333.16999-3-tdevries@suse.de> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20221107161333.16999-1-tdevries@suse.de> References: <20221107161333.16999-1-tdevries@suse.de> MIME-Version: 1.0 X-Spam-Status: No, score=-12.6 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.base/info_sources_2.exp and target board remote-gdbserver-on-localhost (using REMOTE_TARGET_USERNAME) we run into some failures. Fix these by adding the missing gdb_load_shlib. Tested on x86_64-linux. --- gdb/testsuite/gdb.base/info_sources_2.exp | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/gdb/testsuite/gdb.base/info_sources_2.exp b/gdb/testsuite/gdb.base/info_sources_2.exp index f9246b8fa96..9fe3d479018 100644 --- a/gdb/testsuite/gdb.base/info_sources_2.exp +++ b/gdb/testsuite/gdb.base/info_sources_2.exp @@ -20,6 +20,8 @@ if { [skip_shlib_tests] } { return 0 } +set is_remote_target [is_remote target] + standard_testfile -test.c -lib.c set solib_name [standard_output_file ${testfile}-lib.so] @@ -37,6 +39,8 @@ if {[gdb_compile ${srcdir}/${subdir}/${srcfile} ${binfile} executable \ clean_restart ${binfile} +set solib_name [gdb_load_shlib $solib_name] + if ![runto foo] { untested "failed to run to function foo" return -1 @@ -55,6 +59,7 @@ if ![runto foo] { # file is NOT listed for the given object file. proc run_info_sources { extra_args args } { global gdb_prompt srcdir subdir + global is_remote_target with_test_prefix "args: ${extra_args}" { @@ -76,6 +81,9 @@ proc run_info_sources { extra_args args } { -re "^(\[^\r\n\]+):\r\n" { set objfile_name $expect_out(1,string) + if { $is_remote_target } { + set objfile_name [file tail $objfile_name] + } exp_continue } @@ -129,6 +137,10 @@ proc run_info_sources { extra_args args } { # Figure out the path for SOURCEFILE that we're looking for. set sourcepath [file normalize ${srcdir}/${subdir}/${sourcefile}] + if { $is_remote_target } { + set objfile [file tail $objfile] + } + # Make sure we handle the case where there are no source files # associated with a particular objfile. set source_list {} From patchwork Mon Nov 7 16:13:27 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom de Vries X-Patchwork-Id: 60119 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 52D9A385803E for ; Mon, 7 Nov 2022 16:14:09 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 52D9A385803E DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1667837649; bh=2CHP3Fri3bzLYCLhXMklhSdDhGJKmT057kf3EdvpbeU=; 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=J4xG/BVHpVgMwt7Mnnz9for3H2IGgBavSw1JO9Sd+X4ReQdO7llWe2rWvKNPutoiz T2lcS5rX3644Wc0ydYgqpEZcul14/G2lyFZ4CVYu4+h/q+ref53xESKhJU/UeNeMmt S/gh8b+Wl4MFy1Th4uu16SZR2DzvTzcrtBRI0rro= 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 F1C433858D39 for ; Mon, 7 Nov 2022 16:13:34 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org F1C433858D39 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 2EB4A22627 for ; Mon, 7 Nov 2022 16:13: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 1B27B13ADB for ; Mon, 7 Nov 2022 16:13:34 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id 6O+LBa4uaWPsTwAAMHmgww (envelope-from ) for ; Mon, 07 Nov 2022 16:13:34 +0000 To: gdb-patches@sourceware.org Subject: [PATCH 3/9] [gdb/testsuite] Add REMOTE_TARGET_USERNAME in remote-gdbserver-on-localhost.exp Date: Mon, 7 Nov 2022 17:13:27 +0100 Message-Id: <20221107161333.16999-4-tdevries@suse.de> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20221107161333.16999-1-tdevries@suse.de> References: <20221107161333.16999-1-tdevries@suse.de> MIME-Version: 1.0 X-Spam-Status: No, score=-12.6 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" As reported here ( https://sourceware.org/pipermail/gdb-patches/2022-October/193147.html ) a number of test-cases fails with a remote target setup, for instance test-case gdb.base/print-file-var.exp. So, why don't we see these fails with our remote target boards in gdb/testsuite/boards, say remote-gdbserver-on-localhost.exp? The problem is that the target board uses the same machine and user for both (by-definition-local) build and remote target, and when using absolute pathnames to refer to files on build, we can access those files on target, which in a real remote target setup wouldn't be the case: we'd have to download them to target first, and then the filename would also be different. For aforementioned test-case, this happens when the name of a shared library is passed as absolute file name to gcc: ... gcc ... -DSHLIB_NAME="$outputs/gdb.base/print-file-var/\ print-file-var-lib2-hidden0-dlopen1-version_id_main0_c.so" ... Make these problems visible with remote-gdbserver-on-localhost.exp by adding an option to specify a test account (still on the same machine) using REMOTE_TARGET_USERNAME. We make sure by restricting file permissions, that the test account cannot see the build files on the $USER account, and that the $USER account cannot see the target files on the test account. And so we can reproduce the reported fails: ... $ cd build/gdb $ tc="gdb.base/print-file-var.exp" $ tb="--target_board remote-gdbserver-on-localhost" $ tbu="REMOTE_TARGET_USERNAME=remote-target" $ make check RUNTESTFLAGS="$tb $tbu $tc" ... FAIL: gdb.base/print-file-var.exp: lang=c: hidden=0: dlopen=1: \ version_id_main=0: continue to STOP marker ... Tested on x86_64-linux. Reported-by: Ivan Tetyushkin --- .../boards/remote-gdbserver-on-localhost.exp | 30 +++++++++++++++++-- 1 file changed, 28 insertions(+), 2 deletions(-) diff --git a/gdb/testsuite/boards/remote-gdbserver-on-localhost.exp b/gdb/testsuite/boards/remote-gdbserver-on-localhost.exp index dacbbfb6f28..f74b549f28f 100644 --- a/gdb/testsuite/boards/remote-gdbserver-on-localhost.exp +++ b/gdb/testsuite/boards/remote-gdbserver-on-localhost.exp @@ -18,7 +18,8 @@ # # To use this file: # bash$ cd ${build_dir}/gdb -# bash$ make check RUNTESTFLAGS="--target_board=remote-gdbserver-on-localhost" +# bash$ make check RUNTESTFLAGS="--target_board=remote-gdbserver-on-localhost +# [ REMOTE_TARGET_USERNAME= ]" load_generic_config "gdbserver" load_board_description "gdbserver-base" @@ -29,9 +30,34 @@ load_board_description "gdbserver-base" set_board_info rcp_prog "/usr/bin/scp" set_board_info rsh_prog "/usr/bin/ssh" set_board_info protocol standard -set_board_info username $env(USER) +if { [info exists REMOTE_TARGET_USERNAME] } { + set_board_info username $REMOTE_TARGET_USERNAME +} else { + set_board_info username $env(USER) +} set_board_info hostname localhost +# Handle separate test account. +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 build can't see files on remote target. We can't use + # remote_exec target, because we're in the middle of parsing the + # target board. + remote_exec build \ + "[board_info $board rsh_prog] \ + -l [board_info $board username] \ + [board_info $board hostname] \ + chmod go-rx ." +} + + proc ${board}_spawn { board cmd } { global board_info From patchwork Mon Nov 7 16:13:28 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom de Vries X-Patchwork-Id: 60125 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 D75A93857B81 for ; Mon, 7 Nov 2022 16:15:01 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org D75A93857B81 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1667837701; bh=Nth7QrwrTAz23ex4A8P7ubbdHixsdFUhw/YUPiaf3sI=; 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=E1Q8OB9h/VwRo9/UuqAZdyW+abG3fKTlTmumgVyheWmiMtrporixA5iN50kfKEKRI PdV6eyqjnJEvbE3plONXGtMkZzSs8XfpPiG6TUiXkR7BtyGIXI+4aUPZCd9RxL0mpb 4mGKXHAcLI8j48xQ/H6mmRzCaf6Ukxddf6TzY5iY= 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 1218D3858CDB for ; Mon, 7 Nov 2022 16:13:35 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 1218D3858CDB 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 4689C22628 for ; Mon, 7 Nov 2022 16:13: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 3366113494 for ; Mon, 7 Nov 2022 16:13:34 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id EHJtC64uaWPsTwAAMHmgww (envelope-from ) for ; Mon, 07 Nov 2022 16:13:34 +0000 To: gdb-patches@sourceware.org Subject: [PATCH 4/9] [gdb/testsuite] Fix gdb.base/print-file-var.exp for remote target Date: Mon, 7 Nov 2022 17:13:28 +0100 Message-Id: <20221107161333.16999-5-tdevries@suse.de> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20221107161333.16999-1-tdevries@suse.de> References: <20221107161333.16999-1-tdevries@suse.de> MIME-Version: 1.0 X-Spam-Status: No, score=-12.6 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" When running test-case gdb.base/print-file-var.exp with target board remote-gdbserver-on-localhost (using REMOTE_TARGET_USERNAME) we run into some failures. Fix these by using the name of a shared lib as returned by gdb_load_shlib. This required splitting up the gdb_load_shlib functionality, which is now defined as: ... proc gdb_load_shlib { file } { set dest [gdb_download_shlib $file] gdb_locate_shlib $file return $dest } ... such that we can do gdb_download_shlib before gdb is started. Tested on x86_64-linux. Co-Authored-by: Ivan Tetyushkin --- gdb/testsuite/gdb.base/print-file-var.exp | 6 ++-- gdb/testsuite/lib/gdb.exp | 40 ++++++++++++++--------- 2 files changed, 29 insertions(+), 17 deletions(-) diff --git a/gdb/testsuite/gdb.base/print-file-var.exp b/gdb/testsuite/gdb.base/print-file-var.exp index 9abe87d7758..841eb22d957 100644 --- a/gdb/testsuite/gdb.base/print-file-var.exp +++ b/gdb/testsuite/gdb.base/print-file-var.exp @@ -59,8 +59,10 @@ proc test {hidden dlopen version_id_main lang} { set main_opts [list debug $lang] set link_opts [list debug shlib=${libobj1}] + set target_libobj2 [gdb_download_shlib $libobj2] + if {$dlopen} { - lappend main_opts "additional_flags=-DSHLIB_NAME=\"$libobj2\"" + lappend main_opts "additional_flags=-DSHLIB_NAME=\"$target_libobj2\"" lappend link_opts "shlib_load" } else { lappend link_opts "shlib=${libobj2}" @@ -79,7 +81,7 @@ proc test {hidden dlopen version_id_main lang} { clean_restart $executable gdb_load_shlib $libobj1 - gdb_load_shlib $libobj2 + gdb_locate_shlib $libobj2 if ![runto_main] { return -1 diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp index e2cda30b95a..ef609e6e37e 100644 --- a/gdb/testsuite/lib/gdb.exp +++ b/gdb/testsuite/lib/gdb.exp @@ -5869,30 +5869,40 @@ proc gdb_remote_download {dest fromfile {tofile {}}} { } } -# gdb_load_shlib LIB... -# -# Copy the listed library to the target. +# Copy shlib FILE to the target. -proc gdb_load_shlib { file } { +proc gdb_download_shlib { file } { + return [gdb_remote_download target [shlib_target_file $file]] +} + +# Set solib-search-path to allow gdb to locate shlib FILE. + +proc gdb_locate_shlib { file } { global gdb_spawn_id if ![info exists gdb_spawn_id] { perror "gdb_load_shlib: GDB is not running" } - set dest [gdb_remote_download target [shlib_target_file $file]] - - if {[is_remote target]} { - # If the target is remote, we need to tell gdb where to find the - # libraries. - # - # We could set this even when not testing remotely, but a user - # generally won't set it unless necessary. In order to make the tests - # more like the real-life scenarios, we don't set it for local testing. - gdb_test "set solib-search-path [file dirname $file]" "" \ - "set solib-search-path for [file tail $file]" + # If the target is remote, we need to tell gdb where to find the + # libraries. + if { ![is_remote target] } { + return } + # We could set this even when not testing remotely, but a user + # generally won't set it unless necessary. In order to make the tests + # more like the real-life scenarios, we don't set it for local testing. + gdb_test "set solib-search-path [file dirname $file]" "" \ + "set solib-search-path for [file tail $file]" +} + +# Copy shlib FILE to the target and set solib-search-path to allow gdb to +# locate it. + +proc gdb_load_shlib { file } { + set dest [gdb_download_shlib $file] + gdb_locate_shlib $file return $dest } From patchwork Mon Nov 7 16:13:29 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom de Vries X-Patchwork-Id: 60126 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 C22953857B87 for ; Mon, 7 Nov 2022 16:15:02 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org C22953857B87 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1667837702; bh=3BGXFM4CWru77GqK3lYINfN7r/kz8ok63b7YsmiMhrw=; 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=hm4lOrDmWeu3GIByVpRnBdAZ2wR1T1/rBSwvAnD9zf+C7FWUWRsau/NJKnK748y11 WuM/4NB4LYOE7zVPAUYdZeebAEAkUYK+u3bCdKU63XGu0yNruq47bWrFUXlonPlenx MEXNWuFh762/GJP82rzAkc80ubGOuzsbh8a7ya8g= 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 328B43858C83 for ; Mon, 7 Nov 2022 16:13:35 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 328B43858C83 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 5F32522629 for ; Mon, 7 Nov 2022 16:13: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 4BC3B13494 for ; Mon, 7 Nov 2022 16:13:34 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id qM9YEa4uaWPsTwAAMHmgww (envelope-from ) for ; Mon, 07 Nov 2022 16:13:34 +0000 To: gdb-patches@sourceware.org Subject: [PATCH 5/9] [gdb/testsuite] Fix gdb.base/infcall-exec.exp for remote target Date: Mon, 7 Nov 2022 17:13:29 +0100 Message-Id: <20221107161333.16999-6-tdevries@suse.de> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20221107161333.16999-1-tdevries@suse.de> References: <20221107161333.16999-1-tdevries@suse.de> MIME-Version: 1.0 X-Spam-Status: No, score=-12.6 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, KAM_SHORT, 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" When running test-case gdb.base/infcall-exec.exp with target board remote-gdbserver-on-localhost (using REMOTE_TARGET_USERNAME) we run into: ... (gdb) call (int) execlp ("$outputs/gdb.base/infcall-exec/infcall-exec2", \ "$outputs/gdb.base/infcall-exec/infcall-exec2", (char *)0)^M $1 = -1^M (gdb) FAIL: gdb.base/infcall-exec.exp: call execlp ... Fix this by using just: ... (gdb) call (int) execlp ("infcall-exec2", "infcall-exec2", (char *)0)^M ... and using putenv ("PATH=...") to allow infcall-exec to exec infcall-exec2 if it's available alongside. Also fix the exec name in the test-case, such that we can successfully run the test-case: ... $ ./outputs/gdb.base/infcall-exec/infcall-exec PATH SETTING: 'PATH=./outputs/gdb.base/infcall-exec' $ ... Tested on x86_64-linux. Co-Authored-by: Ivan Tetyushkin --- gdb/testsuite/gdb.base/infcall-exec.c | 48 +++++++++++++++++++++++-- gdb/testsuite/gdb.base/infcall-exec.exp | 10 +++++- 2 files changed, 55 insertions(+), 3 deletions(-) diff --git a/gdb/testsuite/gdb.base/infcall-exec.c b/gdb/testsuite/gdb.base/infcall-exec.c index 75b629872d0..49c1f40a8d9 100644 --- a/gdb/testsuite/gdb.base/infcall-exec.c +++ b/gdb/testsuite/gdb.base/infcall-exec.c @@ -16,13 +16,57 @@ along with this program. If not, see . */ #include +#include +#include +#include +#include +#include + +static void +set_path (int argc, char ** argv) +{ + if (argc < 1) + return; + + char path[PATH_MAX]; + strcpy (path, argv[0]); + int len = strlen (path); + + /* Make a path name out of an exec name. */ + int i; + for (i = len - 1; i >= 0; i--) + { + char c = path[i]; + if (c == '/' || c == '\\') + { + path[i] = '\0'; + break; + } + } + len = i; + + if (len == 0) + return; + + /* Prefix with "PATH=". */ + const char *prefix = "PATH="; + int prefix_len = strlen (prefix); + memmove (path + prefix_len, path, len); + path[prefix_len + len] = '\0'; + memcpy (path, prefix, prefix_len); + + printf ("PATH SETTING: '%s'\n", path); + putenv (path); +} int main (int argc, char ** argv) { - const char *prog = "inf-exec2"; + set_path (argc, argv); + const char *prog = "infcall-exec2"; - execlp (prog, prog, (char *) 0); + int res = execlp (prog, prog, (char *) 0); /* break here */ + assert (res != -1); return 0; } diff --git a/gdb/testsuite/gdb.base/infcall-exec.exp b/gdb/testsuite/gdb.base/infcall-exec.exp index e8f6a218c36..033dacb5e88 100644 --- a/gdb/testsuite/gdb.base/infcall-exec.exp +++ b/gdb/testsuite/gdb.base/infcall-exec.exp @@ -32,13 +32,21 @@ if {[gdb_compile $srcdir/$subdir/$srcfile2 $binfile2 executable debug] != ""} { return -1 } +if { [is_remote target] } { + set binfile2 [gdb_remote_download target $binfile2] +} + clean_restart $binfile if {![runto_main]} { return -1 } -set expected_result "process $decimal is executing new program: $binfile2" +set linenr [gdb_get_line_number "break here"] +gdb_breakpoint $linenr +gdb_continue_to_breakpoint "Ensure PATH is set" ".* break here .*" + +set expected_result "process $decimal is executing new program: \[^\r\n\]*$binfile2" append expected_result "\[\r\n\]+.*" append expected_result "Breakpoint 1, main .*at .*$srcfile2:$decimal" append expected_result ".*" From patchwork Mon Nov 7 16:13:30 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom de Vries X-Patchwork-Id: 60123 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 5D5F038582B9 for ; Mon, 7 Nov 2022 16:14:39 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 5D5F038582B9 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1667837679; bh=jhiC4UHU5A4GB26ccSrUqptO6BvH80Wylp2e3MAL40I=; 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=TFqlN0nFUhO5v95RyFOvO3ykdyHbmMtHk3o73O90tECGWWslgYiiM5YLf+HqgvtCk XqVjU68iD/Hu10bdyMVP87uguI43j0mfD55U/UlTp1SEAJvrPT10S/gVRMOX4FidH4 XzbM5dsE07wjfoKyztfWIa0BPNXTBr8l7i8BPkxA= 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 583423858C3A for ; Mon, 7 Nov 2022 16:13:37 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 583423858C3A 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 76E122262A for ; Mon, 7 Nov 2022 16:13: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 6409913494 for ; Mon, 7 Nov 2022 16:13:34 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id ODRKF64uaWPsTwAAMHmgww (envelope-from ) for ; Mon, 07 Nov 2022 16:13:34 +0000 To: gdb-patches@sourceware.org Subject: [PATCH 6/9] [gdb/testsuite] Fix gdb.base/solib-vanish.exp for remote target Date: Mon, 7 Nov 2022 17:13:30 +0100 Message-Id: <20221107161333.16999-7-tdevries@suse.de> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20221107161333.16999-1-tdevries@suse.de> References: <20221107161333.16999-1-tdevries@suse.de> MIME-Version: 1.0 X-Spam-Status: No, score=-12.6 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" When running test-case gdb.base/solib-vanish.exp with target board remote-gdbserver-on-localhost (using REMOTE_TARGET_USERNAME) we run into some failures. Fix these by adding the missing gdb_load_shlib. Tested on x86_64-linux. Co-Authored-by: Ivan Tetyushkin --- gdb/testsuite/gdb.base/solib-vanish.exp | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/gdb/testsuite/gdb.base/solib-vanish.exp b/gdb/testsuite/gdb.base/solib-vanish.exp index 5f47f2a80fd..6dfcd6f8bca 100644 --- a/gdb/testsuite/gdb.base/solib-vanish.exp +++ b/gdb/testsuite/gdb.base/solib-vanish.exp @@ -69,22 +69,31 @@ set srcfile_lib1 ${srcdir}/${subdir}/${lib1name}.c set binfile_lib1 [standard_output_file ${lib1name}.so] set lib1_flags [list debug shlib=${binfile_lib2}] +if { [gdb_compile_shlib ${srcfile_lib2} ${binfile_lib2} $lib2_flags] != "" + || [gdb_compile_shlib ${srcfile_lib1} ${binfile_lib1} $lib1_flags] != "" } { + untested "failed to compile" + return -1 +} + # Main program set testfile "solib-vanish-main" set srcfile ${srcdir}/${subdir}/${testfile}.c set executable ${testfile} set binfile [standard_output_file ${executable}] -set bin_flags [list debug shlib_load additional_flags=-DVANISH_LIB=\"${binfile_lib1}\"] +set bin_flags [list debug shlib_load] +set binfile_lib1_target [gdb_download_shlib $binfile_lib1] +lappend bin_flags additional_flags=-DVANISH_LIB=\"$binfile_lib1_target\" -if { [gdb_compile_shlib ${srcfile_lib2} ${binfile_lib2} $lib2_flags] != "" - || [gdb_compile_shlib ${srcfile_lib1} ${binfile_lib1} $lib1_flags] != "" - || [gdb_compile ${srcfile} ${binfile} executable $bin_flags] != "" } { +if { [gdb_compile ${srcfile} ${binfile} executable $bin_flags] != "" } { untested "failed to compile" return -1 } clean_restart $testfile +gdb_locate_shlib $binfile_lib1 +gdb_load_shlib $binfile_lib2 + if { ![runto_main] } { return } From patchwork Mon Nov 7 16:13:31 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom de Vries X-Patchwork-Id: 60122 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 A88253857BAF for ; Mon, 7 Nov 2022 16:14:33 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org A88253857BAF DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1667837673; bh=RLgLVFHlrF1qRgnbqsQTWTfsajrrnTAk3g4y1fkSOaw=; 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=hSqQZOG5HQ1wsi6vqmZT3RFp77yyTF8WS8Y8uz4XsKBTqVrBqbPZmi/UcXQOJCuBs 5p99feZiEyxRG2Fw9VvzUta0+BSbahCZ2ge57HTC2A7Fa3+4S2kdBPAvVxPoEIAazN Iv6L0aktEx+dD2OVHOFv/99L9qsSyPyPdq+tNUCs= 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 5C4C13858C55 for ; Mon, 7 Nov 2022 16:13:35 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 5C4C13858C55 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 8FB9E1F889 for ; Mon, 7 Nov 2022 16:13: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 7BA4B13494 for ; Mon, 7 Nov 2022 16:13:34 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id UDYlHa4uaWPsTwAAMHmgww (envelope-from ) for ; Mon, 07 Nov 2022 16:13:34 +0000 To: gdb-patches@sourceware.org Subject: [PATCH 7/9] [gdb/testsuite] Fix gdb.base/info-shared.exp for remote target Date: Mon, 7 Nov 2022 17:13:31 +0100 Message-Id: <20221107161333.16999-8-tdevries@suse.de> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20221107161333.16999-1-tdevries@suse.de> References: <20221107161333.16999-1-tdevries@suse.de> MIME-Version: 1.0 X-Spam-Status: No, score=-12.6 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.base/info-shared.exp and target board remote-gdbserver-on-localhost (using REMOTE_TARGET_USERNAME) we run into some failures. Fix these by adding the missing gdb_load_shlib. Tested on x86_64-linux. Co-Authored-by: Ivan Tetyushkin --- gdb/testsuite/gdb.base/info-shared.exp | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/gdb/testsuite/gdb.base/info-shared.exp b/gdb/testsuite/gdb.base/info-shared.exp index 290ae5793dc..8d3484b186c 100644 --- a/gdb/testsuite/gdb.base/info-shared.exp +++ b/gdb/testsuite/gdb.base/info-shared.exp @@ -22,12 +22,10 @@ standard_testfile set lib1name $testfile-solib1 set srcfile_lib1 $srcdir/$subdir/$lib1name.c set binfile_lib1 [standard_output_file $lib1name.so] -set define1 -DSHLIB1_NAME=\"$binfile_lib1\" set lib2name $testfile-solib2 set srcfile_lib2 $srcdir/$subdir/$lib2name.c set binfile_lib2 [standard_output_file $lib2name.so] -set define2 -DSHLIB2_NAME=\"$binfile_lib2\" if { [gdb_compile_shlib $srcfile_lib1 $binfile_lib1 {}] != "" } { untested "failed to compile shared library 1" @@ -39,12 +37,21 @@ if { [gdb_compile_shlib $srcfile_lib2 $binfile_lib2 {}] != "" } { return -1 } +set binfile_lib1_target [gdb_download_shlib $binfile_lib1] +set binfile_lib2_target [gdb_download_shlib $binfile_lib2] + +set define2 -DSHLIB2_NAME=\"$binfile_lib2_target\" +set define1 -DSHLIB1_NAME=\"$binfile_lib1_target\" + set cflags "$define1 $define2" if { [prepare_for_testing "failed to prepare" $testfile $srcfile \ [list additional_flags=$cflags shlib_load]] } { return -1 } +gdb_locate_shlib $binfile_lib1 +gdb_locate_shlib $binfile_lib2 + # Run "info sharedlibrary" and check for the presence or absence of # our libraries. proc check_info_shared { test expect1 expect2 } { From patchwork Mon Nov 7 16:13:32 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom de Vries X-Patchwork-Id: 60120 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 55ED23857BA7 for ; Mon, 7 Nov 2022 16:14:24 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 55ED23857BA7 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1667837664; bh=xn9FpqAFfhkbjx+2jYr8Ts00zsB2vPenriXXZN6fHt4=; 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=Wtxhs5M9MQAxaAmD1XJdZki7o9UoG2vmFZ+unk4AlQB6RiEiyLv8kCiuJLktMQpQc novyRxs+DFcb5+dho2gQfhwgqkFChISjQU0/PsrXJ5j2MnspIV9rpBp6xDEn1/6y5Z gNFrlcARYrPzR+z1HKJxsKK95vyC42GLAQ8cBkb0= 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 7D6A83858C56 for ; Mon, 7 Nov 2022 16:13:35 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 7D6A83858C56 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 A9E1B1F88B for ; Mon, 7 Nov 2022 16:13: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 95DE413494 for ; Mon, 7 Nov 2022 16:13:34 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id AANmI64uaWPsTwAAMHmgww (envelope-from ) for ; Mon, 07 Nov 2022 16:13:34 +0000 To: gdb-patches@sourceware.org Subject: [PATCH 8/9] [gdb/testsuite] Fix gdb.base/jit-reader-exec.exp for remote target Date: Mon, 7 Nov 2022 17:13:32 +0100 Message-Id: <20221107161333.16999-9-tdevries@suse.de> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20221107161333.16999-1-tdevries@suse.de> References: <20221107161333.16999-1-tdevries@suse.de> MIME-Version: 1.0 X-Spam-Status: No, score=-12.6 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.base/jit-reader-exec.exp and target board remote-gdbserver-on-localhost (using REMOTE_TARGET_USERNAME) we run into some failures. Fix this by adding the missing gdb_remote_download. Tested on x86_64-linux. Co-Authored-by: Ivan Tetyushkin --- gdb/testsuite/gdb.base/jit-reader-exec.exp | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/gdb/testsuite/gdb.base/jit-reader-exec.exp b/gdb/testsuite/gdb.base/jit-reader-exec.exp index c5ee8ef89a3..ad47c5a9610 100644 --- a/gdb/testsuite/gdb.base/jit-reader-exec.exp +++ b/gdb/testsuite/gdb.base/jit-reader-exec.exp @@ -27,15 +27,19 @@ set testfile2 "jit-reader-execd" set srcfile2 ${testfile2}.c set binfile2 [standard_output_file ${testfile2}] -set compile_options [list debug additional_flags=-DPROGRAM=\"$binfile2\"] - -if {[gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" \ - executable $compile_options] != ""} { +if {[gdb_compile "${srcdir}/${subdir}/${srcfile2}" "${binfile2}" \ + executable {debug}] != ""} { untested "failed to compile" return -1 } -if {[gdb_compile "${srcdir}/${subdir}/${srcfile2}" "${binfile2}" \ +if { [is_remote target] } { + set binfile2 [gdb_remote_download target $binfile2] +} + +set compile_options [list debug additional_flags=-DPROGRAM=\"$binfile2\"] + +if {[gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" \ executable $compile_options] != ""} { untested "failed to compile" return -1 From patchwork Mon Nov 7 16:13:33 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom de Vries X-Patchwork-Id: 60124 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 256CA3857BAE for ; Mon, 7 Nov 2022 16:14:54 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 256CA3857BAE DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1667837694; bh=9pFF9TeGLcm8vdN004gE8U19yGaXEnAyZHSThtQ3ztc=; 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=mSi7P+9jiyexqr34/jt0gMWD+OJpLZ82ZsCRWLGwtKZkOBSpiIijY2MbgWqG3fTX4 xLecgSQcB2kNm/JSiDuWWi4yPRL3pYa/iTDOS6nRlPEj6Ei0Bu42cyI9Petw0KcUAW IfXt047bKsmhHWf2gTRLNzsITy2NN9pwLwqc1nGo= 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 55DF03858C39 for ; Mon, 7 Nov 2022 16:13:37 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 55DF03858C39 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 C2B212262B for ; Mon, 7 Nov 2022 16:13: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 AFD1413494 for ; Mon, 7 Nov 2022 16:13:34 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id AG7CKa4uaWPsTwAAMHmgww (envelope-from ) for ; Mon, 07 Nov 2022 16:13:34 +0000 To: gdb-patches@sourceware.org Subject: [PATCH 9/9] [gdb/testsuite] Fix gdb.base/jit-elf-so.exp for remote target Date: Mon, 7 Nov 2022 17:13:33 +0100 Message-Id: <20221107161333.16999-10-tdevries@suse.de> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20221107161333.16999-1-tdevries@suse.de> References: <20221107161333.16999-1-tdevries@suse.de> MIME-Version: 1.0 X-Spam-Status: No, score=-12.6 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.base/jit-elf-so.exp and target board remote-gdbserver-on-localhost (using REMOTE_TARGET_USERNAME) we run into some failures. Fix these by: - setting jit_libname with the name as returned by gdb_load_shlib - allowing the libraries to be prefixed with the remote target directory. Tested on x86_64-linux. Co-Authored-by: Ivan Tetyushkin --- gdb/testsuite/gdb.base/jit-elf-so.exp | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/gdb/testsuite/gdb.base/jit-elf-so.exp b/gdb/testsuite/gdb.base/jit-elf-so.exp index dcc9afc36b9..d5f56600701 100644 --- a/gdb/testsuite/gdb.base/jit-elf-so.exp +++ b/gdb/testsuite/gdb.base/jit-elf-so.exp @@ -73,10 +73,10 @@ proc one_jit_test {solib_binfiles_target match_str} { with_test_prefix "one_jit_test-$count" { global test_verbose global main_loader_binfile main_loader_srcfile - global main_solib_binfile main_solib_srcfile + global main_solib_binfile main_solib_binfile_target main_solib_srcfile clean_restart $main_loader_binfile - gdb_load_shlib $main_solib_binfile + gdb_locate_shlib $main_solib_binfile # This is just to help debugging when things fail if {$test_verbose > 0} { @@ -90,7 +90,7 @@ proc one_jit_test {solib_binfiles_target match_str} { gdb_breakpoint [gdb_get_line_number "break here before-dlopen" \ $main_loader_srcfile] gdb_continue_to_breakpoint "break here before-dlopen" - gdb_test_no_output "set var jit_libname = \"$main_solib_binfile\"" \ + gdb_test_no_output "set var jit_libname = \"$main_solib_binfile_target\"" \ "setting library name" gdb_breakpoint [gdb_get_line_number "break here after-dlopen" \ @@ -140,6 +140,9 @@ if { [compile_jit_elf_main_as_so $main_solib_srcfile $main_solib_binfile \ return } +set main_solib_binfile_target \ + [gdb_download_shlib $main_solib_binfile] + # Compile the "real" main for this test. if { [compile_jit_dlmain {shlib_load}] < 0 } { return @@ -161,6 +164,6 @@ foreach solib $jit_solibs_target { set input [string range $solib 0 [expr { [string length $solib] - 2 }]] gdb_test \ "complete jit-reader-load [standard_output_file $input]" \ - "jit-reader-load $solib" \ + "jit-reader-load \[^\r\n\]*$solib" \ "test jit-reader-load filename completion [file tail $solib]" }