public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* [PATCH 0/2] Initial work for testing gnat-llvm
@ 2024-05-16 17:46 Tom Tromey
  2024-05-16 17:46 ` [PATCH 1/2] Introduce and use foreach_gnat_encoding Tom Tromey
  2024-05-16 17:46 ` [PATCH 2/2] Introduce gnat-llvm board file Tom Tromey
  0 siblings, 2 replies; 3+ messages in thread
From: Tom Tromey @ 2024-05-16 17:46 UTC (permalink / raw)
  To: gdb-patches

This short series adds a bit of initial support for testing using
gnat-llvm.

I am not sure whether adding a new board file is really the best
approach.  Comments welcome.  I chose this over checking
GNATMAKE_FOR_TARGET because, from what I can tell, the only way to
distinguish llvm-gnatmake from the ordinary gnatmake is by examining
the program's name.

---
Tom Tromey (2):
      Introduce and use foreach_gnat_encoding
      Introduce gnat-llvm board file

 gdb/testsuite/boards/gnat-llvm.exp                 | 29 ++++++++++++++++++
 gdb/testsuite/gdb.ada/O2_float_param.exp           |  6 ++--
 .../gdb.ada/access_to_unbounded_array.exp          |  4 +--
 gdb/testsuite/gdb.ada/arr_acc_idx_w_gap.exp        |  4 +--
 gdb/testsuite/gdb.ada/arr_enum_idx_w_gap.exp       |  4 +--
 gdb/testsuite/gdb.ada/array_of_symbolic_length.exp |  4 +--
 gdb/testsuite/gdb.ada/array_of_variable_length.exp |  4 +--
 gdb/testsuite/gdb.ada/array_of_variant.exp         |  4 +--
 gdb/testsuite/gdb.ada/array_ptr_renaming.exp       |  4 +--
 gdb/testsuite/gdb.ada/arrayparam.exp               |  4 +--
 gdb/testsuite/gdb.ada/arrayptr.exp                 |  4 +--
 gdb/testsuite/gdb.ada/bias.exp                     |  8 +++--
 gdb/testsuite/gdb.ada/big_packed_array.exp         |  4 +--
 gdb/testsuite/gdb.ada/enum_idx_packed.exp          |  4 +--
 gdb/testsuite/gdb.ada/finish-large.exp             |  2 +-
 gdb/testsuite/gdb.ada/fixed_cmp.exp                |  4 +--
 gdb/testsuite/gdb.ada/fixed_points.exp             |  4 +--
 gdb/testsuite/gdb.ada/frame_arg_lang.exp           |  9 +++---
 gdb/testsuite/gdb.ada/funcall_ref.exp              |  4 +--
 gdb/testsuite/gdb.ada/mi_string_access.exp         |  4 +--
 gdb/testsuite/gdb.ada/mi_var_array.exp             |  7 ++---
 gdb/testsuite/gdb.ada/mi_var_union.exp             |  7 ++---
 gdb/testsuite/gdb.ada/mi_variant.exp               |  7 ++---
 gdb/testsuite/gdb.ada/mod_from_name.exp            |  4 +--
 gdb/testsuite/gdb.ada/multiarray.exp               |  4 +--
 gdb/testsuite/gdb.ada/out_of_line_in_inlined.exp   |  6 ++--
 gdb/testsuite/gdb.ada/packed_array.exp             |  4 +--
 gdb/testsuite/gdb.ada/packed_record.exp            |  4 +--
 gdb/testsuite/gdb.ada/packed_tagged.exp            |  7 ++---
 gdb/testsuite/gdb.ada/pckd_arr_ren.exp             |  4 +--
 gdb/testsuite/gdb.ada/ptype-o.exp                  |  4 +--
 gdb/testsuite/gdb.ada/rec_ptype.exp                |  4 +--
 gdb/testsuite/gdb.ada/same_component_name.exp      |  4 +--
 gdb/testsuite/gdb.ada/scalar_storage.exp           |  3 ++
 gdb/testsuite/gdb.ada/set_pckd_arr_elt.exp         |  4 +--
 gdb/testsuite/gdb.ada/unc_arr_ptr_in_var_rec.exp   |  4 +--
 gdb/testsuite/gdb.ada/unchecked_union.exp          |  7 ++---
 gdb/testsuite/gdb.ada/var_rec_arr.exp              |  4 +--
 gdb/testsuite/gdb.ada/variant.exp                  |  7 ++---
 .../gdb.ada/variant_record_packed_array.exp        |  4 +--
 gdb/testsuite/gdb.ada/win_fu_syms.exp              |  3 ++
 gdb/testsuite/lib/ada.exp                          | 35 ++++++++++++++++++++++
 42 files changed, 151 insertions(+), 100 deletions(-)
---
base-commit: 8f155672d3457b5a014a99a6bd61b2b8be1d1c16
change-id: 20240516-gnat-llvm-experiment-cb5b4d4a2b75

Best regards,
-- 
Tom Tromey <tromey@adacore.com>


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH 1/2] Introduce and use foreach_gnat_encoding
  2024-05-16 17:46 [PATCH 0/2] Initial work for testing gnat-llvm Tom Tromey
@ 2024-05-16 17:46 ` Tom Tromey
  2024-05-16 17:46 ` [PATCH 2/2] Introduce gnat-llvm board file Tom Tromey
  1 sibling, 0 replies; 3+ messages in thread
From: Tom Tromey @ 2024-05-16 17:46 UTC (permalink / raw)
  To: gdb-patches

gnat-llvm does not support the -fgnat-encodings flag.  This patch
prepares gdb's Ada tests to handle this situation by introducing a new
foreach_gnat_encoding.  A subsequent patch will change this to support
gnat-llvm.
---
 gdb/testsuite/gdb.ada/O2_float_param.exp              |  6 ++----
 gdb/testsuite/gdb.ada/access_to_unbounded_array.exp   |  4 ++--
 gdb/testsuite/gdb.ada/arr_acc_idx_w_gap.exp           |  4 ++--
 gdb/testsuite/gdb.ada/arr_enum_idx_w_gap.exp          |  4 ++--
 gdb/testsuite/gdb.ada/array_of_symbolic_length.exp    |  4 ++--
 gdb/testsuite/gdb.ada/array_of_variable_length.exp    |  4 ++--
 gdb/testsuite/gdb.ada/array_of_variant.exp            |  4 ++--
 gdb/testsuite/gdb.ada/array_ptr_renaming.exp          |  4 ++--
 gdb/testsuite/gdb.ada/arrayparam.exp                  |  4 ++--
 gdb/testsuite/gdb.ada/arrayptr.exp                    |  4 ++--
 gdb/testsuite/gdb.ada/big_packed_array.exp            |  4 ++--
 gdb/testsuite/gdb.ada/enum_idx_packed.exp             |  4 ++--
 gdb/testsuite/gdb.ada/fixed_cmp.exp                   |  4 ++--
 gdb/testsuite/gdb.ada/fixed_points.exp                |  4 ++--
 gdb/testsuite/gdb.ada/frame_arg_lang.exp              |  9 ++++-----
 gdb/testsuite/gdb.ada/funcall_ref.exp                 |  4 ++--
 gdb/testsuite/gdb.ada/mi_string_access.exp            |  4 ++--
 gdb/testsuite/gdb.ada/mi_var_array.exp                |  7 ++-----
 gdb/testsuite/gdb.ada/mi_var_union.exp                |  7 ++-----
 gdb/testsuite/gdb.ada/mi_variant.exp                  |  7 ++-----
 gdb/testsuite/gdb.ada/mod_from_name.exp               |  4 ++--
 gdb/testsuite/gdb.ada/multiarray.exp                  |  4 ++--
 gdb/testsuite/gdb.ada/out_of_line_in_inlined.exp      |  6 ++----
 gdb/testsuite/gdb.ada/packed_array.exp                |  4 ++--
 gdb/testsuite/gdb.ada/packed_record.exp               |  4 ++--
 gdb/testsuite/gdb.ada/packed_tagged.exp               |  7 ++-----
 gdb/testsuite/gdb.ada/pckd_arr_ren.exp                |  4 ++--
 gdb/testsuite/gdb.ada/ptype-o.exp                     |  4 ++--
 gdb/testsuite/gdb.ada/rec_ptype.exp                   |  4 ++--
 gdb/testsuite/gdb.ada/same_component_name.exp         |  4 ++--
 gdb/testsuite/gdb.ada/set_pckd_arr_elt.exp            |  4 ++--
 gdb/testsuite/gdb.ada/unc_arr_ptr_in_var_rec.exp      |  4 ++--
 gdb/testsuite/gdb.ada/unchecked_union.exp             |  7 ++-----
 gdb/testsuite/gdb.ada/var_rec_arr.exp                 |  4 ++--
 gdb/testsuite/gdb.ada/variant.exp                     |  7 ++-----
 gdb/testsuite/gdb.ada/variant_record_packed_array.exp |  4 ++--
 gdb/testsuite/lib/ada.exp                             | 19 +++++++++++++++++++
 37 files changed, 93 insertions(+), 97 deletions(-)

diff --git a/gdb/testsuite/gdb.ada/O2_float_param.exp b/gdb/testsuite/gdb.ada/O2_float_param.exp
index d44f2e57217..86b67ff4626 100644
--- a/gdb/testsuite/gdb.ada/O2_float_param.exp
+++ b/gdb/testsuite/gdb.ada/O2_float_param.exp
@@ -26,10 +26,8 @@ if {[is_aarch64_target]} {
     }
 }
 
-foreach_with_prefix scenario {all minimal} {
-    set flags [list debug \
-		   optimize=-O2 \
-		   additional_flags=-fgnat-encodings=$scenario]
+foreach_gnat_encoding scenario flags {all minimal} {
+    lappend flags debug optimize=-O2
 
     if {[gdb_compile_ada "${srcfile}" "${binfile}-${scenario}" executable $flags] != ""} {
 	return -1
diff --git a/gdb/testsuite/gdb.ada/access_to_unbounded_array.exp b/gdb/testsuite/gdb.ada/access_to_unbounded_array.exp
index 7f7bfb3ba4c..eeaceb018ed 100644
--- a/gdb/testsuite/gdb.ada/access_to_unbounded_array.exp
+++ b/gdb/testsuite/gdb.ada/access_to_unbounded_array.exp
@@ -19,8 +19,8 @@ require allow_ada_tests
 
 standard_ada_testfile foo
 
-foreach_with_prefix scenario {all minimal} {
-    set flags [list debug additional_flags=-fgnat-encodings=$scenario]
+foreach_gnat_encoding scenario flags {all minimal} {
+    lappend flags debug
 
     if {[gdb_compile_ada "${srcfile}" "${binfile}-${scenario}" executable $flags] != ""} {
 	return -1
diff --git a/gdb/testsuite/gdb.ada/arr_acc_idx_w_gap.exp b/gdb/testsuite/gdb.ada/arr_acc_idx_w_gap.exp
index 569bb2ec556..4ecb4f8cd78 100644
--- a/gdb/testsuite/gdb.ada/arr_acc_idx_w_gap.exp
+++ b/gdb/testsuite/gdb.ada/arr_acc_idx_w_gap.exp
@@ -19,8 +19,8 @@ require allow_ada_tests
 
 standard_ada_testfile enum_with_gap_main
 
-foreach_with_prefix scenario {all minimal} {
-    set flags [list debug additional_flags=-fgnat-encodings=$scenario]
+foreach_gnat_encoding scenario flags {all minimal} {
+    lappend flags debug
 
     if {[gdb_compile_ada "${srcfile}" "${binfile}-${scenario}" \
 	     executable $flags] != ""} {
diff --git a/gdb/testsuite/gdb.ada/arr_enum_idx_w_gap.exp b/gdb/testsuite/gdb.ada/arr_enum_idx_w_gap.exp
index 5a88f5f3ca9..491402bd78a 100644
--- a/gdb/testsuite/gdb.ada/arr_enum_idx_w_gap.exp
+++ b/gdb/testsuite/gdb.ada/arr_enum_idx_w_gap.exp
@@ -19,8 +19,8 @@ require allow_ada_tests
 
 standard_ada_testfile foo_q418_043
 
-foreach_with_prefix scenario {all minimal} {
-    set flags [list debug additional_flags=-fgnat-encodings=$scenario]
+foreach_gnat_encoding scenario flags {all minimal} {
+    lappend flags debug
 
     if {[gdb_compile_ada "${srcfile}" "${binfile}-${scenario}" executable $flags] != ""} {
 	return -1
diff --git a/gdb/testsuite/gdb.ada/array_of_symbolic_length.exp b/gdb/testsuite/gdb.ada/array_of_symbolic_length.exp
index bcf73690801..134b448e64a 100644
--- a/gdb/testsuite/gdb.ada/array_of_symbolic_length.exp
+++ b/gdb/testsuite/gdb.ada/array_of_symbolic_length.exp
@@ -19,8 +19,8 @@ require allow_ada_tests
 
 standard_ada_testfile foo
 
-foreach_with_prefix scenario {all minimal} {
-    set flags [list debug additional_flags=-fgnat-encodings=$scenario]
+foreach_gnat_encoding scenario flags {all minimal} {
+    lappend flags debug
 
     if {[gdb_compile_ada "${srcfile}" "${binfile}-${scenario}" executable $flags] != ""} {
 	return -1
diff --git a/gdb/testsuite/gdb.ada/array_of_variable_length.exp b/gdb/testsuite/gdb.ada/array_of_variable_length.exp
index 3397760e16c..3c68c805a12 100644
--- a/gdb/testsuite/gdb.ada/array_of_variable_length.exp
+++ b/gdb/testsuite/gdb.ada/array_of_variable_length.exp
@@ -19,8 +19,8 @@ require allow_ada_tests
 
 standard_ada_testfile foo
 
-foreach_with_prefix scenario {all minimal} {
-    set flags [list debug additional_flags=-fgnat-encodings=$scenario]
+foreach_gnat_encoding scenario flags {all minimal} {
+    lappend flags debug
 
     if {[gdb_compile_ada "${srcfile}" "${binfile}-${scenario}" executable $flags] != ""} {
 	return -1
diff --git a/gdb/testsuite/gdb.ada/array_of_variant.exp b/gdb/testsuite/gdb.ada/array_of_variant.exp
index 1a155d416db..f93260af940 100644
--- a/gdb/testsuite/gdb.ada/array_of_variant.exp
+++ b/gdb/testsuite/gdb.ada/array_of_variant.exp
@@ -40,8 +40,8 @@ proc gdb_test_with_xfail { cmd re re_xfail msg } {
     }
 }
 
-foreach_with_prefix scenario {all minimal} {
-    set flags [list debug additional_flags=-fgnat-encodings=$scenario]
+foreach_gnat_encoding scenario flags {all minimal} {
+    lappend flags debug
 
     if {[gdb_compile_ada "${srcfile}" "${binfile}-${scenario}" executable $flags] != ""} {
 	return -1
diff --git a/gdb/testsuite/gdb.ada/array_ptr_renaming.exp b/gdb/testsuite/gdb.ada/array_ptr_renaming.exp
index b013fc7e3b6..eadfcb64891 100644
--- a/gdb/testsuite/gdb.ada/array_ptr_renaming.exp
+++ b/gdb/testsuite/gdb.ada/array_ptr_renaming.exp
@@ -19,8 +19,8 @@ require allow_ada_tests
 
 standard_ada_testfile foo
 
-foreach_with_prefix scenario {all minimal} {
-    set flags [list debug additional_flags=-fgnat-encodings=$scenario]
+foreach_gnat_encoding scenario flags {all minimal} {
+    lappend flags debug
 
     if {[gdb_compile_ada "${srcfile}" "${binfile}-${scenario}" executable $flags] != ""} {
 	return -1
diff --git a/gdb/testsuite/gdb.ada/arrayparam.exp b/gdb/testsuite/gdb.ada/arrayparam.exp
index 2921d64bef1..ef00037be90 100644
--- a/gdb/testsuite/gdb.ada/arrayparam.exp
+++ b/gdb/testsuite/gdb.ada/arrayparam.exp
@@ -22,8 +22,8 @@ standard_ada_testfile foo
 # Note we don't test the "none" (no -fgnat-encodings option) scenario
 # here, because "all" and "minimal" cover the cases, and this way we
 # don't have to update the test when gnat changes its default.
-foreach_with_prefix scenario {all minimal} {
-    set flags [list debug additional_flags=-fgnat-encodings=$scenario]
+foreach_gnat_encoding scenario flags {all minimal} {
+    lappend flags debug
 
     if {[gdb_compile_ada "${srcfile}" "${binfile}-${scenario}" executable $flags] != ""} {
 	return -1
diff --git a/gdb/testsuite/gdb.ada/arrayptr.exp b/gdb/testsuite/gdb.ada/arrayptr.exp
index ca48993439b..335573b31a7 100644
--- a/gdb/testsuite/gdb.ada/arrayptr.exp
+++ b/gdb/testsuite/gdb.ada/arrayptr.exp
@@ -19,8 +19,8 @@ require allow_ada_tests
 
 standard_ada_testfile foo
 
-foreach_with_prefix scenario {all minimal} {
-    set flags [list debug additional_flags=-fgnat-encodings=$scenario]
+foreach_gnat_encoding scenario flags {all minimal} {
+    lappend flags debug
 
     if {[gdb_compile_ada "${srcfile}" "${binfile}-${scenario}" executable $flags] != ""} {
 	return -1
diff --git a/gdb/testsuite/gdb.ada/big_packed_array.exp b/gdb/testsuite/gdb.ada/big_packed_array.exp
index 1ba2c4853c8..0078c77de6a 100644
--- a/gdb/testsuite/gdb.ada/big_packed_array.exp
+++ b/gdb/testsuite/gdb.ada/big_packed_array.exp
@@ -21,8 +21,8 @@ standard_ada_testfile foo_ra24_010
 
 set old_gcc [expr [test_compiler_info {gcc-[0-8]-*}]]
 
-foreach_with_prefix scenario {all minimal} {
-    set flags [list debug additional_flags=-fgnat-encodings=$scenario]
+foreach_gnat_encoding scenario flags {all minimal} {
+    lappend flags debug
 
     if {[gdb_compile_ada "${srcfile}" "${binfile}-${scenario}" executable $flags] != ""} {
 	return -1
diff --git a/gdb/testsuite/gdb.ada/enum_idx_packed.exp b/gdb/testsuite/gdb.ada/enum_idx_packed.exp
index 1976092c13b..d56d73bf9bc 100644
--- a/gdb/testsuite/gdb.ada/enum_idx_packed.exp
+++ b/gdb/testsuite/gdb.ada/enum_idx_packed.exp
@@ -19,8 +19,8 @@ require allow_ada_tests
 
 standard_ada_testfile foo
 
-foreach_with_prefix scenario {all minimal} {
-    set flags [list debug additional_flags=-fgnat-encodings=$scenario]
+foreach_gnat_encoding scenario flags {all minimal} {
+    lappend flags debug
 
     if {[gdb_compile_ada "${srcfile}" "${binfile}-${scenario}" executable $flags] != ""} {
 	return -1
diff --git a/gdb/testsuite/gdb.ada/fixed_cmp.exp b/gdb/testsuite/gdb.ada/fixed_cmp.exp
index de506fdfd99..dcd47455302 100644
--- a/gdb/testsuite/gdb.ada/fixed_cmp.exp
+++ b/gdb/testsuite/gdb.ada/fixed_cmp.exp
@@ -19,8 +19,8 @@ require allow_ada_tests
 
 standard_ada_testfile fixed
 
-foreach_with_prefix gnat_encodings {all minimal} {
-    set flags [list debug additional_flags=-fgnat-encodings=$gnat_encodings]
+foreach_gnat_encoding gnat_encodings flags {all minimal} {
+    lappend flags debug
 
     if {[gdb_compile_ada "${srcfile}" "${binfile}-${gnat_encodings}" executable $flags] != "" } {
       return -1
diff --git a/gdb/testsuite/gdb.ada/fixed_points.exp b/gdb/testsuite/gdb.ada/fixed_points.exp
index 4665595f6f8..ceed34acbc5 100644
--- a/gdb/testsuite/gdb.ada/fixed_points.exp
+++ b/gdb/testsuite/gdb.ada/fixed_points.exp
@@ -19,8 +19,8 @@ require allow_ada_tests
 
 standard_ada_testfile fixed_points
 
-foreach_with_prefix scenario {all minimal} {
-    set flags [list debug additional_flags=-fgnat-encodings=$scenario]
+foreach_gnat_encoding scenario flags {all minimal} {
+    lappend flags debug
     if {[gdb_compile_ada "${srcfile}" "${binfile}-${scenario}" executable $flags] != ""} {
 	return -1
     }
diff --git a/gdb/testsuite/gdb.ada/frame_arg_lang.exp b/gdb/testsuite/gdb.ada/frame_arg_lang.exp
index 918a922ca2f..b629c429ac8 100644
--- a/gdb/testsuite/gdb.ada/frame_arg_lang.exp
+++ b/gdb/testsuite/gdb.ada/frame_arg_lang.exp
@@ -27,11 +27,10 @@ gdb_compile "${csrcfile}" "${cobject}" object [list debug]
 # Note we don't test the "none" (no -fgnat-encodings option) scenario
 # here, because "all" and "minimal" cover the cases, and this way we
 # don't have to update the test when gnat changes its default.
-foreach_with_prefix scenario {all minimal} {
-    set flags [list debug additional_flags=-largs \
-		   additional_flags=${cobject} \
-		   additional_flags=-margs \
-		   additional_flags=-fgnat-encodings=$scenario]
+foreach_gnat_encoding scenario flags {all minimal} {
+    lappend flags debug additional_flags=-largs \
+	additional_flags=${cobject} \
+	additional_flags=-margs
 
     if {[gdb_compile_ada "${srcfile}" "${binfile}-${scenario}" executable $flags] != ""} {
 	return -1
diff --git a/gdb/testsuite/gdb.ada/funcall_ref.exp b/gdb/testsuite/gdb.ada/funcall_ref.exp
index 518ceb7118f..1c283923021 100644
--- a/gdb/testsuite/gdb.ada/funcall_ref.exp
+++ b/gdb/testsuite/gdb.ada/funcall_ref.exp
@@ -22,8 +22,8 @@ standard_ada_testfile foo
 # Note we don't test the "none" (no -fgnat-encodings option) scenario
 # here, because "all" and "minimal" cover the cases, and this way we
 # don't have to update the test when gnat changes its default.
-foreach_with_prefix scenario {all minimal} {
-    set flags [list debug additional_flags=-fgnat-encodings=$scenario]
+foreach_gnat_encoding scenario flags {all minimal} {
+    lappend flags debug
 
     if {[gdb_compile_ada "${srcfile}" "${binfile}-${scenario}" executable $flags] != ""} {
 	return -1
diff --git a/gdb/testsuite/gdb.ada/mi_string_access.exp b/gdb/testsuite/gdb.ada/mi_string_access.exp
index 15b8cf153f4..8fd116b545c 100644
--- a/gdb/testsuite/gdb.ada/mi_string_access.exp
+++ b/gdb/testsuite/gdb.ada/mi_string_access.exp
@@ -22,8 +22,8 @@ standard_ada_testfile bar
 load_lib mi-support.exp
 set MIFLAGS "-i=mi"
 
-foreach_with_prefix scenario {all minimal} {
-    set flags [list debug additional_flags=-fgnat-encodings=$scenario]
+foreach_gnat_encoding scenario flags {all minimal} {
+    lappend flags debug
 
     if {[gdb_compile_ada "${srcfile}" "${binfile}-${scenario}" executable $flags] != ""} {
 	return -1
diff --git a/gdb/testsuite/gdb.ada/mi_var_array.exp b/gdb/testsuite/gdb.ada/mi_var_array.exp
index 2b504815099..dd770a11718 100644
--- a/gdb/testsuite/gdb.ada/mi_var_array.exp
+++ b/gdb/testsuite/gdb.ada/mi_var_array.exp
@@ -22,11 +22,8 @@ standard_ada_testfile bar
 load_lib mi-support.exp
 set MIFLAGS "-i=mi"
 
-foreach_with_prefix scenario {none all minimal} {
-    set flags {debug}
-    if {$scenario != "none"} {
-	lappend flags additional_flags=-fgnat-encodings=$scenario
-    }
+foreach_gnat_encoding scenario flags {none all minimal} {
+    lappend flags debug
 
     if {[gdb_compile_ada "${srcfile}" "${binfile}-${scenario}" executable $flags] != "" } {
 	return -1
diff --git a/gdb/testsuite/gdb.ada/mi_var_union.exp b/gdb/testsuite/gdb.ada/mi_var_union.exp
index eb23c0a4a65..64bfe3355e7 100644
--- a/gdb/testsuite/gdb.ada/mi_var_union.exp
+++ b/gdb/testsuite/gdb.ada/mi_var_union.exp
@@ -24,11 +24,8 @@ set MIFLAGS "-i=mi"
 
 set float "\\-?((\[0-9\]+(\\.\[0-9\]+)?(e\[-+\]\[0-9\]+)?)|(nan\\($hex\\)))"
 
-foreach_with_prefix scenario {none all minimal} {
-    set flags {debug}
-    if {$scenario != "none"} {
-	lappend flags additional_flags=-fgnat-encodings=$scenario
-    }
+foreach_gnat_encoding scenario flags {none all minimal} {
+    lappend flags debug
 
     if {[gdb_compile_ada "${srcfile}" "${binfile}-${scenario}" executable $flags] != "" } {
 	return -1
diff --git a/gdb/testsuite/gdb.ada/mi_variant.exp b/gdb/testsuite/gdb.ada/mi_variant.exp
index 7f10b3c511f..f4be5a0b110 100644
--- a/gdb/testsuite/gdb.ada/mi_variant.exp
+++ b/gdb/testsuite/gdb.ada/mi_variant.exp
@@ -23,11 +23,8 @@ standard_ada_testfile pkg
 load_lib mi-support.exp
 set MIFLAGS "-i=mi"
 
-foreach_with_prefix scenario {none all minimal} {
-    set flags {debug}
-    if {$scenario != "none"} {
-	lappend flags additional_flags=-fgnat-encodings=$scenario
-    }
+foreach_gnat_encoding scenario flags {none all minimal} {
+    lappend flags debug
 
     if {[gdb_compile_ada "${srcfile}" "${binfile}-${scenario}" executable $flags] != ""} {
 	return -1
diff --git a/gdb/testsuite/gdb.ada/mod_from_name.exp b/gdb/testsuite/gdb.ada/mod_from_name.exp
index c6acc802bbf..33bd854d3ba 100644
--- a/gdb/testsuite/gdb.ada/mod_from_name.exp
+++ b/gdb/testsuite/gdb.ada/mod_from_name.exp
@@ -19,8 +19,8 @@ require allow_ada_tests
 
 standard_ada_testfile foo
 
-foreach_with_prefix scenario {all minimal} {
-    set flags [list debug additional_flags=-fgnat-encodings=$scenario]
+foreach_gnat_encoding scenario flags {all minimal} {
+    lappend flags debug
 
     if {[gdb_compile_ada "${srcfile}" "${binfile}-${scenario}" executable $flags] != ""} {
 	return -1
diff --git a/gdb/testsuite/gdb.ada/multiarray.exp b/gdb/testsuite/gdb.ada/multiarray.exp
index 34756476ff7..3c625151ed2 100644
--- a/gdb/testsuite/gdb.ada/multiarray.exp
+++ b/gdb/testsuite/gdb.ada/multiarray.exp
@@ -19,8 +19,8 @@ require allow_ada_tests
 
 standard_ada_testfile p
 
-foreach_with_prefix scenario {all minimal} {
-    set flags [list debug additional_flags=-fgnat-encodings=$scenario]
+foreach_gnat_encoding scenario flags {all minimal} {
+    lappend flags debug
 
     if {[gdb_compile_ada "${srcfile}" "${binfile}-${scenario}" executable {debug}] != ""} {
 	return -1
diff --git a/gdb/testsuite/gdb.ada/out_of_line_in_inlined.exp b/gdb/testsuite/gdb.ada/out_of_line_in_inlined.exp
index eaa88a30774..2adef97e763 100644
--- a/gdb/testsuite/gdb.ada/out_of_line_in_inlined.exp
+++ b/gdb/testsuite/gdb.ada/out_of_line_in_inlined.exp
@@ -19,10 +19,8 @@ require allow_ada_tests
 
 standard_ada_testfile foo_o224_021
 
-foreach_with_prefix scenario {all minimal} {
-    set flags [list debug \
-		   optimize=-O2 \
-		   additional_flags=-fgnat-encodings=$scenario]
+foreach_gnat_encoding scenario flags {all minimal} {
+    lappend flags debug optimize=-O2
 
     if {[gdb_compile_ada "${srcfile}" "${binfile}-${scenario}" executable $flags] != ""} {
 	return -1
diff --git a/gdb/testsuite/gdb.ada/packed_array.exp b/gdb/testsuite/gdb.ada/packed_array.exp
index a3d7136c163..85bc59db882 100644
--- a/gdb/testsuite/gdb.ada/packed_array.exp
+++ b/gdb/testsuite/gdb.ada/packed_array.exp
@@ -19,8 +19,8 @@ require allow_ada_tests
 
 standard_ada_testfile pa
 
-foreach_with_prefix scenario {all minimal} {
-    set flags [list debug additional_flags=-fgnat-encodings=$scenario]
+foreach_gnat_encoding scenario flags {all minimal} {
+    lappend flags debug
 
     if {[gdb_compile_ada "${srcfile}" "${binfile}-${scenario}" executable $flags] != ""} {
 	return -1
diff --git a/gdb/testsuite/gdb.ada/packed_record.exp b/gdb/testsuite/gdb.ada/packed_record.exp
index fa058f70524..bbba9b25c54 100644
--- a/gdb/testsuite/gdb.ada/packed_record.exp
+++ b/gdb/testsuite/gdb.ada/packed_record.exp
@@ -19,8 +19,8 @@ require allow_ada_tests
 
 standard_ada_testfile pr
 
-foreach_with_prefix scenario {all minimal} {
-    set flags [list debug additional_flags=-fgnat-encodings=$scenario]
+foreach_gnat_encoding scenario flags {all minimal} {
+    lappend flags debug
 
     if {[gdb_compile_ada "${srcfile}" "${binfile}-${scenario}" executable $flags] != ""} {
 	return -1
diff --git a/gdb/testsuite/gdb.ada/packed_tagged.exp b/gdb/testsuite/gdb.ada/packed_tagged.exp
index faccc1476d4..1c9e5a07703 100644
--- a/gdb/testsuite/gdb.ada/packed_tagged.exp
+++ b/gdb/testsuite/gdb.ada/packed_tagged.exp
@@ -22,11 +22,8 @@ standard_ada_testfile comp_bug
 # Note we don't test the "none" (no -fgnat-encodings option) scenario
 # here, because "all" and "minimal" cover the cases, and this way we
 # don't have to update the test when gnat changes its default.
-foreach_with_prefix scenario {all minimal} {
-    set flags {debug}
-    if {$scenario != "none"} {
-	lappend flags additional_flags=-fgnat-encodings=$scenario
-    }
+foreach_gnat_encoding scenario flags {all minimal} {
+    lappend flags debug
 
     if {[gdb_compile_ada "${srcfile}" "${binfile}-${scenario}" executable $flags] != ""} {
 	return -1
diff --git a/gdb/testsuite/gdb.ada/pckd_arr_ren.exp b/gdb/testsuite/gdb.ada/pckd_arr_ren.exp
index 083ee132714..18bb84f848a 100644
--- a/gdb/testsuite/gdb.ada/pckd_arr_ren.exp
+++ b/gdb/testsuite/gdb.ada/pckd_arr_ren.exp
@@ -19,8 +19,8 @@ require allow_ada_tests
 
 standard_ada_testfile foo
 
-foreach_with_prefix scenario {all minimal} {
-    set flags [list debug additional_flags=-fgnat-encodings=$scenario]
+foreach_gnat_encoding scenario flags {all minimal} {
+    lappend flags debug
 
     if {[gdb_compile_ada "${srcfile}" "${binfile}-${scenario}" executable $flags] != ""} {
 	return -1
diff --git a/gdb/testsuite/gdb.ada/ptype-o.exp b/gdb/testsuite/gdb.ada/ptype-o.exp
index f7782199d58..5038ee171d2 100644
--- a/gdb/testsuite/gdb.ada/ptype-o.exp
+++ b/gdb/testsuite/gdb.ada/ptype-o.exp
@@ -21,8 +21,8 @@ require allow_ada_tests
 
 standard_ada_testfile prog
 
-foreach_with_prefix scenario {all minimal} {
-    set flags [list debug additional_flags=-fgnat-encodings=$scenario]
+foreach_gnat_encoding scenario flags {all minimal} {
+    lappend flags debug
 
     if {[gdb_compile_ada "${srcfile}" "${binfile}-${scenario}" executable $flags] != ""} {
 	return -1
diff --git a/gdb/testsuite/gdb.ada/rec_ptype.exp b/gdb/testsuite/gdb.ada/rec_ptype.exp
index f75d09b16ef..fc7bb8b5fac 100644
--- a/gdb/testsuite/gdb.ada/rec_ptype.exp
+++ b/gdb/testsuite/gdb.ada/rec_ptype.exp
@@ -22,8 +22,8 @@ standard_ada_testfile main
 # Note we don't test the "none" (no -fgnat-encodings option) scenario
 # here, because "all" and "minimal" cover the cases, and this way we
 # don't have to update the test when gnat changes its default.
-foreach_with_prefix scenario {all minimal} {
-    set flags [list debug additional_flags=-fgnat-encodings=$scenario]
+foreach_gnat_encoding scenario flags {all minimal} {
+    lappend flags debug
 
     if {[gdb_compile_ada "${srcfile}" "${binfile}-${scenario}" executable $flags] != ""} {
 	return -1
diff --git a/gdb/testsuite/gdb.ada/same_component_name.exp b/gdb/testsuite/gdb.ada/same_component_name.exp
index 7167a4124d1..84a48b4fd0e 100644
--- a/gdb/testsuite/gdb.ada/same_component_name.exp
+++ b/gdb/testsuite/gdb.ada/same_component_name.exp
@@ -19,8 +19,8 @@ require allow_ada_tests
 
 standard_ada_testfile foo
 
-foreach_with_prefix scenario {all minimal} {
-    set flags [list debug additional_flags=-fgnat-encodings=$scenario]
+foreach_gnat_encoding scenario flags {all minimal} {
+    lappend flags debug
 
     if {[gdb_compile_ada "${srcfile}" "${binfile}-${scenario}" executable $flags] != "" } {
 	return -1
diff --git a/gdb/testsuite/gdb.ada/set_pckd_arr_elt.exp b/gdb/testsuite/gdb.ada/set_pckd_arr_elt.exp
index d77f8fe6896..2979cb99e83 100644
--- a/gdb/testsuite/gdb.ada/set_pckd_arr_elt.exp
+++ b/gdb/testsuite/gdb.ada/set_pckd_arr_elt.exp
@@ -19,8 +19,8 @@ require allow_ada_tests
 
 standard_ada_testfile foo
 
-foreach_with_prefix scenario {all minimal} {
-    set flags [list debug additional_flags=-fgnat-encodings=$scenario]
+foreach_gnat_encoding scenario flags {all minimal} {
+    lappend flags debug
 
     if {[gdb_compile_ada "${srcfile}" "${binfile}-${scenario}" executable $flags] != ""} {
 	return -1
diff --git a/gdb/testsuite/gdb.ada/unc_arr_ptr_in_var_rec.exp b/gdb/testsuite/gdb.ada/unc_arr_ptr_in_var_rec.exp
index 6b2a6fdfa9a..2bcc027cec4 100644
--- a/gdb/testsuite/gdb.ada/unc_arr_ptr_in_var_rec.exp
+++ b/gdb/testsuite/gdb.ada/unc_arr_ptr_in_var_rec.exp
@@ -19,8 +19,8 @@ require allow_ada_tests
 
 standard_ada_testfile foo
 
-foreach_with_prefix scenario {all minimal} {
-    set flags [list debug additional_flags=-fgnat-encodings=$scenario]
+foreach_gnat_encoding scenario flags {all minimal} {
+    lappend flags debug
 
     if {[gdb_compile_ada "${srcfile}" "${binfile}-${scenario}" executable $flags] != ""} {
 	return -1
diff --git a/gdb/testsuite/gdb.ada/unchecked_union.exp b/gdb/testsuite/gdb.ada/unchecked_union.exp
index bff71bdaa2f..5d3256bd52e 100644
--- a/gdb/testsuite/gdb.ada/unchecked_union.exp
+++ b/gdb/testsuite/gdb.ada/unchecked_union.exp
@@ -51,11 +51,8 @@ set pair_string {    case ? is
 }
 set pair_full "type = record\n${inner_string}${pair_string}end record"
 
-foreach_with_prefix scenario {none all minimal} {
-    set flags {debug}
-    if {$scenario != "none"} {
-	lappend flags additional_flags=-fgnat-encodings=$scenario
-    }
+foreach_gnat_encoding scenario flags {none all minimal} {
+    lappend flags debug
 
     if {[gdb_compile_ada "${srcfile}" "${binfile}-${scenario}" executable $flags] != ""} {
 	return -1
diff --git a/gdb/testsuite/gdb.ada/var_rec_arr.exp b/gdb/testsuite/gdb.ada/var_rec_arr.exp
index a8591089ba8..20598ea708c 100644
--- a/gdb/testsuite/gdb.ada/var_rec_arr.exp
+++ b/gdb/testsuite/gdb.ada/var_rec_arr.exp
@@ -22,8 +22,8 @@ standard_ada_testfile foo_na09_042
 # Note we don't test the "none" (no -fgnat-encodings option) scenario
 # here, because "all" and "minimal" cover the cases, and this way we
 # don't have to update the test when gnat changes its default.
-foreach_with_prefix scenario {all minimal} {
-    set flags [list debug additional_flags=-fgnat-encodings=$scenario]
+foreach_gnat_encoding scenario flags {all minimal} {
+    lappend flags debug
 
     if {[gdb_compile_ada "${srcfile}" "${binfile}-${scenario}" executable $flags] != ""} {
 	return -1
diff --git a/gdb/testsuite/gdb.ada/variant.exp b/gdb/testsuite/gdb.ada/variant.exp
index 9fbc449758a..227331c3ac0 100644
--- a/gdb/testsuite/gdb.ada/variant.exp
+++ b/gdb/testsuite/gdb.ada/variant.exp
@@ -20,11 +20,8 @@ require allow_ada_tests
 
 standard_ada_testfile pkg
 
-foreach_with_prefix scenario {none all minimal} {
-    set flags {debug}
-    if {$scenario != "none"} {
-	lappend flags additional_flags=-fgnat-encodings=$scenario
-    }
+foreach_gnat_encoding scenario flags {none all minimal} {
+    lappend flags debug
 
     if {[gdb_compile_ada "${srcfile}" "${binfile}-${scenario}" executable $flags] != ""} {
 	return -1
diff --git a/gdb/testsuite/gdb.ada/variant_record_packed_array.exp b/gdb/testsuite/gdb.ada/variant_record_packed_array.exp
index f6b4e4171a8..8f4192cfd49 100644
--- a/gdb/testsuite/gdb.ada/variant_record_packed_array.exp
+++ b/gdb/testsuite/gdb.ada/variant_record_packed_array.exp
@@ -19,8 +19,8 @@ require allow_ada_tests
 
 standard_ada_testfile foo
 
-foreach_with_prefix scenario {all minimal} {
-    set flags [list debug additional_flags=-fgnat-encodings=$scenario]
+foreach_gnat_encoding scenario flags {all minimal} {
+    lappend flags debug
 
     if {[gdb_compile_ada "${srcfile}" "${binfile}-${scenario}" executable $flags] != ""} {
 	return -1
diff --git a/gdb/testsuite/lib/ada.exp b/gdb/testsuite/lib/ada.exp
index 1bc0dc1d438..0544544acbe 100644
--- a/gdb/testsuite/lib/ada.exp
+++ b/gdb/testsuite/lib/ada.exp
@@ -13,6 +13,25 @@
 # You should have received a copy of the GNU General Public License
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
+# 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
+# evaluated.  FLAGS_ARG will be set to the appropriate compiler flags
+# (if any) for this scenario.  LIST is the list of desired scenarios
+# to run, and BODY is what actually does the work.
+
+proc foreach_gnat_encoding {scenario_arg flags_arg list body} {
+    upvar 1 $scenario_arg scenario
+    upvar 1 $flags_arg flags
+    foreach_with_prefix scenario $list {
+	set flags {}
+	if {$scenario != "none"} {
+	    lappend flags additional_flags=-fgnat-encodings=$scenario
+	}
+	uplevel 1 $body
+    }
+}
+
 # Call target_compile with SOURCE DEST TYPE and OPTIONS as argument,
 # after having temporarily changed the current working directory to
 # BUILDDIR.

-- 
2.44.0


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH 2/2] Introduce gnat-llvm board file
  2024-05-16 17:46 [PATCH 0/2] Initial work for testing gnat-llvm Tom Tromey
  2024-05-16 17:46 ` [PATCH 1/2] Introduce and use foreach_gnat_encoding Tom Tromey
@ 2024-05-16 17:46 ` Tom Tromey
  1 sibling, 0 replies; 3+ messages in thread
From: Tom Tromey @ 2024-05-16 17:46 UTC (permalink / raw)
  To: gdb-patches

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


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2024-05-16 17:46 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-05-16 17:46 [PATCH 0/2] Initial work for testing gnat-llvm Tom Tromey
2024-05-16 17:46 ` [PATCH 1/2] Introduce and use foreach_gnat_encoding Tom Tromey
2024-05-16 17:46 ` [PATCH 2/2] Introduce gnat-llvm board file Tom Tromey

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).