From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) by sourceware.org (Postfix) with ESMTPS id E98383851ABF for ; Fri, 17 Mar 2023 15:07:37 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org E98383851ABF Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=suse.de Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=suse.de 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 C79441FDDF for ; Fri, 17 Mar 2023 15:07:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1679065656; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=7YvFKLCirLit5Q4kfjmry2eVm0AepezrsYqVgBjALdA=; b=SXQewXgMkZxnevXkPrZqIaYcrp4n95dsa+GOFgUdrLuoKgd0+N1S0WAImo03ctjyN6TvbJ 2cou5KKO/Cc3Ik8/GHJ/7xNaC0pTgySKHYfBbwEKMbVFELZqtvlGhK6SO/yrlo113tfOK1 6KQQcWZ+1+Ri/1ducxeGr5L9SfNhplg= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1679065656; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=7YvFKLCirLit5Q4kfjmry2eVm0AepezrsYqVgBjALdA=; b=bkJ6+Yi2fWwYQdxxg9jbvT9xRc1W+aPCE9DzS1QuD5dqQduFmfgIHuYwdCFpziUCAeZz3v Z/Hh2/RAe2oC73CQ== 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 B2E1B13428 for ; Fri, 17 Mar 2023 15:07:36 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id fPp2KjiCFGQ1DgAAMHmgww (envelope-from ) for ; Fri, 17 Mar 2023 15:07:36 +0000 From: Tom de Vries To: gdb-patches@sourceware.org Subject: [pushed 1/3] [gdb/testsuite] Handle precise-aligned-alloc.c for remote host Date: Fri, 17 Mar 2023 16:07:34 +0100 Message-Id: <20230317150736.11883-1-tdevries@suse.de> X-Mailer: git-send-email 2.35.3 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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 List-Id: With test-case gdb.arch/i386-sse.exp (and likewise gdb.arch/i386-avx.exp) and host board local-remote-host-notty and target board native-gdbserver I run into: ... gdb compile failed, i386-sse.c:68:10: fatal error: \ ../lib/precise-aligned-alloc.c: No such file or directory #include "../lib/precise-aligned-alloc.c" ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ... Fix this using '#include "precise-aligned-alloc.c"' and making that work with non-remote and remote host. Tested on x86_64-linux. --- gdb/testsuite/gdb.arch/i386-avx.c | 2 +- gdb/testsuite/gdb.arch/i386-avx.exp | 2 ++ gdb/testsuite/gdb.arch/i386-sse.c | 2 +- gdb/testsuite/gdb.arch/i386-sse.exp | 2 ++ gdb/testsuite/lib/gdb.exp | 16 ++++++++++++++++ 5 files changed, 22 insertions(+), 2 deletions(-) diff --git a/gdb/testsuite/gdb.arch/i386-avx.c b/gdb/testsuite/gdb.arch/i386-avx.c index 28c407db397..b778b3f1666 100644 --- a/gdb/testsuite/gdb.arch/i386-avx.c +++ b/gdb/testsuite/gdb.arch/i386-avx.c @@ -50,7 +50,7 @@ v8sf_t data_orig[] = #endif }; -#include "../lib/precise-aligned-alloc.c" +#include "precise-aligned-alloc.c" int main (int argc, char **argv) diff --git a/gdb/testsuite/gdb.arch/i386-avx.exp b/gdb/testsuite/gdb.arch/i386-avx.exp index ad2cb5852d1..55166849cde 100644 --- a/gdb/testsuite/gdb.arch/i386-avx.exp +++ b/gdb/testsuite/gdb.arch/i386-avx.exp @@ -30,6 +30,8 @@ set flags { debug } # C11 for _Alignas, gnu for asm. lappend flags additional_flags=-std=gnu11 +lappend_include_file flags $srcdir/lib/precise-aligned-alloc.c + if { [test_compiler_info gcc*] || [test_compiler_info clang*] } { lappend flags "additional_flags=-mavx -I${srcdir}/.." } diff --git a/gdb/testsuite/gdb.arch/i386-sse.c b/gdb/testsuite/gdb.arch/i386-sse.c index a5424f5b52a..8b1b0ec144b 100644 --- a/gdb/testsuite/gdb.arch/i386-sse.c +++ b/gdb/testsuite/gdb.arch/i386-sse.c @@ -65,7 +65,7 @@ have_sse (void) return 0; } -#include "../lib/precise-aligned-alloc.c" +#include "precise-aligned-alloc.c" int main (int argc, char **argv) diff --git a/gdb/testsuite/gdb.arch/i386-sse.exp b/gdb/testsuite/gdb.arch/i386-sse.exp index 6df98ec1219..3c66589ce49 100644 --- a/gdb/testsuite/gdb.arch/i386-sse.exp +++ b/gdb/testsuite/gdb.arch/i386-sse.exp @@ -32,6 +32,8 @@ if { [test_compiler_info gcc*] || [test_compiler_info clang*] } { lappend flags "additional_flags=-msse -I${srcdir}/.." } +lappend_include_file flags $srcdir/lib/precise-aligned-alloc.c + if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable \ $flags] != "" } { unsupported "compiler does not support SSE" diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp index 8b1127ce0bc..0e69bcab288 100644 --- a/gdb/testsuite/lib/gdb.exp +++ b/gdb/testsuite/lib/gdb.exp @@ -9491,5 +9491,21 @@ gdb_caching_proc have_compile_flag { flag } { additional_flags=$flag] } + +# Handle include file FILE, and if necessary update compiler flags variable +# FLAGS. + +proc lappend_include_file { flags file } { + upvar $flags up_flags + if { [is_remote host] } { + gdb_remote_download host $file + } else { + set dir [file dirname $file] + if { $dir != [file join $::srcdir $::subdir] } { + lappend up_flags "additional_flags=-I$dir" + } + } +} + # Always load compatibility stuff. load_lib future.exp base-commit: a14e3d11b2656355ca2c3d5b5a9f05e46f71e897 -- 2.35.3