From patchwork Thu May 16 17:46:44 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom Tromey X-Patchwork-Id: 90301 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 0BA8F3849AD4 for ; Thu, 16 May 2024 17:47:21 +0000 (GMT) X-Original-To: gdb-patches@sourceware.org Delivered-To: gdb-patches@sourceware.org Received: from mail-io1-xd33.google.com (mail-io1-xd33.google.com [IPv6:2607:f8b0:4864:20::d33]) by sourceware.org (Postfix) with ESMTPS id DFCFF3858C41 for ; Thu, 16 May 2024 17:46:47 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org DFCFF3858C41 Authentication-Results: sourceware.org; dmarc=pass (p=quarantine dis=none) header.from=adacore.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=adacore.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org DFCFF3858C41 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2607:f8b0:4864:20::d33 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1715881614; cv=none; b=DELMG1Sh8zDreieFVHQGZk/eN1pyKmOvHdMf9mgVImu1bRJfuPwiSj5gFp/uDk9sG44sHHX+/dBg9VepWvZZ2eo45FKrzvi1HjyX+K/8gpfnTtbmt5r7UJoKOtShfIwGbkn4E5x6ie5Eb0zNiB4mz9v23OCSEHzDtFP00zLJxlc= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1715881614; c=relaxed/simple; bh=+kxWjmjiVT8kcYkiSHKDJw35s/hyQfm/wbZ8sb7X1mw=; h=DKIM-Signature:From:Date:Subject:MIME-Version:Message-Id:To; b=IQOg0FyFo4gPC1Rytjhrgrt5HgIwRwcbISR4lp61Wh919lXY9NwXvim8H2hi8tAyhiDR7g13sNGYspWa4eK2C67YYbvwc78CJRptRrs89fFgnpJ1F/W8Tsy9wh6zpxkK0qzYQaJ5f/OdZXL3K29WxHdGSnKYlLP1Ojpkm0nwxCg= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-io1-xd33.google.com with SMTP id ca18e2360f4ac-7d9480d96bdso68232239f.1 for ; Thu, 16 May 2024 10:46:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=adacore.com; s=google; t=1715881607; x=1716486407; darn=sourceware.org; h=to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=iZX7PAMLNf5msHCf3u7H6fSN86Zyy2bWBC0TYwtVNWs=; b=bxtUNddgr9N+OVwSwcVjPKV0nlYVqIJnl/U5tVWZM6fdrhlxzvLMth2cNXApjJXsbq 326Q9yv/E/P5Wdtwwul33i0tpoRW3jzaDCya7GC7f3dsZqio8GoliBBlvHVv14oDKvgL 19J3/h1kkuKjyXo1Ku7XpSUHwPSht8fZuLxnSdMpsy7PB3w9vvf5i4Qg59PVb7LAK+3f IhHXR62k3y/a9wlLI5fMHeFArG3kKv/aJpjLWRYsH7npgGKdnfj2H5Nv8CFnjMQpL6/F WyAj/9LtPA6cINo0Q8EnQurcoYnmL75xR2Lmcp1hdtnZycWoVCpVdRqzXeE5uvAN2/1a KTNA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1715881607; x=1716486407; h=to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=iZX7PAMLNf5msHCf3u7H6fSN86Zyy2bWBC0TYwtVNWs=; b=hrFnBJeOKa38OK5xrHgjTOs71EG1i0DkFmhObYqJSo12bBKGhGEsNx6gC4YWSQmu2X w+XiAY3sD2wDAbZRVKW7Ns74GO6S+hti2wTSYmNbeYKaxSr1w7nABEUpCVJMr8S5JO4s ZOt45g6yknAdZMshWnZaXTTvnJsfnqAiBTnSkuU0N3UHGwvy1Kui7soeah4RcxK4xMJ6 m6aR6rPnMUATp/ZlIAZl2VBjZNZSvPmxO/UcRwXQjGptApdIJHp4BLBoJ5zz7QA9pLqB pa96NziKNvjyUOphaS5p1vnDAx0jIv4CTuV1caI7Gskmq+0oBhQXhiHTQkJRNIMhNoEm ERSA== X-Gm-Message-State: AOJu0YwZ5Bg5I1B8rSlo0nlBICsiksu3Ws/aUk1nvOqvq0/EOQqvsRL5 EIbtxB5kdZu2Mrv5RSDwGaqCaIhniMtbM9ixzpaZjy5qHwtNKq5++BFxjOl7fxFlPd5UPSbtPTM = X-Google-Smtp-Source: AGHT+IE5muHHj5qx393ytdBaDIauoWrLPrNS9qXephBLOx5e62fKIcjCaAkAa2+3NlV4GE5QAJmSHg== X-Received: by 2002:a6b:c404:0:b0:7de:d078:16a4 with SMTP id ca18e2360f4ac-7e1b501541cmr2095417939f.0.1715881606538; Thu, 16 May 2024 10:46:46 -0700 (PDT) Received: from localhost.localdomain (75-166-134-4.hlrn.qwest.net. [75.166.134.4]) by smtp.gmail.com with ESMTPSA id 8926c6da1cb9f-48a43d4e684sm1000821173.90.2024.05.16.10.46.46 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 16 May 2024 10:46:46 -0700 (PDT) From: Tom Tromey Date: Thu, 16 May 2024 11:46:44 -0600 Subject: [PATCH 1/2] Introduce and use foreach_gnat_encoding MIME-Version: 1.0 Message-Id: <20240516-gnat-llvm-experiment-v1-1-5c13d1092119@adacore.com> References: <20240516-gnat-llvm-experiment-v1-0-5c13d1092119@adacore.com> In-Reply-To: <20240516-gnat-llvm-experiment-v1-0-5c13d1092119@adacore.com> To: gdb-patches@sourceware.org X-Mailer: b4 0.13.0 X-Spam-Status: No, score=-11.1 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, KAM_SHORT, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gdb-patches-bounces+patchwork=sourceware.org@sourceware.org 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 . +# 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. From patchwork Thu May 16 17:46:45 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom Tromey X-Patchwork-Id: 90302 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id D36ED384CB97 for ; Thu, 16 May 2024 17:47:44 +0000 (GMT) X-Original-To: gdb-patches@sourceware.org Delivered-To: gdb-patches@sourceware.org Received: from mail-io1-xd36.google.com (mail-io1-xd36.google.com [IPv6:2607:f8b0:4864:20::d36]) by sourceware.org (Postfix) with ESMTPS id C85033858C98 for ; Thu, 16 May 2024 17:46:47 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org C85033858C98 Authentication-Results: sourceware.org; dmarc=pass (p=quarantine dis=none) header.from=adacore.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=adacore.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org C85033858C98 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2607:f8b0:4864:20::d36 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1715881610; cv=none; b=halkXX5ggqrklYAJt1rlcow5EHj78zCbKD1leELVUTiez6L3HCvb5DmLYwayLpXolqbznPEDOfGpM1aJtUTnBJxCl+SpLYzD+g39kG/bdqNXMoACkmrlM3thyf24kckKpb2uxR+mKlBoSD6l4yRg4WRNmImSZiKRwV5eUhrKc5o= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1715881610; c=relaxed/simple; bh=B05L+z5zSaNY+zlv3qTsWPmosZNZv7Cp1CNl3+VUcRg=; h=DKIM-Signature:From:Date:Subject:MIME-Version:Message-Id:To; b=UoGc739gQCCdhnBj6UtscEHuCmp8NUqlziKpJkE3DOmyvgy0yu7x/dz41eMjsEULnww2ou8cRXgY87IdBaagsyPTDwTTsh7RiuHfnDR0VdbsZTlz6cjhLg7sy9C7VdndefRxKhZVWtlEd1lVPFn/zWf/mcRMalzBj6HiprGaOXA= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-io1-xd36.google.com with SMTP id ca18e2360f4ac-7e1cdde66c1so67506339f.2 for ; Thu, 16 May 2024 10:46:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=adacore.com; s=google; t=1715881607; x=1716486407; darn=sourceware.org; h=to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=/m1U4cIZ/z9xRL305l6DC9gH0Ga+dyE1mJnOXRRPlh8=; b=lV/ZnL+QcvEAR0g4mej8XesLy125CxGju70Z8UPdl/bv9Wl5sl3La0nmB0OLrWQn8m uTXW2GE0uLmdAApF2hqwdC45VOCMd8pyZlnWl9mWw9H883LZKwF4ONdwScPNBdy8jyqQ JJ+/MMxw6FZY8DJAQuoQzJErWQnqrOJjoC1NVw4GnMsEz2QmJX3cl7Dzxm/jSEfuzzuC i18HgXftxh/JDPb6nZFmd5SoK/NlYxOJdtexFgDc8Z45U8ejanlz7kBWIhq+baC+HXCW 5ZlR089saW542E+Nc4mThRNws7TdayMm+hwMOSgpAqTiURAabakzUXKu1Otl890Blekl RBCA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1715881607; x=1716486407; h=to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=/m1U4cIZ/z9xRL305l6DC9gH0Ga+dyE1mJnOXRRPlh8=; b=AEisPtJiPI/s/DP9y/4Y9fnzdzmR54uSXC0MGcBYpnfAzIDxvZ3Gw4+baS1CleLeBj HkaHDmnV7J8CeRqYN97HmB3WjbrxaLVfoLPhQhoyJk229ItbbY45nCwpOYhFRqSzxZXj CoevIaE6K+26XP6O9yqqNR0x3kDCZSd88nA/GENLa2sv/REEs0OcCR4z0/QnJkdHFO7h GdpYCZ8xGP4DYZukj8tkbhxBNvZyqlOjSnV5JvUsLZ2wJ9vjGwGOtzol3hBbRPvqGXcc lrCGfCtt9Ta/HFlggpxK0HE9G5TtKd2l/iFnJt/jJQ2rNXHS3RbHR63QILZ13Jp5HeD/ 23ag== X-Gm-Message-State: AOJu0Yzzvu+XLriPm3yTDNb3k5/Rv1UzKDp/4NE2fOb1o10NUA86zcEu oa5XI1r1fQS/xVe1OMzhjIBW52OAYwCVQWE1qF8Fmmz4BaCnUFfFafqebT1j81ykTF1moGyg1Jg = X-Google-Smtp-Source: AGHT+IFZRtvDGd0GjbSh3WBAbJdcg3m33JsZ3qphv3TGP4zDueyTxdD3I9lINgsjaRtgKGUYYzen0g== X-Received: by 2002:a05:6602:2816:b0:7e2:1180:5f45 with SMTP id ca18e2360f4ac-7e211805fe2mr333031439f.15.1715881606956; Thu, 16 May 2024 10:46:46 -0700 (PDT) Received: from localhost.localdomain (75-166-134-4.hlrn.qwest.net. [75.166.134.4]) by smtp.gmail.com with ESMTPSA id 8926c6da1cb9f-48a43d4e684sm1000821173.90.2024.05.16.10.46.46 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 16 May 2024 10:46:46 -0700 (PDT) From: Tom Tromey Date: Thu, 16 May 2024 11:46:45 -0600 Subject: [PATCH 2/2] Introduce gnat-llvm board file MIME-Version: 1.0 Message-Id: <20240516-gnat-llvm-experiment-v1-2-5c13d1092119@adacore.com> References: <20240516-gnat-llvm-experiment-v1-0-5c13d1092119@adacore.com> In-Reply-To: <20240516-gnat-llvm-experiment-v1-0-5c13d1092119@adacore.com> To: gdb-patches@sourceware.org X-Mailer: b4 0.13.0 X-Spam-Status: No, score=-11.1 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, KAM_SHORT, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gdb-patches-bounces+patchwork=sourceware.org@sourceware.org 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 . + +# 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 . +# 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