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

Message ID 20240502182549.1607075-3-blarsen@redhat.com
State New
Headers
Series clang inspired testsuite fixups. |

Checks

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

Commit Message

Guinevere Larsen May 2, 2024, 6:25 p.m. UTC
  The test gdb.cp/pass-by-ref.exp relies on some DWARF attributes that
were only added in version 5. Some compilers (notably clang on fedoras
older than 40) default to using DWARF4, which is why there are many
XFAILs in the output.

However, clang is able to emit dwarf5, and will start doing so as the
default in fedora 40 (which is what the buildbot is using) causing 80
XPASSes to be emitted.

This patch identifies which debug version is being produced by the
compiler, and only sets up the XFAIL if DWARF5 is not used.
---
 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 7b2a6196c50..69437e9799c 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 || !$::using_dwarf5)} {
 		setup_xfail "*-*-*"
 	    }
 	    gdb_test "print ${cbvfun}<$name> (${name}_var)" \