From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 2205) id 03373385040C; Wed, 12 Oct 2022 15:02:32 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 03373385040C DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1665586952; bh=oL4vonjY/D1zIZkGYyo43uC5EzRTfRviPhQf3KswZM0=; h=From:To:Subject:Date:From; b=pD86zZ3NLpwljhfpq+O48Tgs7Fl1Ht0ZDgcKBrwZjZHNhu1FflPpPkeBXl/Pr98dp ELSYBhRsaoAO4je1m4t8smHcKJ+j6J0D2dENmhMOCLHln8HfTLpKMFqS+UAp7qACZ2 gIYWDD5JbjHUN8X/8upOnL05Yto5xoyhYv9VwW9c= Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable From: Tom de Vries To: gdb-cvs@sourceware.org Subject: [binutils-gdb] [gdb/testsuite] Fix ctf test-cases on openSUSE Tumbleweed X-Act-Checkin: binutils-gdb X-Git-Author: Tom de Vries X-Git-Refname: refs/heads/master X-Git-Oldrev: 632ecf33a181029be7f1b7efdc687fd3dbb1a1d0 X-Git-Newrev: 908a926ec4ecd48571aafb560d97b927b6f94b5e Message-Id: <20221012150232.03373385040C@sourceware.org> Date: Wed, 12 Oct 2022 15:02:32 +0000 (GMT) List-Id: https://sourceware.org/git/gitweb.cgi?p=3Dbinutils-gdb.git;h=3D908a926ec4ec= d48571aafb560d97b927b6f94b5e commit 908a926ec4ecd48571aafb560d97b927b6f94b5e Author: Tom de Vries Date: Wed Oct 12 17:02:15 2022 +0200 [gdb/testsuite] Fix ctf test-cases on openSUSE Tumbleweed =20 When running test-case gdb.base/ctf-constvars.exp on openSUSE Tumblewee= d (with system gcc version 12, providing gcc -gctf support, enabling the ctf te= st-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 ... =20 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 objec= ts, so the ctf info is ignored (reported in PR29160). =20 By using: - -Wl,--ctf-variable, - -Wl,--strip-debug, and we can make the test-case and some similar test-cases pass. =20 Tested on x86_64-linux. =20 Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=3D29160 Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=3D29468 Diff: --- gdb/testsuite/gdb.base/ctf-constvars.exp | 9 +++++++-- gdb/testsuite/gdb.base/ctf-ptype.exp | 8 ++++++-- gdb/testsuite/gdb.base/cvexpr.exp | 6 +++++- gdb/testsuite/gdb.base/whatis.exp | 7 ++++++- gdb/testsuite/gdb.ctf/cross-tu-cyclic.exp | 9 +++++++-- gdb/testsuite/gdb.ctf/funcreturn.exp | 8 ++++++-- gdb/testsuite/gdb.ctf/multi.exp | 9 +++++++-- 7 files changed, 44 insertions(+), 12 deletions(-) diff --git a/gdb/testsuite/gdb.base/ctf-constvars.exp b/gdb/testsuite/gdb.b= ase/ctf-constvars.exp index 6255e9ed02b..a5e7fe0b015 100644 --- a/gdb/testsuite/gdb.base/ctf-constvars.exp +++ b/gdb/testsuite/gdb.base/ctf-constvars.exp @@ -32,9 +32,14 @@ if [skip_ctf_tests] { standard_testfile .c =20 # Using `-gctf` generates full-fledged CTF debug information. -set opts "additional_flags=3D-gctf" +set opts {} +lappend opts additional_flags=3D-gctf +lappend opts ldflags=3D-Wl,--strip-debug +lappend opts ldflags=3D-Wl,--ctf-variables +lappend opts nowarnings + if { [prepare_for_testing "failed to prepare" ${testfile} \ - [list $srcfile] [list $opts nowarnings]] } { + [list $srcfile] $opts] } { return 0 } =20 diff --git a/gdb/testsuite/gdb.base/ctf-ptype.exp b/gdb/testsuite/gdb.base/= ctf-ptype.exp index 48d39e56c7b..28deabb6ac5 100644 --- a/gdb/testsuite/gdb.base/ctf-ptype.exp +++ b/gdb/testsuite/gdb.base/ctf-ptype.exp @@ -26,10 +26,14 @@ set gcc_compiled [is_c_compiler_gcc] standard_testfile .c =20 # Using `-gctf` generates full-fledged CTF debug information. -set opts "additional_flags=3D-gctf" +set opts {} +lappend opts additional_flags=3D-gctf +lappend opts ldflags=3D-Wl,--strip-debug +lappend opts ldflags=3D-Wl,--ctf-variables +lappend opts nowarnings =20 if { [prepare_for_testing "failed to prepare" ${testfile} \ - [list $srcfile] [list $opts nowarnings]] } { + [list $srcfile] $opts] } { return 0 } =20 diff --git a/gdb/testsuite/gdb.base/cvexpr.exp b/gdb/testsuite/gdb.base/cve= xpr.exp index d8437b94c61..272efaff97c 100644 --- a/gdb/testsuite/gdb.base/cvexpr.exp +++ b/gdb/testsuite/gdb.base/cvexpr.exp @@ -491,10 +491,14 @@ proc do_test {dir options} { # } =20 +set ctf_opts {} +lappend ctf_opts additional_flags=3D-gctf +lappend ctf_opts ldflags=3D-Wl,--strip-debug + # Build up the set of debug formats for which we will run this test. set specs { {dwarf {debug}} } if ![skip_ctf_tests] { - lappend specs {ctf {"additional_flags=3D-gctf"}} + lappend specs [list ctf $ctf_opts] } =20 # Setup and run the test for each debug format. diff --git a/gdb/testsuite/gdb.base/whatis.exp b/gdb/testsuite/gdb.base/wha= tis.exp index c19c149f012..5a3ff536bd9 100644 --- a/gdb/testsuite/gdb.base/whatis.exp +++ b/gdb/testsuite/gdb.base/whatis.exp @@ -585,10 +585,15 @@ proc do_test {dir options} { "whatis applied to function with 'void' parameter type" } =20 +set ctf_opts {} +lappend ctf_opts additional_flags=3D-gctf +lappend ctf_opts ldflags=3D-Wl,--strip-debug +lappend ctf_opts ldflags=3D-Wl,--ctf-variables + # Build up the set of debug formats for which we will run this test. set specs { {dwarf {debug}} } if ![skip_ctf_tests] { - lappend specs {ctf {"additional_flags=3D-gctf"}} + lappend specs [list ctf $ctf_opts] } =20 # Setup and run the test for each debug format. diff --git a/gdb/testsuite/gdb.ctf/cross-tu-cyclic.exp b/gdb/testsuite/gdb.= ctf/cross-tu-cyclic.exp index a43e36bbe68..ca11b739ed8 100644 --- a/gdb/testsuite/gdb.ctf/cross-tu-cyclic.exp +++ b/gdb/testsuite/gdb.ctf/cross-tu-cyclic.exp @@ -24,10 +24,15 @@ standard_testfile cross-tu-cyclic-1.c cross-tu-cyclic-= 2.c \ cross-tu-cyclic-3.c cross-tu-cyclic-4.c =20 # Using `-gctf` generates full-fledged CTF debug information. -set opts "additional_flags=3D-gctf -Wl,--export-dynamic" +set opts {} +lappend opts additional_flags=3D-gctf +lappend opts ldflags=3D-Wl,--export-dynamic +lappend opts ldflags=3D-Wl,--strip-debug +lappend opts nowarning + if { [prepare_for_testing "failed to prepare" ${testfile} \ [list $srcfile $srcfile2 $srcfile3 $srcfile4] \ - [list $opts nowarnings]] } { + $opts] } { return 0 } =20 diff --git a/gdb/testsuite/gdb.ctf/funcreturn.exp b/gdb/testsuite/gdb.ctf/f= uncreturn.exp index ea01e860a84..1267cab2b75 100644 --- a/gdb/testsuite/gdb.ctf/funcreturn.exp +++ b/gdb/testsuite/gdb.ctf/funcreturn.exp @@ -30,10 +30,14 @@ set gcc_compiled [is_c_compiler_gcc] standard_testfile whatis.c =20 # Using `-gctf` generates full-fledged CTF debug information. -set opts "additional_flags=3D-gctf -Wl,--export-dynamic" +set opts {} +lappend opts additional_flags=3D-gctf +lappend opts ldflags=3D-Wl,--export-dynamic +lappend opts ldflags=3D-Wl,--strip-debug +lappend opts nowarning =20 if { [prepare_for_testing "failed to prepare" ${testfile} \ - [list $srcfile] [list $opts nowarnings]] } { + [list $srcfile] $opts] } { return 0 } =20 diff --git a/gdb/testsuite/gdb.ctf/multi.exp b/gdb/testsuite/gdb.ctf/multi.= exp index 07fd10a884c..93fcbb660a2 100644 --- a/gdb/testsuite/gdb.ctf/multi.exp +++ b/gdb/testsuite/gdb.ctf/multi.exp @@ -23,10 +23,15 @@ if [skip_ctf_tests] { standard_testfile ctf-a.c ctf-b.c ctf-c.c =20 # Using `-gctf` generates full-fledged CTF debug information. -set opts "additional_flags=3D-gctf -Wl,--export-dynamic" +set opts {} +lappend opts additional_flags=3D-gctf +lappend opts ldflags=3D-Wl,--export-dynamic +lappend opts ldflags=3D-Wl,--strip-debug +lappend opts nowarning + if { [prepare_for_testing "failed to prepare" ${testfile} \ [list $srcfile $srcfile2 $srcfile3] \ - [list $opts nowarnings]] } { + $opts] } { return 0 }