Skip to content

Commit

Permalink
Look for -fgnat-encodings option
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
tromey committed Mar 4, 2025
1 parent e0386de commit 95a95ec
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 4 deletions.
10 changes: 7 additions & 3 deletions gdb/testsuite/gdb.ada/bias.exp
Original file line number Diff line number Diff line change
Expand Up @@ -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}
Expand Down
18 changes: 17 additions & 1 deletion gdb/testsuite/lib/ada.exp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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]
}

0 comments on commit 95a95ec

Please sign in to comment.