From: Pedro Alves <pedro@palves.net>
To: gdb-patches@sourceware.org
Subject: [PATCH 0/4] Support the Windows/MSVC target in GDB
Date: Tue, 14 Jul 2026 01:45:03 +0100 [thread overview]
Message-ID: <20260714004507.1323332-1-pedro@palves.net> (raw)
This series teaches GDB about Windows targets whose triplet uses the
"windows" OS, as produced by Clang (e.g. x86_64-pc-windows-msvc), and
about the MSVC ABI those targets use.
The motivation is to be able to build a MinGW-hosted GDB that defaults
to debugging MSVC-ABI binaries, and to run the testsuite with such a
GDB and a matching Clang. IOW, to build GDB with:
--host=x86_64-w64-mingw32 --target=x86_64-pc-windows-msvc
To be clear, this does _not_ propose making it possible to build GDB
with --host=x86_64-pc-windows-msvc. That's a different can of worms.
This will let us use "istarget *-*-windows-msvc" in the testsuite
where we need to distinguish MinGW and MSVC environments.
The MSVC ABI is not the same as the GNU (MinGW) ABI -- they differ in
long double, in the C++ ABI, and in other details. So the series also
splits GDB's single "Windows" OS ABI into two flavors, GNU and MSVC,
picks the right default based on how GDB was configured, and fixes a
concrete ABI difference (long double) as simple example.
Another way to handle the ABI split would be to keep the single
"Windows" osabi, and add a new "set windows-abi gnu/msvc" switch,
similar to "set cp-abi", and also, arch-specific abi settings like
"set arm abi auto/APCS/AAPCS", and "set powerpc vector-abi", etc. I
didn't go for that approach because the MSVC/GNU ABI split is a lot
deeper than those other ABI switches: affects C ABI (long double),
calling conventions, headers and libraries linked with, C++ ABI,
mangling scheme, and on and on, basically almost like a separate
target. While OTOH, "set arm abi" etc. are more about multilibs for a
single target, they normally come from the same sources (I mean,
toolchain/runtime project), just compiled differently, with some
compiler option. OTOH, it is possible to mix GNU and MSVC code in the
same binary (and it happens all the time, given system DLLs are built
with MSVC), so maybe that distinction isn't that important. OTOOH,
what would this mean for the Cygwin osabi?
The first two patches (recognize *-*-windows* and treat as native) are
independent of this, and could go in even if the design of this part
changes. So I figured I'd send what I have right now for comments.
This series depends on the BFD patch:
bfd: recognize *-*-windows* Windows targets
which was sent separately to the binutils list, here:
https://inbox.sourceware.org/binutils/20260713231552.1303239-1-pedro@palves.net/T/
I have a follow-up series that starts teaching the testsuite about
windows-msvc, too. I've done just enough to be able to validate the
idea, and see a few testcases pass.
Pedro Alves (4):
gdb: recognize *-*-windows* Windows targets
gdb: treat Windows host + Windows target as native
gdb: distinguish GNU and MSVC flavors of the Windows OS ABI
gdb: MSVC "long double" is a 64-bit double
gdb/NEWS | 16 ++++++++++++++++
gdb/aarch64-windows-tdep.c | 5 ++++-
gdb/amd64-windows-tdep.c | 6 +++++-
gdb/arch-utils.c | 18 ++++++++++++++++++
gdb/configure | 19 +++++++++++++++++--
gdb/configure.ac | 19 +++++++++++++++++--
gdb/configure.tgt | 22 +++++++++++-----------
gdb/doc/gdb.texinfo | 15 +++++++++++++++
gdb/i386-windows-tdep.c | 6 +++++-
gdb/osabi.c | 32 +++++++++++++++++++++++++++-----
gdb/osabi.h | 8 ++++++++
gdb/windows-tdep.c | 9 +++++++++
gdb/windows-tdep.h | 5 +++--
gdbsupport/osabi.def | 2 ++
14 files changed, 157 insertions(+), 25 deletions(-)
base-commit: 490469846dcef89fe53668bdbba73591c64bed61
--
2.54.0
next reply other threads:[~2026-07-14 0:45 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-14 0:45 Pedro Alves [this message]
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
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=20260714004507.1323332-1-pedro@palves.net \
--to=pedro@palves.net \
--cc=gdb-patches@sourceware.org \
/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