From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id Yb2TCOaGVWoA6QYAWB0awg (envelope-from ) for ; Mon, 13 Jul 2026 20:46:30 -0400 Received: by simark.ca (Postfix, from userid 112) id 201AC1E09E; Mon, 13 Jul 2026 20:46:30 -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 432721E099 for ; Mon, 13 Jul 2026 20:46:29 -0400 (EDT) Received: from vm01.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 1694B4BA2E16 for ; Tue, 14 Jul 2026 00:46:28 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 1694B4BA2E16 Received: from mail-wm1-f42.google.com (mail-wm1-f42.google.com [209.85.128.42]) by sourceware.org (Postfix) with ESMTPS id CEC2E4BA2E2C for ; Tue, 14 Jul 2026 00:45:34 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org CEC2E4BA2E2C Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=palves.net Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org CEC2E4BA2E2C Authentication-Results: sourceware.org; arc=none smtp.remote-ip=209.85.128.42 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1783989935; cv=none; b=d1hRWtNW5Tg1i+NJbP/6y5s6dASMcq5rfw0gTCh5DInG1Cw1IIsout4wDSvpt1JRQBVrWn5NpAWLxzNxn3LpynR5X+mllew20o3iukWhz6MGrOdZlb9TLF3AcYmmSXXvRon0Y7OAnKPgyof5rE6b91hN1SCwnfui2BYXYnwsh2U= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1783989935; c=relaxed/simple; bh=zzvkcihD3pCeLzWCnTVDTc6ve0LmatT1syMke4A4rIA=; h=From:To:Subject:Date:Message-ID:MIME-Version; b=eKN463JVdE8o2QoXY/ELKfli50oOG8bNkeplIetxtZ4wkvVoBqbOrk9lo4OqnExkH05kPtGtufHMl/7rUssQg3Et6lh3WNpSqEUZYSbbTFnyr+ezjjQwXMnRSAbZNWlidjz9M0zBgoDg3j9d4F3XQeQMBDmeVXavamNWcjOADbM= ARC-Authentication-Results: i=1; sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org CEC2E4BA2E2C Received: by mail-wm1-f42.google.com with SMTP id 5b1f17b1804b1-493c7902f47so33630635e9.1 for ; Mon, 13 Jul 2026 17:45:34 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1783989934; x=1784594734; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-gg:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to:content-type; bh=S4EOL9Mpfmr7hufuTSR/e5gCh7CwjLuwnq59nVvA5MU=; b=JFOIPijnrGtYyfaN0Thor+/WI1dwmx58mw/EXmofPgKcAosLB35iSEpCgxG+9EX9Ya rFD9hfbo3gXFzQi13CfHPuDx97YBHWuMExbKaR6/KR0goiEPtifT7moJxKeDQ/MCWjdA heraZQIs1Ln6cPqQEL9z9kBSWmAyPIE93UI8+5tzlG4QDbUadsDs75Ac4GDkDCdVsnzV Leq3+8VHDqbYMZFUGE/jqQEKE9A7XSneJyU2WhGKmJKhl7nWGdeYHByBU6vWXszg29Gb Cf/Gck85+1i+de/pdT0LaoKMRuPgm6IZrJC0hF8meyw0+r3Ptmv38SJEs4QmM3LVjICX nBKQ== X-Gm-Message-State: AOJu0YxmIMlhedWNurfKRzYZ/yFfeEt8t8wVr1gONpFDyyYXOAvCvazv 6FLB1BVEbdjoA3+Xzeq3Jub/qsAaUverdyxT0OqS5r9qGV7Mv/r1S5K2XbGhD1hLzI4= X-Gm-Gg: AfdE7ckwKAtZFWwUviUyTioq3SBoyr19Uo7Jgrs+RNlZH5levLhfy01fgq5wugo66sc SLIY9MWzcXJleFy1HYRkXU8o+v+7Ey+AOyZkj2hb05WrM11UYNVbG4D1hwCOon4puchvht6yZeG DXN48QFHIAAUtmlE30CHXhRToPauZnA4hqLQj8ugybRGhJJA6iuvDk3MhuQGzIx92x01O7ADtYP //tVi+I0uJqAqQ/txFsxFOS609/cUoVZ5h7ZGmr4CXMp230t8WSKV3FQv7r0TT9EHNQPV7xgbBE TPIjVyUQlSJ6ZF0FJQVRui/X2dLsXJltIusg/nySWiPeoACIM11RuTRkxwVbPKqxMndBTAsWvkS TVjJCC4EM8/gff3ESQPM7JuNBGGQI3hvtzr1Rs8PyZADLsWmwY3cPFu24yhcMWrsQ9/qVnaQ4hl +Bk1Yp8nRtjlc= X-Received: by 2002:a05:600c:4e94:b0:493:e57d:4f58 with SMTP id 5b1f17b1804b1-493f883b7f3mr118601245e9.36.1783989933605; Mon, 13 Jul 2026 17:45:33 -0700 (PDT) Received: from localhost ([2001:8a0:fae3:3700:e20e:b691:1f0e:d301]) by smtp.gmail.com with UTF8SMTPSA id 5b1f17b1804b1-4950a32b9f3sm39129255e9.13.2026.07.13.17.45.33 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 13 Jul 2026 17:45:33 -0700 (PDT) From: Pedro Alves To: gdb-patches@sourceware.org Subject: [PATCH 2/4] gdb: treat Windows host + Windows target as native Date: Tue, 14 Jul 2026 01:45:05 +0100 Message-ID: <20260714004507.1323332-3-pedro@palves.net> X-Mailer: git-send-email 2.54.0 In-Reply-To: <20260714004507.1323332-1-pedro@palves.net> References: <20260714004507.1323332-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 Configuring GDB with: --host=x86_64-w64-mingw32 --target=x86_64-pc-windows-msvc currently results in a cross- or remote-only debugger, with the Windows native-debug support (windows-nat.o and friends) left out. This is because gdb/configure currently decides whether GDB is a native debugger by comparing the host and target triplets for exact equality: if test "${target}" = "${host}"; then gdb_native=yes else gdb_native=no fi That is too strict on Windows. A GDB built on mingw (host x86_64-w64-mingw32) that targets binaries produced by a compiler defaulting to the MSVC ABI (target x86_64-pc-windows-msvc) debugs processes running on the same machine, so it is native, even though the two triplets differ in vendor and OS. With the strict check such a configuration ends up with gdb_native=no, and configure.nat is not sourced, and the Windows native-debug support is left out. Fix this by relaxing the check -- in addition to the exact-match case, treat the configuration as native when the host and target CPUs match and both host and target are Windows systems. Requiring the CPUs to match makes it so that cross-CPU configurations such as an aarch64 host with an x86_64 target continue to be non-native. Change-Id: I7f92436b7978b65aec6ba404bc8f7bbb954326f7 --- gdb/configure | 19 +++++++++++++++++-- gdb/configure.ac | 19 +++++++++++++++++-- 2 files changed, 34 insertions(+), 4 deletions(-) diff --git a/gdb/configure b/gdb/configure index 3733ef76948..45145a00b63 100755 --- a/gdb/configure +++ b/gdb/configure @@ -25218,10 +25218,25 @@ 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 -else - gdb_native=no +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 5296d76f2cf..5d71e2bf1a4 100644 --- a/gdb/configure.ac +++ b/gdb/configure.ac @@ -222,10 +222,25 @@ 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 -else - gdb_native=no +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 -- 2.54.0