[v3,2/3] gdb/testsuite: ask for DWARF5 in gdb.cp/pass-by-ref.exp

Message ID 20241017175620.5876-6-guinevere@redhat.com
State New
Headers
Series *** SUBJECT HERE *** |

Checks

Context Check Description
linaro-tcwg-bot/tcwg_gdb_build--master-aarch64 success Build passed
linaro-tcwg-bot/tcwg_gdb_build--master-arm success Build passed
linaro-tcwg-bot/tcwg_gdb_check--master-arm success Test passed
linaro-tcwg-bot/tcwg_gdb_check--master-aarch64 success Test passed

Commit Message

Guinevere Larsen Oct. 17, 2024, 5:56 p.m. UTC
  Some test from gdb.cp/pass-by-ref.exp rely on the attributes
DW_AT_deleted and DW_AT_defaulted, which were only added in DWARF 5.
However, it seems that GCC emits those attributes since version 7, no
matter the requested DWARF version. Clang, on the other hand, only
produces those attributes if it emits DWARF5, which is the default on
newer clangs, and notably in the fedora version used by buildbot.

Thhis patch updates the code setting up an XFAIL so that, instead of
setting it up for all clangs used, it only does so if clang is NOT using
dwarf 5.
---
 gdb/testsuite/gdb.cp/pass-by-ref.exp | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
  

Comments

Keith Seitz Oct. 21, 2024, 3:51 p.m. UTC | #1
On 10/17/24 10:56 AM, Guinevere Larsen wrote:
> Some test from gdb.cp/pass-by-ref.exp rely on the attributes
> DW_AT_deleted and DW_AT_defaulted, which were only added in DWARF 5.
> However, it seems that GCC emits those attributes since version 7, no
> matter the requested DWARF version. Clang, on the other hand, only
> produces those attributes if it emits DWARF5, which is the default on
> newer clangs, and notably in the fedora version used by buildbot.
> 
> Thhis patch updates the code setting up an XFAIL so that, instead of

[typo :-)]

> setting it up for all clangs used, it only does so if clang is NOT using
> dwarf 5.
> ---
>   gdb/testsuite/gdb.cp/pass-by-ref.exp | 6 +++++-
>   1 file changed, 5 insertions(+), 1 deletion(-)
> 
> diff --git a/gdb/testsuite/gdb.cp/pass-by-ref.exp b/gdb/testsuite/gdb.cp/pass-by-ref.exp
> index a1f1df4f3e7..503e67b34c8 100644
> --- a/gdb/testsuite/gdb.cp/pass-by-ref.exp
> +++ b/gdb/testsuite/gdb.cp/pass-by-ref.exp
> @@ -343,6 +343,9 @@ if {![runto_main]} {
>       return -1
>   }
>   
> +get_debug_format
> +set using_dwarf5 [test_debug_format "DWARF 5"]

I think Tom cautioned previously about DWARF > 5. I think this can be 
easily addressed here because test_debug_format uses "string match"
which takes a glob-like match pattern. So maybe {DWARF [5-9]}?
[IMO we can deal with DWARF 10 -- long after I am gone. :-)]

With that, this LGTM.

Reviewed-by: Keith Seitz <keiths@redhat.com>

