[v2,00/11] Fix a few Cygwin/MinGW problems

Message ID 20260525191829.984105-1-pedro@palves.net
Headers
Series Fix a few Cygwin/MinGW problems |

Message

Pedro Alves May 25, 2026, 7:18 p.m. UTC
  Here's v2 of the series first posted as v1 at:
  https://inbox.sourceware.org/gdb-patches/20260522001626.393908-1-pedro@palves.net/T/

This started out as trying to make gdb.python/py-events.exp work on
Cygwin, which revealed a few other problems.  Some patches from v1
have been merged already, so fewer problems now.  OTOH, testing more I
saw some more problems, so...

- gdb.base/exitsignal.exp needs adjustment for MinGW as well.  A
  different adjustment, though.

- The inferior exit code / termination signal is mishandled on
  Windows.  Same problem as in v1, except the v1 solution was
  incomplete.

- gdb.python/py-events.exp needs a lot of adjustment for Cygwin and
  MinGW.

All fixed by this series.

gdb.base/exitsignal.exp and gdb.python/py-events.exp both tested on
x86_64-unknown-linux-gnu and on Cygwin.
gdb.base/exitsignal.exp also tested on x86_64-w64-mingw32.

New in v2:

 - Patches 1 through 3 in v1 merged and thus dropped from v2.
 - Now with gdb.base/exitsignal.exp fixes for MinGW.  Now passes
   cleanly there too.
 - Exit code patch more complete -- now handles attach case and
   non-cygwin inferior cases.  gdb.base/exitsignal.exp now covers
   those scenarios too.
 - Exit status logic refactor moved to its own patch.
 - gdb.python/py-events.exp adjustments split into three separate
   patches.

Pedro Alves (11):
  Adjust gdb.base/exitsignal.exp for MinGW, trigger fault
  Adjust gdb.base/exitsignal.exp for MinGW, second-chance SIGSEGV
  Adjust gdb.base/exitsignal.exp for MinGW, separate program names
  gdb.base/exitsignal.exp: Exit with non-zero
  gdb.base/exitsignal.exp: Test attaching too
  gdb/testsuite: Add mechanism to compile Windows native programs on
    Cygwin
  Windows gdb+gdbserver: Share exit status logic
  Windows gdb+gdbserver: Decode Cygwin ExitProcess codes
  Adjust gdb.python/py-events.exp for Cygwin/MinGW, thread IDs
  Adjust gdb.python/py-events.exp for Cygwin/MinGW, no fork
  Adjust gdb.python/py-events.exp for Cygwin/MinGW, "info proc" =>
    "inferior"

 gdb/nat/windows-nat.c                         | 177 ++++++++++++-
 gdb/nat/windows-nat.h                         |  35 +++
 gdb/testsuite/README                          |  22 ++
 .../gdb.base/coredump-filter-build-id.c       |  22 ++
 .../gdb.base/coredump-filter-build-id.exp     |   2 +-
 gdb/testsuite/gdb.base/exitsignal.exp         | 247 ++++++++++++------
 gdb/testsuite/gdb.base/normal.c               |  14 +-
 gdb/testsuite/gdb.base/segv.c                 |   9 +-
 gdb/testsuite/gdb.python/py-events.c          |   3 -
 gdb/testsuite/gdb.python/py-events.exp        |  83 +++---
 gdb/testsuite/lib/gdb.exp                     | 104 +++++++-
 gdb/windows-nat.c                             |  20 +-
 gdbserver/win32-low.cc                        |  21 +-
 13 files changed, 605 insertions(+), 154 deletions(-)
 create mode 100644 gdb/testsuite/gdb.base/coredump-filter-build-id.c


base-commit: 13f28e68cc751e4aac96f0ae700d7a708791006c