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 2D1A43851ABA for ; Wed, 12 Oct 2022 15:11:11 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 2D1A43851ABA 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 66EC61F381 for ; Wed, 12 Oct 2022 15:11:10 +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 4181513ACD for ; Wed, 12 Oct 2022 15:11:10 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id hnrNDg7ZRmOKOAAAMHmgww (envelope-from ) for ; Wed, 12 Oct 2022 15:11:10 +0000 Message-ID: <7bd97764-d259-1147-d192-849eac478ea7@suse.de> Date: Wed, 12 Oct 2022 17:11:09 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.2.2 Subject: Re: [PATCH 3/3] [gdb/testsuite] Fix ctf test-cases on openSUSE Tumbleweed Content-Language: en-US To: gdb-patches@sourceware.org References: <20220922152042.21914-1-tdevries@suse.de> <20220922152042.21914-3-tdevries@suse.de> From: Tom de Vries In-Reply-To: <20220922152042.21914-3-tdevries@suse.de> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-13.3 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, NICE_REPLY_A, RCVD_IN_DNSWL_LOW, 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: Wed, 12 Oct 2022 15:11:13 -0000 On 9/22/22 17:20, Tom de Vries via Gdb-patches wrote: > 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. > I ended up committing 908a926ec4e ("[gdb/testsuite] Fix ctf test-cases on openSUSE Tumbleweed"), which uses -Wl,--strip-debug instead of "maint set symbol-read-order ctf". > 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. > That test-case is now passing, so that xfail is not committed. Thanks, - Tom > 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.