Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Pedro Alves <pedro@palves.net>
To: Simon Marchi <simark@simark.ca>, Eli Zaretskii <eliz@gnu.org>
Cc: gdb-patches@sourceware.org
Subject: Re: [PATCH 3/4] gdb: distinguish GNU and MSVC flavors of the Windows OS ABI
Date: Wed, 15 Jul 2026 15:10:39 +0100	[thread overview]
Message-ID: <34622628-862d-411a-b2b7-3c4e2174a612@palves.net> (raw)
In-Reply-To: <3bb5dc17-a391-47a5-9548-c3d33b06136c@simark.ca>

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


  reply	other threads:[~2026-07-15 14:11 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-14  0:45 [PATCH 0/4] Support the Windows/MSVC target in GDB Pedro Alves
2026-07-14  0:45 ` [PATCH 1/4] gdb: recognize *-*-windows* Windows targets Pedro Alves
2026-07-14  0:45 ` [PATCH 2/4] gdb: treat Windows host + Windows target as native Pedro Alves
2026-07-14  0:45 ` [PATCH 3/4] gdb: distinguish GNU and MSVC flavors of the Windows OS ABI Pedro Alves
2026-07-14 11:57   ` Eli Zaretskii
2026-07-14 22:15     ` Pedro Alves
2026-07-15  1:21       ` Simon Marchi
2026-07-15 11:18         ` Pedro Alves
2026-07-15 13:13           ` Simon Marchi
2026-07-15 14:10             ` Pedro Alves [this message]
2026-07-15 15:51               ` Simon Marchi
2026-07-15 11:43       ` Eli Zaretskii
2026-07-14  0:45 ` [PATCH 4/4] gdb: MSVC "long double" is a 64-bit double Pedro Alves

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=34622628-862d-411a-b2b7-3c4e2174a612@palves.net \
    --to=pedro@palves.net \
    --cc=eliz@gnu.org \
    --cc=gdb-patches@sourceware.org \
    --cc=simark@simark.ca \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox