From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id cYACHN4QYmr2WSkAWB0awg (envelope-from ) for ; Thu, 23 Jul 2026 09:02:22 -0400 Authentication-Results: simark.ca; dkim=pass (2048-bit key; unprotected) header.d=palves.net header.i=@palves.net header.a=rsa-sha256 header.s=dreamhost header.b=Rm7KGFuO; dkim-atps=neutral Received: by simark.ca (Postfix, from userid 112) id 6EFEB1E09E; Thu, 23 Jul 2026 09:02:22 -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.4 required=5.0 tests=ARC_SIGNED,ARC_VALID,BAYES_00, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,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 96B621E099 for ; Thu, 23 Jul 2026 09:02:21 -0400 (EDT) Received: from vm01.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 2DBAF4BA79B4 for ; Thu, 23 Jul 2026 13:02:20 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 2DBAF4BA79B4 Authentication-Results: sourceware.org; dkim=pass (2048-bit key, unprotected) header.d=palves.net header.i=@palves.net header.a=rsa-sha256 header.s=dreamhost header.b=Rm7KGFuO Received: from bisque.yew.relay.mailchannels.net (bisque.yew.relay.mailchannels.net [23.83.220.18]) by sourceware.org (Postfix) with ESMTPS id 3199F4BA23F7 for ; Thu, 23 Jul 2026 13:01:46 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 3199F4BA23F7 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=palves.net Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=palves.net ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 3199F4BA23F7 Authentication-Results: sourceware.org; arc=none smtp.remote-ip=23.83.220.18 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1784811707; cv=none; b=UdbfSQHJAYOh/3gqG93VXO6sE3AGqDUtGRGbN//SHTMGF56wbedbjEYavOe/oYOGnUreB2ybCcakNGq9/uG2pjze5YOnTWSDxy6EJh3qFfWX3j2yVPYqilngB45ogTmxutSlJn/BrQzjjG/Ie8SQa+JP64Mc8Fz+418TK50Yt6g= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1784811707; c=relaxed/simple; bh=OQnR8lV9DU1Gt+Zpu3OFc91AIZITBWk84qrzvbJbCSU=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=xJkjHnQi+Uys48NXRJoxNIvTRSKA9Y15AGdnkXYsfbg9zlAfPRw3YlyDS1iRy/M1M36RvngdIfVVrBsK/qBxfQdtpnRrEBoox7RLO4To4gavhsGbLqfAZfC47ddkHhUOFm6sty4iQa5Mjg2IT+N0FygTN72az70xpcmWH6b0xws= ARC-Authentication-Results: i=1; sourceware.org; dkim=pass (2048-bit key, unprotected) header.d=palves.net header.i=@palves.net header.a=rsa-sha256 header.s=dreamhost header.b=Rm7KGFuO DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 3199F4BA23F7 X-Sender-Id: dreamhost|x-authsender|pedro@palves.net Received: from relay.mailchannels.net (localhost [127.0.0.1]) by relay.mailchannels.net (Postfix) with ESMTP id D7F9446269B for ; Thu, 23 Jul 2026 13:01:45 +0000 (UTC) Received: from pdx1-sub0-mail-a249.dreamhost.com (100-104-248-98.trex-nlb.outbound.svc.cluster.local [100.104.248.98]) (Authenticated sender: dreamhost) by relay.mailchannels.net (Postfix) with ESMTPA id 79BBB4629B0 for ; Thu, 23 Jul 2026 13:01:45 +0000 (UTC) X-Sender-Id: dreamhost|x-authsender|pedro@palves.net X-MC-Relay: Good X-MailChannels-SenderId: dreamhost|x-authsender|pedro@palves.net X-MailChannels-Auth-Id: dreamhost X-Whistle-Relation: 218d337a524a5e36_1784811705781_3881485554 X-MC-Loop-Signature: 1784811705781:110633042 X-MC-Ingress-Time: 1784811705781 Received: from pdx1-sub0-mail-a249.dreamhost.com (pop.dreamhost.com [64.90.62.162]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384) by 100.104.248.98 (trex/8.0.2); Thu, 23 Jul 2026 13:01:45 +0000 Received: from localhost (bl20-181-64.dsl.telepac.pt [2.81.181.64]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: pedro@palves.net) by pdx1-sub0-mail-a249.dreamhost.com (Postfix) with ESMTPSA id 4h5WV070jLz105D for ; Thu, 23 Jul 2026 06:01:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=palves.net; s=dreamhost; t=1784811705; bh=JW0niVzZgTiheMo6ZXtlBptVtQ4wWQe5S0y+PXD+gok=; h=From:To:Subject:Date:Content-Transfer-Encoding; b=Rm7KGFuODlZ4S/tV/RaQ6jBWrd+XPqujdzR40/AefiXnMvMnC6AFKvBLPks7lHhQa 5IEjN+hIPxe+48Aiw6QBfet+yV/T26yefBZQsi2tcoSEVJ6JPvn50plIt9CAhq8Q5n ERlManrAFLAGCV4grGuQyy4i52kZ0NhwoQ66pRGtgftuf3jKoEi9qIH6XYchsxv71B LSm9LvxAbGTIbF7zAlBcYcnLEOBe9PFoBgQgD/bQAkgx6XEzu3Um2x/09ufqvQRzdB yzHGo92grbzu2sFVs4t4qD1ag6z3IZWl3lxS9272WFZWm1X957nREkNEor/0d/ehFx Mz7RVmEf8GMaA== From: Pedro Alves To: gdb-patches@sourceware.org Subject: [PATCH 02/27] gdb/testsuite: Use unprefixed runtest for a native Windows/MSVC build Date: Thu, 23 Jul 2026 14:00:53 +0100 Message-ID: <20260723130118.206735-3-pedro@palves.net> X-Mailer: git-send-email 2.54.0 In-Reply-To: <20260723130118.206735-1-pedro@palves.net> References: <20260723130118.206735-1-pedro@palves.net> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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~public-inbox=simark.ca@sourceware.org This is the first of two pieces making plain "make check" Just Work when testing a MinGW-hosted GDB targeting the MSVC ABI: --host=x86_64-w64-mingw32 --target=x86_64-pc-windows-msvc When running the testsuite for a configuration where the host and target triplets differ, the testsuite Makefile runs a target-prefixed runtest -- e.g. x86_64-pc-windows-msvc-runtest, which fails with: /bin/sh: line 1: x86_64-pc-windows-msvc-runtest: command not found For a MinGW-hosted GDB targeting the MSVC ABI, the two triplets differ, but it's still a native configuration and the plain "runtest" should be used. This is the same native-vs-cross distinction that gdb/configure.ac already makes for gdb_native, so fix this by factoring that logic into a new GDB_AC_NATIVE m4 macro and use it in both places. gdb/gdb-native.m4 is now included by both gdb/configure.ac (via acinclude.m4) and gdb/testsuite/configure.ac (via aclocal.m4), the same way transform.m4 is shared. Change-Id: Ia2d8cc0c685d8dd0a070f570798817e620857ab1 --- gdb/acinclude.m4 | 3 +++ gdb/configure | 40 +++++++++++++++++++------------------- gdb/configure.ac | 23 +++------------------- gdb/gdb-native.m4 | 30 ++++++++++++++++++++++++++++ gdb/testsuite/Makefile.in | 3 ++- gdb/testsuite/aclocal.m4 | 1 + gdb/testsuite/configure | 19 ++++++++++++++++++ gdb/testsuite/configure.ac | 5 +++++ 8 files changed, 83 insertions(+), 41 deletions(-) create mode 100644 gdb/gdb-native.m4 diff --git a/gdb/acinclude.m4 b/gdb/acinclude.m4 index 64cbab0b93a..c74e2d3dcba 100644 --- a/gdb/acinclude.m4 +++ b/gdb/acinclude.m4 @@ -15,6 +15,9 @@ m4_include(acx_configure_dir.m4) # This gets GDB_AC_TRANSFORM. m4_include(transform.m4) +# This gets GDB_AC_NATIVE. +m4_include(gdb-native.m4) + # This get AM_GDB_COMPILER_TYPE. m4_include(../gdbsupport/compiler-type.m4) diff --git a/gdb/configure b/gdb/configure index 93b2df6f99b..f0f90b6be08 100755 --- a/gdb/configure +++ b/gdb/configure @@ -25218,26 +25218,26 @@ CPPFLAGS=$OLD_CPPFLAGS # configuration. gdb_host_obs=posix-hdep.o -# Check whether the configuration is native -- i.e., whether GDB will -# debug processes running on the same machine it runs on. If so, we -# let configure.host and configure.nat pull in the native-debug -# support. -gdb_native=no -if test "${target}" = "${host}"; then - gdb_native=yes -elif test "${host_cpu}" = "${target_cpu}"; then - # Debugging Windows binaries on a Windows host is native even when - # the host and target triplets differ across the mingw/cygwin/msvc - # ABI boundary. E.g., a mingw32-hosted GDB targeting binaries - # produced by a compiler defaulting to windows-msvc. - case ${host_os} in - mingw* | cygwin*) - case ${target_os} in - mingw* | cygwin* | windows*) - gdb_native=yes ;; - esac ;; - esac -fi +# Check whether the configuration is native. If so, we let +# configure.host and configure.nat pull in the native-debug support. + + gdb_native=no + if test "${target}" = "${host}"; then + gdb_native=yes + elif test "${host_cpu}" = "${target_cpu}"; then + # Debugging Windows binaries on a Windows host is native even when + # the host and target triplets differ across the mingw/cygwin/msvc + # ABI boundary. E.g., a mingw32-hosted GDB targeting binaries + # produced by a compiler defaulting to windows-msvc. + case ${host_os} in + mingw* | cygwin*) + case ${target_os} in + mingw* | cygwin* | windows*) + gdb_native=yes ;; + esac ;; + esac + fi + . $srcdir/configure.host diff --git a/gdb/configure.ac b/gdb/configure.ac index 50d04ff9027..30972e9a442 100644 --- a/gdb/configure.ac +++ b/gdb/configure.ac @@ -222,26 +222,9 @@ BFD_64_BIT # configuration. gdb_host_obs=posix-hdep.o -# Check whether the configuration is native -- i.e., whether GDB will -# debug processes running on the same machine it runs on. If so, we -# let configure.host and configure.nat pull in the native-debug -# support. -gdb_native=no -if test "${target}" = "${host}"; then - gdb_native=yes -elif test "${host_cpu}" = "${target_cpu}"; then - # Debugging Windows binaries on a Windows host is native even when - # the host and target triplets differ across the mingw/cygwin/msvc - # ABI boundary. E.g., a mingw32-hosted GDB targeting binaries - # produced by a compiler defaulting to windows-msvc. - case ${host_os} in - mingw* | cygwin*) - case ${target_os} in - mingw* | cygwin* | windows*) - gdb_native=yes ;; - esac ;; - esac -fi +# Check whether the configuration is native. If so, we let +# configure.host and configure.nat pull in the native-debug support. +GDB_AC_NATIVE([gdb_native]) . $srcdir/configure.host diff --git a/gdb/gdb-native.m4 b/gdb/gdb-native.m4 new file mode 100644 index 00000000000..0849c04d14b --- /dev/null +++ b/gdb/gdb-native.m4 @@ -0,0 +1,30 @@ +# Copyright (C) 2026 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation gives +# unlimited permission to copy and/or distribute it, with or without +# modifications, as long as this notice is preserved. + +# GDB_AC_NATIVE([VAR]) +# +# Determine whether this is a native configuration -- i.e., whether +# GDB will debug processes running on the same machine it runs on. +# Store "yes" or "no" in the output variable. + +AC_DEFUN([GDB_AC_NATIVE], [ + $1=no + if test "${target}" = "${host}"; then + $1=yes + elif test "${host_cpu}" = "${target_cpu}"; then + # Debugging Windows binaries on a Windows host is native even when + # the host and target triplets differ across the mingw/cygwin/msvc + # ABI boundary. E.g., a mingw32-hosted GDB targeting binaries + # produced by a compiler defaulting to windows-msvc. + case ${host_os} in + mingw* | cygwin*) + case ${target_os} in + mingw* | cygwin* | windows*) + $1=yes ;; + esac ;; + esac + fi +]) diff --git a/gdb/testsuite/Makefile.in b/gdb/testsuite/Makefile.in index f103d7ddd65..b852dbceb50 100644 --- a/gdb/testsuite/Makefile.in +++ b/gdb/testsuite/Makefile.in @@ -28,6 +28,7 @@ program_transform_name = @program_transform_name@ build_canonical = @build@ host_canonical = @host@ target_canonical = @target@ +gdb_native = @gdb_native@ enable_libctf = @enable_libctf@ SHELL = @SHELL@ @@ -66,7 +67,7 @@ RUNTEST_FOR_TARGET = `\ if [ -f $${srcdir}/../../dejagnu/runtest ]; then \ echo $${srcdir}/../../dejagnu/runtest; \ else \ - if [ "$(host_canonical)" = "$(target_canonical)" ]; then \ + if [ "$(gdb_native)" = yes ]; then \ echo runtest; \ else \ t='$(program_transform_name)'; echo runtest | sed -e $$t; \ diff --git a/gdb/testsuite/aclocal.m4 b/gdb/testsuite/aclocal.m4 index c5d3ba527a7..0fe30d7fc5c 100644 --- a/gdb/testsuite/aclocal.m4 +++ b/gdb/testsuite/aclocal.m4 @@ -2,6 +2,7 @@ m4_include(../../config/acx.m4) m4_include(../../config/override.m4) m4_include(../../config/enable.m4) m4_include(../transform.m4) +m4_include(../gdb-native.m4) # AM_CONDITIONAL -*- Autoconf -*- diff --git a/gdb/testsuite/configure b/gdb/testsuite/configure index 6ea9686516d..f2818fd0a0c 100755 --- a/gdb/testsuite/configure +++ b/gdb/testsuite/configure @@ -626,6 +626,7 @@ NM_TRANSFORM_NAME GAS_TRANSFORM_NAME READELF_TRANSFORM_NAME STRIP_TRANSFORM_NAME +gdb_native EXTRA_RULES EGREP GREP @@ -3449,6 +3450,24 @@ if test "${build}" = "${host}" -a "${host}" = "${target}"; then fi +# Whether this is a native configuration. When it is, the testsuite +# runs the unprefixed "runtest" rather than a target-prefixed one. + + gdb_native=no + if test "${target}" = "${host}"; then + gdb_native=yes + elif test "${host_cpu}" = "${target_cpu}"; then + case ${host_os} in + mingw* | cygwin*) + case ${target_os} in + mingw* | cygwin* | windows*) + gdb_native=yes ;; + esac ;; + esac + fi + + + # Transform the name of some programs and generate the lib/pdtrace # test tool. test "$program_prefix" != NONE && diff --git a/gdb/testsuite/configure.ac b/gdb/testsuite/configure.ac index 6eae19656df..8e64b216f95 100644 --- a/gdb/testsuite/configure.ac +++ b/gdb/testsuite/configure.ac @@ -86,6 +86,11 @@ if test "${build}" = "${host}" -a "${host}" = "${target}"; then fi AC_SUBST(EXTRA_RULES) +# Whether this is a native configuration. When it is, the testsuite +# runs the unprefixed "runtest" rather than a target-prefixed one. +GDB_AC_NATIVE([gdb_native]) +AC_SUBST(gdb_native) + # Transform the name of some programs and generate the lib/pdtrace # test tool. AC_ARG_PROGRAM -- 2.54.0