Re: [PATCH 3/4] gdb: distinguish GNU and MSVC flavors of the Windows OS ABI

Simon Marchi <[email protected]>
Newsgroups gmane.comp.gdb.patches
Message-ID <[email protected]>

On 2026-07-14 18:15, Pedro Alves wrote:
> On 2026-07-14 12:57, Eli Zaretskii wrote:
> 
>>> diff --git a/gdb/NEWS b/gdb/NEWS
>>> index ec9b5a33787..cf3948f87e4 100644
>>> --- a/gdb/NEWS
>>> +++ b/gdb/NEWS
>>> @@ -103,6 +103,16 @@
>>>    everywhere GDB shows a filename/dirname: source filenames,
>>>    executable filename, shared libraries, the cd/pwd commands, etc.
>>>  
>>> +* GDB now distinguishes between the GNU (MinGW) and MSVC Windows ABIs.
>>> +
>>> +  The "set osabi" command accepts two new values, "Windows-GNU" and
>>> +  "Windows-MSVC".  The existing "Windows" value continues to work and
>>> +  now means "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.  E.g., --target=x86_64-pc-windows-msvc
>>> +  defaults to the MSVC ABI, and --target=x86_64-w64-mingw32 defaults
>>> +  to GNU ABI.  See "New targets" entry below.
>>
>> This part is okay, but I think it would make sense to tell which
>> compilers produce binaries of Windows-MSVC ABI.  E.g., does the above
>> mean that GDB will now be able to debug programs produces by MSVC,
>> including use of the PDB debug data files?
>>
>> Also, you only mention the 64-bit host and target triplets, but does
>> that mean this is limited to 64-bit Windows programs?
> 
> That was an example, and the "New targets" section being pointed at has the
> 32-bit x86 and AArch64 triplets.  But I can try to make it clearer, along with
> addressing your other points.
> 
> How about this?
> 
> * GDB now distinguishes between the GNU (MinGW) and MSVC Windows ABIs.
> 
>   The "set osabi" command accepts two new values, "Windows-GNU" and
>   "Windows-MSVC".  The GNU ABI is for code produced by MinGW
>   toolchains, while the MSVC ABI is for code produced by Microsoft's
>   MSVC compiler (though see the PDB note below), or Clang targeting
>   one of {i686,aarch64,x86_64}-pc-windows-msvc.  The existing
>   "Windows" value continues to work and now means "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.  For
>   example, --target=x86_64-pc-windows-msvc defaults to the MSVC ABI,
>   and --target=x86_64-w64-mingw32 defaults to GNU ABI.  Similarly for
>   the i686 and AArch64 variants.  See "New targets" entry below.

What happens if you build a GDB with --enable-targets=all and load a
.exe?  Is either ABI preferred over the other?  Would it be possible to
"sniff" what ABI it is, for instance with the presence of some
particular symbol?

Simon
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.