Keith
> +
>   set bp_location [gdb_get_line_number "stop here"]
>   gdb_breakpoint $bp_location
>   gdb_continue_to_breakpoint "end of main" ".*return .*;"
> @@ -412,7 +415,8 @@ proc test_for_class { prefix states cbvfun data_field length} {
>   		    "destructor should be called"
>   	    }
>   	} else {
> -	    if {$cctor == "deleted" && ($is_gcc_6_or_older || $is_clang)} {
> +	    if {$cctor == "deleted"
> +		&& ($is_gcc_6_or_older || ($is_clang && !$::using_dwarf5))} {
>   		setup_xfail "*-*-*"
>   	    }
>   	    gdb_test "print ${cbvfun}<$name> (${name}_var)" \
  
Guinevere Larsen Oct. 23, 2024, 5:44 p.m. UTC | #2
On 10/21/24 12:51 PM, Keith Seitz wrote:
> On 10/17/24 10:56 AM, Guinevere Larsen wrote:
>> Some test from gdb.cp/pass-by-ref.exp rely on the attributes
>> DW_AT_deleted and DW_AT_defaulted, which were only added in DWARF 5.
>> However, it seems that GCC emits those attributes since version 7, no
>> matter the requested DWARF version. Clang, on the other hand, only
>> produces those attributes if it emits DWARF5, which is the default on
>> newer clangs, and notably in the fedora version used by buildbot.
>>
>> Thhis patch updates the code setting up an XFAIL so that, instead of
>
> [typo :-)]
fixed
>
>> setting it up for all clangs used, it only does so if clang is NOT using
>> dwarf 5.
>> ---
>>   gdb/testsuite/gdb.cp/pass-by-ref.exp | 6 +++++-
>>   1 file changed, 5 insertions(+), 1 deletion(-)
>>
>> diff --git a/gdb/testsuite/gdb.cp/pass-by-ref.exp 
>> b/gdb/testsuite/gdb.cp/pass-by-ref.exp
>> index a1f1df4f3e7..503e67b34c8 100644
>> --- a/gdb/testsuite/gdb.cp/pass-by-ref.exp
>> +++ b/gdb/testsuite/gdb.cp/pass-by-ref.exp
>> @@ -343,6 +343,9 @@ if {![runto_main]} {
>>       return -1
>>   }
>>   +get_debug_format
>> +set using_dwarf5 [test_debug_format "DWARF 5"]
>
> I think Tom cautioned previously about DWARF > 5. I think this can be 
> easily addressed here because test_debug_format uses "string match"
> which takes a glob-like match pattern. So maybe {DWARF [5-9]}?

fixed locally (using "DWARF \[5-9\]").

Thanks for the review!

> [IMO we can deal with DWARF 10 -- long after I am gone. :-)]
>
> With that, this LGTM.
>
> Reviewed-by: Keith Seitz <keiths@redhat.com>
>
> Keith
>> +
>>   set bp_location [gdb_get_line_number "stop here"]
>>   gdb_breakpoint $bp_location
>>   gdb_continue_to_breakpoint "end of main" ".*return .*;"
>> @@ -412,7 +415,8 @@ proc test_for_class { prefix states cbvfun 
>> data_field length} {
>>               "destructor should be called"
>>           }
>>       } else {
>> -        if {$cctor == "deleted" && ($is_gcc_6_or_older || $is_clang)} {
>> +        if {$cctor == "deleted"
>> +        && ($is_gcc_6_or_older || ($is_clang && !$::using_dwarf5))} {
>>           setup_xfail "*-*-*"
>>           }
>>           gdb_test "print ${cbvfun}<$name> (${name}_var)" \
>
  

Patch

diff --git a/gdb/testsuite/gdb.cp/pass-by-ref.exp b/gdb/testsuite/gdb.cp/pass-by-ref.exp
index a1f1df4f3e7..503e67b34c8 100644
--- a/gdb/testsuite/gdb.cp/pass-by-ref.exp
+++ b/gdb/testsuite/gdb.cp/pass-by-ref.exp
@@ -343,6 +343,9 @@  if {![runto_main]} {
     return -1
 }
 
+get_debug_format
+set using_dwarf5 [test_debug_format "DWARF 5"]
+
 set bp_location [gdb_get_line_number "stop here"]
 gdb_breakpoint $bp_location
 gdb_continue_to_breakpoint "end of main" ".*return .*;"
@@ -412,7 +415,8 @@  proc test_for_class { prefix states cbvfun data_field length} {
 		    "destructor should be called"
 	    }
 	} else {
-	    if {$cctor == "deleted" && ($is_gcc_6_or_older || $is_clang)} {
+	    if {$cctor == "deleted"
+		&& ($is_gcc_6_or_older || ($is_clang && !$::using_dwarf5))} {
 		setup_xfail "*-*-*"
 	    }
 	    gdb_test "print ${cbvfun}<$name> (${name}_var)" \