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 17FFB38582B5 for ; Thu, 22 Sep 2022 15:20:44 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 17FFB38582B5 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 418DF1F962 for ; Thu, 22 Sep 2022 15:20:43 +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 291DB1346B for ; Thu, 22 Sep 2022 15:20:43 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id 4Jf3CEt9LGNnLQAAMHmgww (envelope-from ) for ; Thu, 22 Sep 2022 15:20:43 +0000 From: Tom de Vries To: gdb-patches@sourceware.org Subject: [PATCH 3/3] [gdb/testsuite] Fix ctf test-cases on openSUSE Tumbleweed Date: Thu, 22 Sep 2022 17:20:42 +0200 Message-Id: <20220922152042.21914-3-tdevries@suse.de> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20220922152042.21914-1-tdevries@suse.de> References: <20220922152042.21914-1-tdevries@suse.de> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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-List-Received-Date: Thu, 22 Sep 2022 15:20:45 -0000 When running test-case gdb.base/ctf-constvars.exp on openSUSE Tumbleweed (with system gcc version 12, providing gcc -gctf support, enabling the ctf test-cases in the gdb testsuite), I run into: ... (gdb) print vox^M 'vox' has unknown type; cast it to its declared type^M (gdb) FAIL: gdb.base/ctf-constvars.exp: print vox ... There are two causes for this: - the linker flags are missing --ctf-variables, so the information for variable vox is missing (reported in PR29468), and - the executable contains some dwarf2 due to some linked-in glibc objects, so the ctf info is ignored (reported in PR29160). By using: - maint set symbol-read-order ctf, and - -Wl,--ctf-variable, we can make the test-case and some similar test-cases pass. The expection is gdb.ctf/funcreturn.exp, which is still failing because the exec is also missing the function info. A PR ld/29594 is open about that, so add an xfail. Tested on x86_64-linux. Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=29160 Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=29468 --- gdb/testsuite/gdb.base/ctf-constvars.exp | 14 ++++++++++---- gdb/testsuite/gdb.base/ctf-ptype.exp | 15 ++++++++++----- gdb/testsuite/gdb.ctf/cross-tu-cyclic.exp | 16 +++++++++++----- gdb/testsuite/gdb.ctf/funcreturn.exp | 22 ++++++++++++++++------ gdb/testsuite/gdb.ctf/multi.exp | 15 ++++++++++----- 5 files changed, 57 insertions(+), 25 deletions(-) diff --git a/gdb/testsuite/gdb.base/ctf-constvars.exp b/gdb/testsuite/gdb.base/ctf-constvars.exp index 6255e9ed02b..f8d78acfcb5 100644 --- a/gdb/testsuite/gdb.base/ctf-constvars.exp +++ b/gdb/testsuite/gdb.base/ctf-constvars.exp @@ -32,10 +32,16 @@ if [skip_ctf_tests] { standard_testfile .c # Using `-gctf` generates full-fledged CTF debug information. -set opts "additional_flags=-gctf" -if { [prepare_for_testing "failed to prepare" ${testfile} \ - [list $srcfile] [list $opts nowarnings]] } { - return 0 +set opts {} +lappend opts "additional_flags=-gctf" +lappend opts "additional_flags=-Wl,-ctf-variables" +lappend opts "nowarnings" +save_vars { GDBFLAGS } { + append GDBFLAGS " -iex \"maint set symbol-read-order ctf\"" + if { [prepare_for_testing "failed to prepare" ${testfile} \ + [list $srcfile] $opts] } { + return 0 + } } # diff --git a/gdb/testsuite/gdb.base/ctf-ptype.exp b/gdb/testsuite/gdb.base/ctf-ptype.exp index 48d39e56c7b..e9c5bce15c2 100644 --- a/gdb/testsuite/gdb.base/ctf-ptype.exp +++ b/gdb/testsuite/gdb.base/ctf-ptype.exp @@ -26,11 +26,16 @@ set gcc_compiled [is_c_compiler_gcc] standard_testfile .c # Using `-gctf` generates full-fledged CTF debug information. -set opts "additional_flags=-gctf" - -if { [prepare_for_testing "failed to prepare" ${testfile} \ - [list $srcfile] [list $opts nowarnings]] } { - return 0 +set opts {} +lappend opts "additional_flags=-gctf" +lappend opts "additional_flags=-Wl,-ctf-variables" +lappend opts "nowarnings" +save_vars { GDBFLAGS } { + append GDBFLAGS " -iex \"maint set symbol-read-order ctf\"" + if { [prepare_for_testing "failed to prepare" ${testfile} \ + [list $srcfile] $opts] } { + return 0 + } } # Test ptype of unnamed enumeration members before any action causes diff --git a/gdb/testsuite/gdb.ctf/cross-tu-cyclic.exp b/gdb/testsuite/gdb.ctf/cross-tu-cyclic.exp index a43e36bbe68..d573e7d63ab 100644 --- a/gdb/testsuite/gdb.ctf/cross-tu-cyclic.exp +++ b/gdb/testsuite/gdb.ctf/cross-tu-cyclic.exp @@ -24,11 +24,17 @@ standard_testfile cross-tu-cyclic-1.c cross-tu-cyclic-2.c \ cross-tu-cyclic-3.c cross-tu-cyclic-4.c # Using `-gctf` generates full-fledged CTF debug information. -set opts "additional_flags=-gctf -Wl,--export-dynamic" -if { [prepare_for_testing "failed to prepare" ${testfile} \ - [list $srcfile $srcfile2 $srcfile3 $srcfile4] \ - [list $opts nowarnings]] } { - return 0 +set opts {} +lappend opts "additional_flags=-gctf" +lappend opts "additional_flags=-Wl,--export-dynamic" +lappend opts "nowarnings" +save_vars { GDBFLAGS } { + append GDBFLAGS " -iex \"maint set symbol-read-order ctf\"" + if { [prepare_for_testing "failed to prepare" ${testfile} \ + [list $srcfile $srcfile2 $srcfile3 $srcfile4] \ + $opts] } { + return 0 + } } # Same thing with struct and union. diff --git a/gdb/testsuite/gdb.ctf/funcreturn.exp b/gdb/testsuite/gdb.ctf/funcreturn.exp index ea01e860a84..ece2d013c07 100644 --- a/gdb/testsuite/gdb.ctf/funcreturn.exp +++ b/gdb/testsuite/gdb.ctf/funcreturn.exp @@ -30,18 +30,28 @@ set gcc_compiled [is_c_compiler_gcc] standard_testfile whatis.c # Using `-gctf` generates full-fledged CTF debug information. -set opts "additional_flags=-gctf -Wl,--export-dynamic" - +set opts {} +lappend opts "additional_flags=-gctf" +lappend opts "additional_flags=-Wl,--export-dynamic" +lappend opts "additional_flags=-Wl,-ctf-variables" +lappend opts "nowarnings" if { [prepare_for_testing "failed to prepare" ${testfile} \ - [list $srcfile] [list $opts nowarnings]] } { + [list $srcfile] $opts] } { return 0 } # test print command with functions return type set void "(void|)" -gdb_test "print v_char_func" \ - "$decimal = \{char \\(\\)\} 0x\[0-9a-z\]+ .*" \ - "print char function" +gdb_test_multiple "print v_char_func" "print char function" { + -re -wrap "$decimal = \{char \\(\\)\} 0x\[0-9a-z\]+ .*" { + pass $gdb_test_name + } + -re -wrap "$decimal = {} $hex " { + # The ld linker drops functions, see PR ld/29594. + xfail $gdb_test_name + return 0 + } +} gdb_test "print v_signed_char_func" \ "$decimal = \{signed char \\(\\)\} 0x\[0-9a-z\]+ .*" \ diff --git a/gdb/testsuite/gdb.ctf/multi.exp b/gdb/testsuite/gdb.ctf/multi.exp index 07fd10a884c..ef37507d92b 100644 --- a/gdb/testsuite/gdb.ctf/multi.exp +++ b/gdb/testsuite/gdb.ctf/multi.exp @@ -23,11 +23,16 @@ if [skip_ctf_tests] { standard_testfile ctf-a.c ctf-b.c ctf-c.c # Using `-gctf` generates full-fledged CTF debug information. -set opts "additional_flags=-gctf -Wl,--export-dynamic" -if { [prepare_for_testing "failed to prepare" ${testfile} \ - [list $srcfile $srcfile2 $srcfile3] \ - [list $opts nowarnings]] } { - return 0 +set opts {} +lappend opts "additional_flags=-gctf" +lappend opts "additional_flags=-Wl,--export-dynamic" +lappend opts "nowarnings" +save_vars { GDBFLAGS } { + append GDBFLAGS " -iex \"maint set symbol-read-order ctf\"" + if { [prepare_for_testing "failed to prepare" ${testfile} \ + [list $srcfile $srcfile2 $srcfile3] $opts] } { + return 0 + } } # Same thing with struct and union. -- 2.35.3