]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
Look for -fgnat-encodings option
authorTom Tromey <tromey@adacore.com>
Wed, 12 Feb 2025 17:56:43 +0000 (10:56 -0700)
committerTom Tromey <tromey@adacore.com>
Tue, 4 Mar 2025 14:42:53 +0000 (07:42 -0700)
gnat-llvm does not support the -fgnat-encodings option, and does not
emit GNAT encodings at all -- it only supports the equivalent of GCC's
"minimal" encodings; which is to say, ordinary DWARF.

This patch changes gdb to test whether gnatmake supports this flag and
adapt accordingly.  foreach_gnat_encoding is changed to pretend that
the "minimal" mode is in effect, as some test examine the mode.

gdb/testsuite/gdb.ada/bias.exp
gdb/testsuite/lib/ada.exp

index 1b8b917444aae4f42f44e3b43701b757f2a97f43..f2dab4143a36204fc9b255daa8c910ad3bffffc0 100644 (file)
@@ -19,9 +19,13 @@ require allow_ada_tests
 
 standard_ada_testfile bias
 
-if {[gdb_compile_ada "${srcfile}" "${binfile}" executable \
-        {debug additional_flags=-fgnat-encodings=minimal}] != "" } {
-  return -1
+set flags {debug}
+if {[ada_minimal_encodings]} {
+    lappend flags additional_flags=-fgnat-encodings=minimal
+}
+
+if {[gdb_compile_ada "${srcfile}" "${binfile}" executable $flags] != ""} {
+    return -1
 }
 
 clean_restart ${testfile}
index c987f9dfaca38c4abc5747b83ec1de19a809303e..0e856f7424d18e1fb4e835f9f45fd7f6dcc8c674 100644 (file)
 # to run, and BODY is what actually does the work.
 
 proc foreach_gnat_encoding {scenario_arg flags_arg list body} {
+    # gnat-llvm does not understand -fgnat-encodings at all.  However,
+    # some tests examine the precise setting of the scenario -- so
+    # pretend we support minimal.  What is going on here is that for
+    # gnat-llvm, there are no "GNAT encodings", only minimal
+    # encodings, aka, real DWARF.
+    set has_flag [ada_minimal_encodings]
+    if {!$has_flag} {
+       set list minimal
+    }
+
     upvar 1 $scenario_arg scenario
     upvar 1 $flags_arg flags
     foreach_with_prefix scenario $list {
        set flags {}
-       if {$scenario != "none"} {
+       if {$scenario != "none" && $has_flag} {
            lappend flags additional_flags=-fgnat-encodings=$scenario
        }
        uplevel 1 $body
@@ -268,3 +278,9 @@ proc ada_simple_compile {name options} {
 gdb_caching_proc ada_fvar_tracking {} {
     return [ada_simple_compile fvar_tracking additional_flags=-fvar-tracking]
 }
+
+# Return 1 if GNAT supports the minimal encodings option.
+gdb_caching_proc ada_minimal_encodings {} {
+    return [ada_simple_compile minimal_encodings \
+               additional_flags=-fgnat-encodings=minimal]
+}