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

Message ID 20250103150217.356285-3-guinevere@redhat.com
State New
Headers
Series Fix XPASSes with modern clang |

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

Commit Message

Guinevere Larsen Jan. 3, 2025, 3:02 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.

This 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 or later.

Reviewed-by: Keith Seitz <keiths@redhat.com>
---
 gdb/testsuite/gdb.cp/pass-by-ref.exp | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
  

Patch

diff --git a/gdb/testsuite/gdb.cp/pass-by-ref.exp b/gdb/testsuite/gdb.cp/pass-by-ref.exp
index a1f1df4f3e7..ef2576970af 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-9\]"]
+
 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)" \