From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id wal0MACVV2oBAwoAWB0awg (envelope-from ) for ; Wed, 15 Jul 2026 10:11:12 -0400 Received: by simark.ca (Postfix, from userid 112) id C343F1E09E; Wed, 15 Jul 2026 10:11:12 -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=unavailable autolearn_force=no version=4.0.1 Received: from vm01.sourceware.org (vm01.sourceware.org [38.145.34.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 9C39B1E033 for ; Wed, 15 Jul 2026 10:11:11 -0400 (EDT) Received: from vm01.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id C13D74BA2E27 for ; Wed, 15 Jul 2026 14:11:10 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org C13D74BA2E27 Received: from mail-ed1-f51.google.com (mail-ed1-f51.google.com [209.85.208.51]) by sourceware.org (Postfix) with ESMTPS id 841824BA2E0C for ; Wed, 15 Jul 2026 14:10:47 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 841824BA2E0C 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 841824BA2E0C Authentication-Results: sourceware.org; arc=none smtp.remote-ip=209.85.208.51 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1784124647; cv=none; b=cmuSXJ3RbUVrxK7Urw9gMz2wGZiqPH3v1+58P18i7elkvDQGi7+/6YLn251dNpf2ez6JDfvZZ7L2ZyDmWfCH0NHt+Ts3n2dep1q1o+I2G58n43zZoBuya4LiKXjH9BK5h0mspLIF9oeUmaY4VZTl5Mjiagc6HJKb1RGeRhMdqgs= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1784124647; c=relaxed/simple; bh=T85OlJgCa1+l1bo1MauGBIHD+Mue1LUpicw0H6JHaPw=; h=Message-ID:Date:MIME-Version:Subject:To:From; b=Qj07OHWbcq6cwZrlTELUFRpBC688IHF2+CsTtX/3AwwZgddPhm9XBgzFKuwDYko8N+86cGVPaLl8CqM+erE3QeJu5jqN5+kQwzzYgUy4ctBVbrnTVqlwp80IWNvX78P6mk6SBVFboa74WFNHRTHENXqWTyw0RTxBIP1uZeLIffc= ARC-Authentication-Results: i=1; sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 841824BA2E0C Received: by mail-ed1-f51.google.com with SMTP id 4fb4d7f45d1cf-69e28b554ceso339041a12.0 for ; Wed, 15 Jul 2026 07:10:47 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1784124646; x=1784729446; h=content-transfer-encoding:content-type:in-reply-to:content-language :from:references:cc:to:subject:user-agent:mime-version:date :message-id:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to:content-type; bh=prMxkctvi2F1Y8Rbd0wCm0/ETCFMaiY+SYdJyDrBXDc=; b=lNIfrx/jF8Z2TWFK8rr5yU/Q/6VGkQmFeEVXAPXYHmDu/ldzM2jgFIgyZiVT66mADl uo5WqRY5oe92OOB1Or3B0PXoXhs23RVKmO5kzMZMEa1gpIfjj3GoaAmXCMQfcXtUiMNY HMdfuNdMw6EVOu7a6n1r1h8iWSvYeara2IH52V7QV/RrvVR/lndp6MvnSGkjgU6NyfHa JjFSzb5sHhiWoAoanQzsy274nWmFzHubB+VrnjgijehTciGC1Ij4iYH9muEzc6PMLna+ 59HVk7RyqxyqfJh4cF6Nf8WbjSJHe7JHgucdFZZEugrxLtTAtImRtuEd12FsGdRw8OfM OpHA== X-Gm-Message-State: AOJu0Yy83/oLttUJlZeSLiqM5PyDLU3965rLEXHQu4X8erEql7prJ5Ql hQVrZY1SIK0nnZao/6oYAJWig971wKAxIb92Yc1ja744kQqltqINjN1wjtHeuLkJ X-Gm-Gg: AfdE7ckTVcYO/Q3BlB8VqiGZYQGOIMWwUbQfAJ9i3/HqLkH4R80YveND0hS+bSyiHfd N+AEd8LdhDDLGKsI/jHXByvoCSQmM5OZ/B5vGXmgjLPwC+MJROuIA+y0LfXsbEe/sDwUgpsiwG3 2agEskCe5nILk/XFcrQ9BO8Hnh+oUdTHfPVzg1THU2/F/rR2JwbRMa4skT1S1wBf6rbfMR4IgmE bzdV6Gc51wUnrTvBb/m4fqwqIHKNkbrrvM7P9u6YFSqCpRRlDvyCXxSnmcHYhPFDW/rAINpsU18 tUCAo6oXZf8ymcDh790XWJ7mXdy1xjhaZeX6xtRufEMVtIRg05jkpMUc/ddTsqyZYsiNlbwGq5I gldSlFj048hDXvx9G9QATzd+12aAutYOz6frWODrtuj2hpLG8oHuNRkf4CDFRIDZJbyu/BZbs1L o5cF00Q1ef9aFAMepBf8wpFp5SWClQhKe2HYCDNNBMfd6dRnhz0w+8WeWB5aadNH/jbw== X-Received: by 2002:a17:907:cf87:b0:c12:80a9:d571 with SMTP id a640c23a62f3a-c161e9a4fc5mr1024187766b.24.1784124646005; Wed, 15 Jul 2026 07:10:46 -0700 (PDT) Received: from ?IPV6:2001:8a0:fae3:3700:ff5e:7320:54b2:c34c? ([2001:8a0:fae3:3700:ff5e:7320:54b2:c34c]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-c16871a3dc2sm37169366b.26.2026.07.15.07.10.45 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 15 Jul 2026 07:10:45 -0700 (PDT) Message-ID: <34622628-862d-411a-b2b7-3c4e2174a612@palves.net> Date: Wed, 15 Jul 2026 15:10:39 +0100 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH 3/4] gdb: distinguish GNU and MSVC flavors of the Windows OS ABI To: Simon Marchi , Eli Zaretskii Cc: gdb-patches@sourceware.org References: <20260714004507.1323332-1-pedro@palves.net> <20260714004507.1323332-4-pedro@palves.net> <86ik6hg4vu.fsf@gnu.org> <2c36a069-53ed-465f-8ecf-360cc272eaac@palves.net> <4953c47d-3904-4df4-945b-4693c2df9dad@simark.ca> <3bb5dc17-a391-47a5-9548-c3d33b06136c@simark.ca> From: Pedro Alves Content-Language: en-US In-Reply-To: <3bb5dc17-a391-47a5-9548-c3d33b06136c@simark.ca> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit 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 On 2026-07-15 14:13, Simon Marchi wrote: > On 7/15/26 7:18 AM, Pedro Alves wrote: >> On 2026-07-15 02:21, Simon Marchi wrote: >>> What happens if you build a GDB with --enable-targets=all and load a >>> .exe? Is either ABI preferred over the other? >> >> The preferred one is taken out of --target, defaults to GNU. >> --enable-targets=foo,bar,all does not affect it. > > I was thinking when building GDB on Linux (with --target that defaults > to something Linux) with --enable-targets=all, i.e. a typical > development build. In that case, the --target does not help to choose > an ABI, so the fallback must come from somewhere else. > Hmm, I _think_ I see what the confusion is. The logic is: "let GDB pick the flavor": GDB uses the configured default OS ABI (from --target) when that is a Windows flavor, and otherwise assumes the GNU flavor." ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ The code that does this is here: + /* A generic "Windows" OS ABI means a PE binary whose flavor -- + GNU (MinGW) or MSVC -- could not be determined. The osabi + sniffers and gdbserver's target description both report the + generic "Windows" OS ABI, because neither can tell the two + flavors apart from the binary alone. Resolve it here to a + concrete flavor: use the configured default if that is itself a + Windows flavor, otherwise assume GNU. */ + if (info->osabi == GDB_OSABI_WINDOWS) + { + info->osabi = GDB_OSABI_WINDOWS_GNU; <<< "somewhere else" +#ifdef GDB_OSABI_DEFAULT + if (GDB_OSABI_DEFAULT == GDB_OSABI_WINDOWS_GNU + || GDB_OSABI_DEFAULT == GDB_OSABI_WINDOWS_MSVC) + info->osabi = GDB_OSABI_DEFAULT; +#endif + } So with --target=Linux, if the sniffer, or the target.xml, or the user picks/returns GDB_OSABI_WINDOWS, we resolve to GDB_OSABI_WINDOWS_GNU, as GDB_OSABI_DEFAULT itself is not a Windows flavor (it's GDB_OSABI_LINUX). Does this clarify it? The "somewhere else" is basically indicated above in the <<< line. Pedro Alves