From: Tom de Vries <tdevries@suse.de>
To: gdb-patches@sourceware.org
Subject: [committed][gdb/testsuite] Fix FAILs due to PR gcc/101452
Date: Wed, 21 Jul 2021 14:26:00 +0200 [thread overview]
Message-ID: <9f550a2f-151d-f895-96cb-baaa857964bb@suse.de> (raw)
In-Reply-To: <20210720124616.GA4600@delia.home>
On 7/20/21 2:46 PM, Tom de Vries wrote:
> Hi,
>
> When running test-case gdb.base/ptype-offsets.exp with gcc-11 (with -gdwarf-5
> default) or gcc-10 with target board unix/gdb:debug_flags=-gdwarf-5 we run
> into this regression:
> ...
> (gdb) ptype/o static_member^M
> /* offset | size */ type = struct static_member {^M
> - static static_member Empty;^M
> /* 0 | 4 */ int abc;^M
> ^M
> /* total size (bytes): 4 */^M
> }^M
> -(gdb) PASS: gdb.base/ptype-offsets.exp: ptype/o static_member
> +(gdb) FAIL: gdb.base/ptype-offsets.exp: ptype/o static_member
> ...
>
> This is caused by missing debug info, which I filed as gcc PR101452 - "[debug,
> dwarf-5] undefined static member removed by
> -feliminate-unused-debug-symbols".
>
> It's not clear yet whether this is a bug or a feature, but work around this in
> the test-cases by:
> - defining the static member
> - adding additional_flags=-fno-eliminate-unused-debug-types.
>
> Tested on x86_64-linux.
>
> Any comments?
>
Committed to trunk and gdb-11-branch.
Thanks,
- Tom
> [gdb/testsuite] Fix FAILs due to PR gcc/101452
>
> gdb/testsuite/ChangeLog:
>
> 2021-07-20 Tom de Vries <tdevries@suse.de>
>
> * lib/gdb.exp (gcc_major_version): New proc.
> * gdb.base/ptype-offsets.cc: Define static member static_member::Empty.
> * gdb.cp/templates.exp: Define static member using -DGCC_BUG.
> * gdb.cp/m-static.exp: Add
> additional_flags=-fno-eliminate-unused-debug-types.
> * gdb.cp/pr-574.exp: Same.
> * gdb.cp/pr9167.exp: Same.
>
> ---
> gdb/testsuite/gdb.base/ptype-offsets.cc | 3 +++
> gdb/testsuite/gdb.cp/m-static.exp | 8 +++++++-
> gdb/testsuite/gdb.cp/pr-574.exp | 8 +++++++-
> gdb/testsuite/gdb.cp/pr9167.exp | 8 +++++++-
> gdb/testsuite/gdb.cp/templates.exp | 8 +++++++-
> gdb/testsuite/lib/gdb.exp | 21 +++++++++++++++++++++
> 6 files changed, 52 insertions(+), 4 deletions(-)
>
> diff --git a/gdb/testsuite/gdb.base/ptype-offsets.cc b/gdb/testsuite/gdb.base/ptype-offsets.cc
> index dc21e34752f..7678fc6a666 100644
> --- a/gdb/testsuite/gdb.base/ptype-offsets.cc
> +++ b/gdb/testsuite/gdb.base/ptype-offsets.cc
> @@ -185,6 +185,9 @@ struct static_member
> int abc;
> };
>
> +/* Work around PR gcc/101452. */
> +static_member static_member::Empty;
> +
> struct empty_member
> {
> struct { } empty;
> diff --git a/gdb/testsuite/gdb.cp/m-static.exp b/gdb/testsuite/gdb.cp/m-static.exp
> index 8260ca377f5..15932038487 100644
> --- a/gdb/testsuite/gdb.cp/m-static.exp
> +++ b/gdb/testsuite/gdb.cp/m-static.exp
> @@ -31,8 +31,14 @@ if [get_compiler_info] {
> return -1
> }
>
> +set flags [list debug c++]
> +if { [test_compiler_info gcc-*] && [gcc_major_version] >= 10 } {
> + # Work around PR gcc/101452.
> + lappend flags additional_flags=-fno-eliminate-unused-debug-types
> +}
> +
> if {[prepare_for_testing "failed to prepare" $testfile \
> - [list $srcfile $srcfile2] {debug c++}]} {
> + [list $srcfile $srcfile2] $flags]} {
> return -1
> }
>
> diff --git a/gdb/testsuite/gdb.cp/pr-574.exp b/gdb/testsuite/gdb.cp/pr-574.exp
> index dab52fd428c..da596f120f6 100644
> --- a/gdb/testsuite/gdb.cp/pr-574.exp
> +++ b/gdb/testsuite/gdb.cp/pr-574.exp
> @@ -32,7 +32,13 @@ if [get_compiler_info "c++"] {
> return -1
> }
>
> -if {[prepare_for_testing "failed to prepare" $testfile $srcfile {debug c++}]} {
> +set flags [list debug c++]
> +if { [test_compiler_info gcc-*] && [gcc_major_version] >= 10 } {
> + # Work around PR gcc/101452.
> + lappend flags additional_flags=-fno-eliminate-unused-debug-types
> +}
> +
> +if {[prepare_for_testing "failed to prepare" $testfile $srcfile $flags]} {
> return -1
> }
>
> diff --git a/gdb/testsuite/gdb.cp/pr9167.exp b/gdb/testsuite/gdb.cp/pr9167.exp
> index 34508f70e6c..d88c75d8a12 100644
> --- a/gdb/testsuite/gdb.cp/pr9167.exp
> +++ b/gdb/testsuite/gdb.cp/pr9167.exp
> @@ -15,7 +15,13 @@
>
> standard_testfile .cc
>
> -if {[prepare_for_testing "failed to prepare" $testfile $srcfile {debug c++}]} {
> +set flags [list debug c++]
> +if { [test_compiler_info gcc-*] && [gcc_major_version] >= 10 } {
> + # Work around PR gcc/101452.
> + lappend flags additional_flags=-fno-eliminate-unused-debug-types
> +}
> +
> +if {[prepare_for_testing "failed to prepare" $testfile $srcfile $flags]} {
> return -1
> }
>
> diff --git a/gdb/testsuite/gdb.cp/templates.exp b/gdb/testsuite/gdb.cp/templates.exp
> index 4d589426c28..8b905e4254f 100644
> --- a/gdb/testsuite/gdb.cp/templates.exp
> +++ b/gdb/testsuite/gdb.cp/templates.exp
> @@ -27,7 +27,13 @@ if [get_compiler_info "c++"] {
> return -1
> }
>
> -if {[prepare_for_testing "failed to prepare" $testfile $srcfile {debug c++}]} {
> +set flags [list debug c++]
> +if { [test_compiler_info gcc-*] && [gcc_major_version] >= 10 } {
> + # Work around PR gcc/101452.
> + lappend flags additional_flags=-DGCC_BUG
> +}
> +
> +if {[prepare_for_testing "failed to prepare" $testfile $srcfile $flags]} {
> return -1
> }
>
> diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp
> index e79e0622f9d..16c46647101 100644
> --- a/gdb/testsuite/lib/gdb.exp
> +++ b/gdb/testsuite/lib/gdb.exp
> @@ -3998,6 +3998,27 @@ proc test_compiler_info { {compiler ""} } {
> return [string match $compiler $compiler_info]
> }
>
> +# Return the gcc major version, or -1.
> +# For gcc 4.8.5, the major version is 4.8.
> +# For gcc 7.5.0, the major version 7.
> +
> +proc gcc_major_version { } {
> + global compiler_info
> + global decimal
> + if { ![test_compiler_info "gcc-*"] } {
> + return -1
> + }
> + set res [regexp gcc-($decimal)-($decimal)- $compiler_info \
> + dummy_var major minor]
> + if { $res != 1 } {
> + return -1
> + }
> + if { $major >= 5} {
> + return $major
> + }
> + return $major.$minor
> +}
> +
> proc current_target_name { } {
> global target_info
> if [info exists target_info(target,name)] {
>
prev parent reply other threads:[~2021-07-21 12:26 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-07-20 12:46 [PATCH][gdb/testsuite] " Tom de Vries
2021-07-21 12:26 ` Tom de Vries [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=9f550a2f-151d-f895-96cb-baaa857964bb@suse.de \
--to=tdevries@suse.de \
--cc=gdb-patches@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox