From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id 8VMQLjdjYmrXVSoAWB0awg (envelope-from ) for ; Thu, 23 Jul 2026 14:53:43 -0400 Received: by simark.ca (Postfix, from userid 112) id B7FE51E09E; Thu, 23 Jul 2026 14:53:43 -0400 (EDT) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-25) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-5.3 required=5.0 tests=ARC_SIGNED,ARC_VALID,BAYES_00, MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham autolearn_force=no version=4.0.1 Received: from vm01.sourceware.org (vm01.sourceware.org [IPv6:2620:52:6:3111::32]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange x25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPS id 0E9E01E033 for ; Thu, 23 Jul 2026 14:53:43 -0400 (EDT) Received: from vm01.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 636F14BA79A8 for ; Thu, 23 Jul 2026 18:53:41 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 636F14BA79A8 Received: from angie.orcam.me.uk (angie.orcam.me.uk [IPv6:2001:4190:8020::34]) by sourceware.org (Postfix) with ESMTP id 78A9C4BA540B for ; Thu, 23 Jul 2026 18:52:47 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 78A9C4BA540B Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=orcam.me.uk Authentication-Results: sourceware.org; spf=none smtp.mailfrom=orcam.me.uk ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 78A9C4BA540B Authentication-Results: sourceware.org; arc=none smtp.remote-ip=2001:4190:8020::34 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1784832767; cv=none; b=gjwhwNsaOZ9tGInDZnFHmhLCRJN8SdfnXE0cG9zrCXXB/tk5hm9Nw8yM8aaHLfhFtPxotv9qXfs+EM3B5i+xue2Z7m40mdBJJry4Mva9d2mTIYeRy9WBpe2LLD2JOPoRAhgqKULRfh4AqfGzcGxQgeJAeLbOQDGIZlVkWGckRSk= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1784832767; c=relaxed/simple; bh=BN9/apS58Nbtbmf3oCzfxttX2lL7X2gOEJdkaiJM9v8=; h=Date:From:To:Subject:Message-ID:MIME-Version; b=pFdj/kpVuk0gjr0Uec+/TKoY7JgRpbcTfLIA4zfc7HcY9P3YoNvUblkGVywiToSw6CXUDECQ0QDBizM4CAMbSoSyxLlKCvp72OhPQK+GAj1g9rlQj2Q2zAuOh2XzNGbjQP09xwo+BDp0opXYw7bHZ5aj4XqNMH0LbPb0Hmm/bRk= ARC-Authentication-Results: i=1; sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 78A9C4BA540B Received: by angie.orcam.me.uk (Postfix, from userid 500) id 643C392009D; Thu, 23 Jul 2026 20:52:46 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by angie.orcam.me.uk (Postfix) with ESMTP id 5D47792009B; Thu, 23 Jul 2026 19:52:46 +0100 (BST) Date: Thu, 23 Jul 2026 19:52:46 +0100 (BST) From: "Maciej W. Rozycki" To: gdb-patches@sourceware.org cc: Jovan Dmitrovic , Djordje Todorovic , Milica Matic , "Maciej W. Rozycki" Subject: [PATCH 1/7] testsuite: Factor out target feature test template In-Reply-To: Message-ID: References: User-Agent: Alpine 2.21 (DEB 202 2017-01-01) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII 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: , Reply-To: "Maciej W. Rozycki" Errors-To: gdb-patches-bounces~public-inbox=simark.ca@sourceware.org From: Maciej W. Rozycki Implement `allow_target_tests' generic target feature test procedure, factoring out duplicate code from tests such as `allow_altivec_tests', `allow_power_isa_3_1_tests', `allow_vsx_tests', etc. --- gdb/testsuite/lib/gdb.exp | 44 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) gdb-test-target-allow.diff Index: binutils-gdb/gdb/testsuite/lib/gdb.exp =================================================================== --- binutils-gdb.orig/gdb/testsuite/lib/gdb.exp +++ binutils-gdb/gdb/testsuite/lib/gdb.exp @@ -4285,6 +4285,50 @@ gdb_caching_proc libc_has_debug_info {} } } +# Using name ME for reporting, check for target feature FEATURE, the +# absence of which is supposed to get message MESSAGE produced by GDB. +# Use source SRC and optional list of additional compiler flags FLAGS +# for the check. Make sure the source provided builds and then that +# target hardware runs it. +proc allow_target_tests { me feature message src { flags {} } } { + global srcdir subdir gdb_prompt inferior_exited_re + + set compile_flags {} + foreach flag $flags { + require {have_compile_flag $flag} + lappend compile_flags "additional_flags=$flag" + } + + if {![gdb_simple_compile $me $src executable $compile_flags]} { + return 0 + } + + gdb_exit + gdb_start + gdb_reinitialize_dir $srcdir/$subdir + gdb_load "$obj" + gdb_run_cmd + gdb_expect { + -re ".*${message}.*${gdb_prompt} $" { + verbose -log "\n$me $feature not detected" + set allow_target_tests 0 + } + -re ".*$inferior_exited_re normally.*${gdb_prompt} $" { + verbose -log "\n$me: $feature detected" + set allow_target_tests 1 + } + default { + warning "\n$me: default case taken" + set allow_target_tests 0 + } + } + gdb_exit + remote_file build delete $obj + + verbose "$me: returning $allow_target_tests" 2 + return $allow_target_tests +} + # Run a test on the target to see if it supports vmx hardware. Return 1 if so, # 0 if it does not. Based on 'check_vmx_hw_available' from the GCC testsuite.