[PATCH 2/2] Introduce gnat-llvm board file
Tom Tromey
tromey@adacore.com
Thu May 16 17:46:45 GMT 2024
This adds a new gnat-llvm board file, so that gdb's Ada tests can be
run against gnat-llvm. It changes foreach_gnat_encoding to handle the
gnat-llvm case, and finally it updates a few tests to adapt as well.
---
gdb/testsuite/boards/gnat-llvm.exp | 29 +++++++++++++++++++++++++++++
gdb/testsuite/gdb.ada/bias.exp | 8 ++++++--
gdb/testsuite/gdb.ada/finish-large.exp | 2 +-
gdb/testsuite/gdb.ada/scalar_storage.exp | 3 +++
gdb/testsuite/gdb.ada/win_fu_syms.exp | 3 +++
gdb/testsuite/lib/ada.exp | 18 +++++++++++++++++-
6 files changed, 59 insertions(+), 4 deletions(-)
diff --git a/gdb/testsuite/boards/gnat-llvm.exp b/gdb/testsuite/boards/gnat-llvm.exp
new file mode 100644
index 00000000000..f2cfe124359
--- /dev/null
+++ b/gdb/testsuite/boards/gnat-llvm.exp
@@ -0,0 +1,29 @@
+# Copyright 2024 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+# This file is a dejagnu "board file" and is used to run the testsuite
+# with gnat-llvm.
+
+load_board_description "local-board"
+
+# This is based on baseboards/unix.exp.
+# At the moment we only support systems that unix.exp supports.
+load_generic_config "unix"
+process_multilib_options ""
+
+set GNATMAKE_FOR_TARGET llvm-gnatmake
+
+load_lib ada.exp
+set is_gnat_llvm 1
diff --git a/gdb/testsuite/gdb.ada/bias.exp b/gdb/testsuite/gdb.ada/bias.exp
index 1b8b917444a..4da4070454a 100644
--- a/gdb/testsuite/gdb.ada/bias.exp
+++ b/gdb/testsuite/gdb.ada/bias.exp
@@ -19,8 +19,12 @@ require allow_ada_tests
standard_ada_testfile bias
-if {[gdb_compile_ada "${srcfile}" "${binfile}" executable \
- {debug additional_flags=-fgnat-encodings=minimal}] != "" } {
+set flags {debug}
+if {!$::is_gnat_llvm} {
+ lappend flags additional_flags=-fgnat-encodings=minimal
+}
+
+if {[gdb_compile_ada "${srcfile}" "${binfile}" executable $flags] != ""} {
return -1
}
diff --git a/gdb/testsuite/gdb.ada/finish-large.exp b/gdb/testsuite/gdb.ada/finish-large.exp
index b9823d313c4..a40d12808f2 100644
--- a/gdb/testsuite/gdb.ada/finish-large.exp
+++ b/gdb/testsuite/gdb.ada/finish-large.exp
@@ -21,7 +21,7 @@ standard_ada_testfile p
set flags {debug}
-if {[have_fvar_tracking]} {
+if {[have_fvar_tracking] && !$is_gnat_llvm} {
lappend flags "additional_flags=-fvar-tracking"
}
diff --git a/gdb/testsuite/gdb.ada/scalar_storage.exp b/gdb/testsuite/gdb.ada/scalar_storage.exp
index e01e75fe5d2..435c0a768a1 100644
--- a/gdb/testsuite/gdb.ada/scalar_storage.exp
+++ b/gdb/testsuite/gdb.ada/scalar_storage.exp
@@ -20,6 +20,9 @@ load_lib "ada.exp"
require allow_ada_tests
+# LLVM does not support scalar storage order.
+require !ada_llvm
+
standard_ada_testfile storage
if {[gdb_compile_ada "${srcfile}" "${binfile}" executable [list debug ]] != "" } {
diff --git a/gdb/testsuite/gdb.ada/win_fu_syms.exp b/gdb/testsuite/gdb.ada/win_fu_syms.exp
index 527a4496649..c2ec349f19a 100644
--- a/gdb/testsuite/gdb.ada/win_fu_syms.exp
+++ b/gdb/testsuite/gdb.ada/win_fu_syms.exp
@@ -17,6 +17,9 @@ load_lib "ada.exp"
require allow_ada_tests
+# Currently gnat-llvm does not supply a shared libgnat.
+require !ada_llvm
+
standard_ada_testfile foo
if {[gdb_compile_ada "${srcfile}" "${binfile}" executable [list debug additional_flags=-bargs additional_flags=-shared additional_flags=-margs]] != "" } {
diff --git a/gdb/testsuite/lib/ada.exp b/gdb/testsuite/lib/ada.exp
index 0544544acbe..544660def86 100644
--- a/gdb/testsuite/lib/ada.exp
+++ b/gdb/testsuite/lib/ada.exp
@@ -13,6 +13,15 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
+# When non-zero, assume gnat-llvm. See foreach_gnat_encoding.
+set is_gnat_llvm 0
+
+# Return the value of is_gnat_llvm. Useful with 'require'.
+
+proc ada_llvm {} {
+ return $::is_gnat_llvm
+}
+
# A wrapper for foreach_with_prefix that applies suitable
# -fgnat-encodings arguments to a command line. SCENARIO_ARG is the
# name of a loop variable that will hold the scenario currently being
@@ -21,11 +30,18 @@
# 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.
+ if {$::is_gnat_llvm} {
+ 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" && !$::is_gnat_llvm} {
lappend flags additional_flags=-fgnat-encodings=$scenario
}
uplevel 1 $body
--
2.44.0
More information about the Gdb-patches
mailing list