[binutils-gdb] Disable gdb.ada/dgopt.exp with gnat-llvm
Tom Tromey via Gdb-cvs <[email protected]> Fri, 26 Jun 2026 16:55:18 +0000 (GMT)
| Newsgroups | gmane.comp.gdb.cvs |
|---|---|
| Message-ID | <[email protected]> |
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=12743d8290311a090ba115978d72351a2b321ce0 commit 12743d8290311a090ba115978d72351a2b321ce0 Author: Tom Tromey <[email protected]> Date: Fri Jun 26 07:00:47 2026 -0600 Disable gdb.ada/dgopt.exp with gnat-llvm gdb.ada/dgopt.exp fails with gnat-llvm. Looking into it, it turns out that this test case relies on a bug in GNAT. In particular, despite the use of -gnatDG, GNAT will still put a reference to "x.adb" into both the DWARF .debug_info and into the line table. The test relies on this, because the original problem being fixed here is that, when the test was written, there was a bug causing these references to be dropped when writing .debug_names. gnat-llvm does not have this same bug -- it only emits references to x.adb.dg. This patch disables this test for gnat-llvm. There's not really a good way to tell that gnatmake is llvm-based, so while I've added a new caching proc for this, it is just a proxy for an existing proc. Since this only affects gnat-llvm, and was discussed internally, I am going to check it in. Diff: --- gdb/testsuite/gdb.ada/dgopt.exp | 8 ++++++++ gdb/testsuite/lib/ada.exp | 8 ++++++++ 2 files changed, 16 insertions(+) diff --git a/gdb/testsuite/gdb.ada/dgopt.exp b/gdb/testsuite/gdb.ada/dgopt.exp index 9e8e8a676a8..831aa053f36 100644 --- a/gdb/testsuite/gdb.ada/dgopt.exp +++ b/gdb/testsuite/gdb.ada/dgopt.exp @@ -19,6 +19,14 @@ load_lib "ada.exp" require allow_ada_tests +# Despite appearances, this is not really an "Ada" test -- instead the +# scenario here is that GNAT ends up putting one reference to x.adb +# into the DWARF (whereas it mostly refers to x.adb.dg); and this +# reference was being incorrectly omitted from .debug_names. +# gnat-llvm does not have this bug, so the test does not make sense +# there. +require !using_gnat_llvm + standard_ada_testfile x if {[gdb_compile_ada "${srcfile}" "${binfile}" executable \ diff --git a/gdb/testsuite/lib/ada.exp b/gdb/testsuite/lib/ada.exp index 8c9821bb897..e20b35c8ebe 100644 --- a/gdb/testsuite/lib/ada.exp +++ b/gdb/testsuite/lib/ada.exp @@ -292,6 +292,14 @@ gdb_caching_proc ada_minimal_encodings {} { additional_flags=-fgnat-encodings=minimal] } +# Return 1 if GNAT is based on LLVM. +gdb_caching_proc using_gnat_llvm {} { + # Whether or not gnatmake will use LLVM can't be determined from + # the command line -- e.g., --version doesn't provide any + # indication. So for now use a proxy. + return [expr {![ada_minimal_encodings]}] +} + # Return 1 if GNAT supports -Og. gdb_caching_proc ada_og {} { return [ada_simple_compile gnat_og additional_flags=-Og]