]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
gdb/testsuite: Force DWARF debuginfo where applicable in AIX systems
authorGuinevere Larsen <guinevere@redhat.com>
Tue, 4 Feb 2025 13:19:57 +0000 (10:19 -0300)
committerGuinevere Larsen <guinevere@redhat.com>
Wed, 26 Mar 2025 20:18:56 +0000 (17:18 -0300)
In the AIX systems available for testing in the gcc compile farm, the
default debug information format is stabs. This is a problem for many
reasons, mainly that stabs is not as complete as dwarf and stabs is
being deprecated in the next release. In the current state, we have:
PASS: 39798
FAIL: 7405
When running these tests, I unfortunately didn't have the foresight to
save the number of unsupported and untested cases.

To improve testing there, this patch changes the gdb_compile TCL proc, so
that if we're running tests in AIX, we requested debug info, and we
haven't explicitly asked for some debuginfo format, gdb_compile will add
-gdwarf to the compilation line, forcing DWARF to be used. After this
patch, we get:
PASS: 74548
FAIL: 5963

So not only do we have fewer failures, there are tens of thousands of
tests that are no longer skipped.

Approved-By: Tom Tromey <tom@tromey.com>
gdb/testsuite/lib/gdb.exp

index 8486ff05e57464ef5c89ab94eae70b01c2e0cbf4..761a4f1175684ecd654e10e32bc62b9038aa2aaa 100644 (file)
@@ -5946,6 +5946,23 @@ proc gdb_compile {source dest type options} {
        }
     }
 
+    # On AIX systems, until GCC 12 (maybe later), stabs was the default
+    # debug option, but we'd like to have dwarf instead.
+    # If we're running on one of those systems and debug was requested,
+    # but no explicit -g<format> option was given, use -gdwarf to force
+    # that as the debug info for the inferior.
+    # This list should be exhaustive:
+    set debug_format "btf|ctf|stabs|vms|coff|xcoff"
+    # Since additional_flags is a comma separated list, identify if there
+    # are other (optional) flags in the list.
+    set other_options "-\[a-zA-Z0-9\]*,"
+    set full_regexp "^additional_flags=\($other_options\)*-g\($debug_format\)"
+    if { [istarget *-*-aix*]
+        && [lsearch -exact $options debug] != -1
+        && [lsearch -regexp $options $full_regexp] == -1} {
+       lappend new_options "additional_flags=-gdwarf"
+    }
+
     set shlib_found 0
     set shlib_load 0
     foreach opt $options {