MSYS2-packages/gdb/0002-Only-ignore-expected-Cygwin-OutputDebugStrings.patch
Christoph Reiter 0a70e5f8f2 gdb: sync patches from cygwin
to make the next update easier

* sync all patches
* change numbering for non-cygwin patches
* remove useless diff from 1006-autoreconf.patch
2024-07-09 07:19:01 +02:00

39 lines
1.4 KiB
Diff

From ba3adfb8cd8074759432f040b5d4967963035415 Mon Sep 17 00:00:00 2001
From: Jon Turney <jon.turney@dronecode.org.uk>
Date: Mon, 14 Sep 2020 14:23:54 +0100
Subject: [PATCH 02/10] Only ignore expected Cygwin OutputDebugStrings()
Rather than ignoring all debug strings starting with 'cYg', just ignore
the expected ones:
- 'cYgSiGw00f' informs the debugger of a Cygwin signal in the debuggee
- 'cYgstd' invites the debugger to alter stdin/out/err fds in the debuggee
- 'cYgFFFFFFFFFF' invites the debugger to activate strace output from the debugee
Any other debug string starting 'cYg' is unexpected, and reported
verbatim.
---
gdb/windows-nat.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/gdb/windows-nat.c b/gdb/windows-nat.c
index f9172c3a7f8..32e97788942 100644
--- a/gdb/windows-nat.c
+++ b/gdb/windows-nat.c
@@ -997,7 +997,11 @@ windows_nat::handle_output_debug_string (struct target_waitstatus *ourstatus)
else if (!startswith (s.get (), _CYGWIN_SIGNAL_STRING))
{
#ifdef __CYGWIN__
- if (!startswith (s.get (), "cYg"))
+ /* Ignore calls to OutputDebugString() which start with 'cYg', which are
+ expected to be generated by Cygwin. Except some unclear special cases.
+ */
+ if (!startswith (s.get (), "cYg") || (strncmp (s.get () + 3, "FFFFFFFF", 8) != 0
+ && strncmp (s.get () + 3, "std", 3) != 0))
#endif
{
char *p = strchr (s.get (), '\0');
--
2.28.0