From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp-out2.suse.de (smtp-out2.suse.de [IPv6:2001:67c:2178:6::1d]) by sourceware.org (Postfix) with ESMTPS id 8C0873858C50 for ; Sat, 18 Mar 2023 09:17:33 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 8C0873858C50 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 EE7FB1FE52 for ; Sat, 18 Mar 2023 09:17:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1679131051; 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=TOrPNnunJQ831NtIn2Pzl7IWtIsWu2Pi6vJmb7Dl3Lc=; b=wiv6t8ynHve/36d+ZV8zY4z1PzgXjeKFYC6fm4RJlpLwHySbSoh0gaH8Ud7DrXx0cFvVgY 3oAvCve3X5APgMdn06106eNWfh+XB8niZ9DlQvbXTvqMAlWPuHEDD5uMiKKEpVg3auew5n OUEWQ7yI9MIIT+MR8OESPrLelAjBCGQ= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1679131051; 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=TOrPNnunJQ831NtIn2Pzl7IWtIsWu2Pi6vJmb7Dl3Lc=; b=0prjkNAuIgyEwl+16pAjMF1/sWvbhu5eieC2uUd51UIMF3Ux2SL1AGMdpx5TDLer7bw2g/ MUCF9mZZlTU8WSDw== 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 D725813443 for ; Sat, 18 Mar 2023 09:17:31 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id d+tMM6uBFWTHUwAAMHmgww (envelope-from ) for ; Sat, 18 Mar 2023 09:17:31 +0000 From: Tom de Vries To: gdb-patches@sourceware.org Subject: [pushed] [gdb/testsuite] Handle attributes.h for remote host Date: Sat, 18 Mar 2023 10:17:30 +0100 Message-Id: <20230318091730.19754-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.4 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 List-Id: Handle $srcdir/lib/attributes.h using lappend_include_dir. Tested on x86_64-linux. --- gdb/testsuite/gdb.base/backtrace.c | 2 +- gdb/testsuite/gdb.base/backtrace.exp | 6 ++- .../gdb.base/frame-info-consistent.exp | 6 ++- .../gdb.base/infcall-nested-structs.c | 2 +- .../gdb.base/infcall-nested-structs.exp.tcl | 2 + gdb/testsuite/gdb.base/stap-probe.c | 2 +- gdb/testsuite/gdb.base/stap-probe.exp | 23 +++++++++-- gdb/testsuite/gdb.base/vla-optimized-out.c | 2 +- gdb/testsuite/gdb.base/vla-optimized-out.exp | 1 + gdb/testsuite/gdb.cp/cold-clone.cc | 2 +- gdb/testsuite/gdb.cp/cold-clone.exp | 9 ++++- .../gdb.dwarf2/dyn-type-unallocated.c | 2 +- .../gdb.dwarf2/dyn-type-unallocated.exp | 39 ++++++++++++++----- .../gdb.python/tui-window-disabled.c | 2 +- .../gdb.python/tui-window-disabled.exp | 6 ++- 15 files changed, 81 insertions(+), 25 deletions(-) diff --git a/gdb/testsuite/gdb.base/backtrace.c b/gdb/testsuite/gdb.base/backtrace.c index f615d857110..4928bae05a4 100644 --- a/gdb/testsuite/gdb.base/backtrace.c +++ b/gdb/testsuite/gdb.base/backtrace.c @@ -15,7 +15,7 @@ You should have received a copy of the GNU General Public License along with this program. If not, see . */ -#include "../lib/attributes.h" +#include "attributes.h" int __attribute__((noinline)) ATTRIBUTE_NOCLONE baz () diff --git a/gdb/testsuite/gdb.base/backtrace.exp b/gdb/testsuite/gdb.base/backtrace.exp index 4389273123c..c7355cef375 100644 --- a/gdb/testsuite/gdb.base/backtrace.exp +++ b/gdb/testsuite/gdb.base/backtrace.exp @@ -17,7 +17,11 @@ standard_testfile -if { [prepare_for_testing "failed to prepare" $testfile $srcfile] } { +set flags {} +lappend flags debug +lappend_include_file flags $srcdir/lib/attributes.h + +if { [prepare_for_testing "failed to prepare" $testfile $srcfile $flags] } { return -1 } diff --git a/gdb/testsuite/gdb.base/frame-info-consistent.exp b/gdb/testsuite/gdb.base/frame-info-consistent.exp index 4893c2227f3..30185c3c4f4 100644 --- a/gdb/testsuite/gdb.base/frame-info-consistent.exp +++ b/gdb/testsuite/gdb.base/frame-info-consistent.exp @@ -21,7 +21,11 @@ standard_testfile backtrace.c -if { [build_executable "failed to prepare" $testfile $srcfile] } { +set flags {} +lappend flags debug +lappend_include_file flags $srcdir/lib/attributes.h + +if { [build_executable "failed to prepare" $testfile $srcfile $flags] } { return -1 } diff --git a/gdb/testsuite/gdb.base/infcall-nested-structs.c b/gdb/testsuite/gdb.base/infcall-nested-structs.c index ff4b64f28c9..f741728d4cc 100644 --- a/gdb/testsuite/gdb.base/infcall-nested-structs.c +++ b/gdb/testsuite/gdb.base/infcall-nested-structs.c @@ -33,7 +33,7 @@ in the structs.exp test script. */ #include -#include "../lib/attributes.h" +#include "attributes.h" /* Useful abreviations. */ typedef char tc; diff --git a/gdb/testsuite/gdb.base/infcall-nested-structs.exp.tcl b/gdb/testsuite/gdb.base/infcall-nested-structs.exp.tcl index d9d2fa519d2..f7f036b4217 100644 --- a/gdb/testsuite/gdb.base/infcall-nested-structs.exp.tcl +++ b/gdb/testsuite/gdb.base/infcall-nested-structs.exp.tcl @@ -40,6 +40,8 @@ if { $lang == "c++" && [test_compiler_info clang*] } { lappend compile_flags "additional_flags=-Wno-tautological-compare" } +lappend_include_file compile_flags $srcdir/lib/attributes.h + # Given N (0..25), return the corresponding alphabetic letter in upper # case. diff --git a/gdb/testsuite/gdb.base/stap-probe.c b/gdb/testsuite/gdb.base/stap-probe.c index 5cd1fbfe36b..36ce2da7847 100644 --- a/gdb/testsuite/gdb.base/stap-probe.c +++ b/gdb/testsuite/gdb.base/stap-probe.c @@ -15,7 +15,7 @@ You should have received a copy of the GNU General Public License along with this program. If not, see . */ -#include "../lib/attributes.h" +#include "attributes.h" #if USE_SEMAPHORES diff --git a/gdb/testsuite/gdb.base/stap-probe.exp b/gdb/testsuite/gdb.base/stap-probe.exp index 1beb05203c1..06aa6665022 100644 --- a/gdb/testsuite/gdb.base/stap-probe.exp +++ b/gdb/testsuite/gdb.base/stap-probe.exp @@ -113,8 +113,15 @@ proc check_for_usable_xmm0_probe { binfile } { proc stap_test {exec_name {args ""}} { global testfile hex srcfile + set flags {} + lappend flags debug + lappend_include_file flags $::srcdir/lib/attributes.h + if { $args != "" } { + set flags [concat $flags $args] + } + if {[prepare_for_testing "failed to prepare" ${exec_name} $srcfile \ - [concat $args debug]]} { + $flags]} { return -1 } @@ -233,10 +240,18 @@ proc stap_test {exec_name {args ""}} { } proc stap_test_no_debuginfo {exec_name {args ""}} { - global testfile hex + global hex + + set flags {} + lappend flags nodebug + lappend flags optimize=-O2 + lappend_include_file flags $::srcdir/lib/attributes.h + if { $args != "" } { + set flags [concat $flags $args] + } - if {[prepare_for_testing "failed to prepare" ${exec_name} ${testfile}.c \ - [concat $args nodebug optimize=-O2]]} { + if {[prepare_for_testing "failed to prepare" ${exec_name} $::srcfile \ + $flags]} { return -1 } diff --git a/gdb/testsuite/gdb.base/vla-optimized-out.c b/gdb/testsuite/gdb.base/vla-optimized-out.c index c1e7c609b5a..7ae7e612be9 100644 --- a/gdb/testsuite/gdb.base/vla-optimized-out.c +++ b/gdb/testsuite/gdb.base/vla-optimized-out.c @@ -18,7 +18,7 @@ /* The version of this test-case with f1 tagged with noinline only is equivalent to gcc/testsuite/gcc.dg/guality/vla-1.c. */ -#include "../lib/attributes.h" +#include "attributes.h" int #ifdef NOCLONE diff --git a/gdb/testsuite/gdb.base/vla-optimized-out.exp b/gdb/testsuite/gdb.base/vla-optimized-out.exp index b31b9ec9706..c0681bc8904 100644 --- a/gdb/testsuite/gdb.base/vla-optimized-out.exp +++ b/gdb/testsuite/gdb.base/vla-optimized-out.exp @@ -26,6 +26,7 @@ proc vla_optimized_out {exe_suffix options} { global testfile srcfile lassign $options compile_flags sizeof_result + lappend_include_file compile_flags $::srcdir/lib/attributes.h if { [prepare_for_testing "failed to prepare" "$testfile-$exe_suffix" $srcfile \ $compile_flags] } { diff --git a/gdb/testsuite/gdb.cp/cold-clone.cc b/gdb/testsuite/gdb.cp/cold-clone.cc index b45d93752af..533c1e97a4a 100644 --- a/gdb/testsuite/gdb.cp/cold-clone.cc +++ b/gdb/testsuite/gdb.cp/cold-clone.cc @@ -16,7 +16,7 @@ along with this program. If not, see . */ #include -#include "../lib/attributes.h" +#include "attributes.h" int a; int b; diff --git a/gdb/testsuite/gdb.cp/cold-clone.exp b/gdb/testsuite/gdb.cp/cold-clone.exp index 0a2b0790ec0..415d7a64964 100644 --- a/gdb/testsuite/gdb.cp/cold-clone.exp +++ b/gdb/testsuite/gdb.cp/cold-clone.exp @@ -15,8 +15,13 @@ standard_testfile .cc -if {[prepare_for_testing "failed to prepare" $testfile $srcfile \ - {debug c++ optimize=-O2}]} { +set flags {} +lappend flags debug +lappend flags c++ +lappend flags optimize=-O2 +lappend_include_file flags $srcdir/lib/attributes.h + +if {[prepare_for_testing "failed to prepare" $testfile $srcfile $flags]} { return -1 } diff --git a/gdb/testsuite/gdb.dwarf2/dyn-type-unallocated.c b/gdb/testsuite/gdb.dwarf2/dyn-type-unallocated.c index 436c5698c46..843646652c0 100644 --- a/gdb/testsuite/gdb.dwarf2/dyn-type-unallocated.c +++ b/gdb/testsuite/gdb.dwarf2/dyn-type-unallocated.c @@ -15,7 +15,7 @@ You should have received a copy of the GNU General Public License along with this program. If not, see . */ -#include "../lib/attributes.h" +#include "attributes.h" /* Our fake dynamic object. */ void *dyn_object; diff --git a/gdb/testsuite/gdb.dwarf2/dyn-type-unallocated.exp b/gdb/testsuite/gdb.dwarf2/dyn-type-unallocated.exp index 88fd331781d..5d0dfcc291d 100644 --- a/gdb/testsuite/gdb.dwarf2/dyn-type-unallocated.exp +++ b/gdb/testsuite/gdb.dwarf2/dyn-type-unallocated.exp @@ -38,12 +38,30 @@ require dwarf2_support standard_testfile .c -dw.S -if { [prepare_for_testing "failed to prepare" ${testfile} ${srcfile}] } { +set flags {} +lappend flags debug +lappend_include_file flags $srcdir/lib/attributes.h + +if { [prepare_for_testing "failed to prepare" ${testfile} ${srcfile} $flags] } { return -1 } +with_shared_gdb { + set func_info_vars [get_func_info main $flags] + + set int_size [get_sizeof "int" "UNKNOWN"] + set voidp_size [get_sizeof "void *" "UNKNOWN"] +} + set asm_file [standard_output_file $srcfile2] Dwarf::assemble $asm_file { + global func_info_vars + foreach var $func_info_vars { + global $var + } + global int_size + global voidp_size + cu {} { global srcfile @@ -55,9 +73,6 @@ Dwarf::assemble $asm_file { } { declare_labels array_type_label integer_type_label - set int_size [get_sizeof "int" "UNKNOWN"] - set voidp_size [get_sizeof "void *" "UNKNOWN"] - integer_type_label: DW_TAG_base_type { {DW_AT_byte_size $int_size DW_FORM_sdata} {DW_AT_encoding @DW_ATE_signed} @@ -95,16 +110,22 @@ Dwarf::assemble $asm_file { {name "dyn_object"} {type :$array_type_label} } - subprogram { - {external 1 flag} - {MACRO_AT_func {main}} - } + subprogram { + {external 1 flag} + {DW_AT_name main} + {DW_AT_low_pc $main_start DW_FORM_addr} + {DW_AT_high_pc $main_end DW_FORM_addr} + } } } } +set flags {} +lappend flags {nodebug} +lappend_include_file flags $srcdir/lib/attributes.h + if { [prepare_for_testing "failed to prepare" "${testfile}" \ - [list $srcfile $asm_file] {nodebug}] } { + [list $srcfile $asm_file] $flags] } { return -1 } diff --git a/gdb/testsuite/gdb.python/tui-window-disabled.c b/gdb/testsuite/gdb.python/tui-window-disabled.c index 833c6a3a751..111f7adcdc1 100644 --- a/gdb/testsuite/gdb.python/tui-window-disabled.c +++ b/gdb/testsuite/gdb.python/tui-window-disabled.c @@ -15,7 +15,7 @@ You should have received a copy of the GNU General Public License along with this program. If not, see . */ -#include "../lib/attributes.h" +#include "attributes.h" volatile int val; diff --git a/gdb/testsuite/gdb.python/tui-window-disabled.exp b/gdb/testsuite/gdb.python/tui-window-disabled.exp index 57d41cdbf8b..b2beb77c217 100644 --- a/gdb/testsuite/gdb.python/tui-window-disabled.exp +++ b/gdb/testsuite/gdb.python/tui-window-disabled.exp @@ -27,7 +27,11 @@ tuiterm_env standard_testfile -if {[build_executable "failed to prepare" ${testfile} ${srcfile}] == -1} { +set flags {} +lappend flags debug +lappend_include_file flags $srcdir/lib/attributes.h + +if {[build_executable "failed to prepare" ${testfile} ${srcfile} $flags] == -1} { return -1 } base-commit: 9e4b2a6697006f9ff39bce13edd640330e208c9f -- 2.35.3