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.
This commit is contained in:
Tom Tromey
2025-02-12 10:56:43 -07:00
parent e0386dee30
commit 95a95ec4d4
2 changed files with 24 additions and 4 deletions

View 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}

View File

@@ -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]
}