From: Tom Tromey Date: Wed, 12 Feb 2025 17:56:43 +0000 (-0700) Subject: Look for -fgnat-encodings option X-Git-Tag: binutils-2_45~1398 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=95a95ec4d401390421e2f2a7839583940445acd7;p=thirdparty%2Fbinutils-gdb.git Look for -fgnat-encodings option 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. --- diff --git a/gdb/testsuite/gdb.ada/bias.exp b/gdb/testsuite/gdb.ada/bias.exp index 1b8b917444a..f2dab4143a3 100644 --- a/gdb/testsuite/gdb.ada/bias.exp +++ b/gdb/testsuite/gdb.ada/bias.exp @@ -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} diff --git a/gdb/testsuite/lib/ada.exp b/gdb/testsuite/lib/ada.exp index c987f9dfaca..0e856f7424d 100644 --- a/gdb/testsuite/lib/ada.exp +++ b/gdb/testsuite/lib/ada.exp @@ -21,11 +21,21 @@ # 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] +}