public inbox for cygwin-cvs@sourceware.org
help / color / mirror / Atom feed
* [newlib-cygwin] Cygwin: pty: Make GDB work again on pty.
@ 2019-09-20 21:59 Ken Brown
0 siblings, 0 replies; only message in thread
From: Ken Brown @ 2019-09-20 21:59 UTC (permalink / raw)
To: cygwin-cvs
https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=ac5357b9fe3486b909076ec706de64e91ba8ad81
commit ac5357b9fe3486b909076ec706de64e91ba8ad81
Author: Takashi Yano <takashi.yano@nifty.ne.jp>
Date: Wed Sep 18 23:29:18 2019 +0900
Cygwin: pty: Make GDB work again on pty.
Diff:
---
winsup/cygwin/fhandler_tty.cc | 35 +++++++++++++++++++++++++++++++++++
1 file changed, 35 insertions(+)
diff --git a/winsup/cygwin/fhandler_tty.cc b/winsup/cygwin/fhandler_tty.cc
index 2a1c34f..843807a 100644
--- a/winsup/cygwin/fhandler_tty.cc
+++ b/winsup/cygwin/fhandler_tty.cc
@@ -197,6 +197,9 @@ DEF_HOOK (ReadConsoleInputA);
DEF_HOOK (ReadConsoleInputW);
DEF_HOOK (PeekConsoleInputA);
DEF_HOOK (PeekConsoleInputW);
+/* CreateProcess() is hooked for GDB etc. */
+DEF_HOOK (CreateProcessA);
+DEF_HOOK (CreateProcessW);
static BOOL WINAPI
WriteFile_Hooked
@@ -331,6 +334,35 @@ PeekConsoleInputW_Hooked
set_ishybrid_and_switch_to_pcon (h);
return PeekConsoleInputW_Orig (h, r, l, n);
}
+/* CreateProcess() is hooked for GDB etc. */
+static BOOL WINAPI
+CreateProcessA_Hooked
+ (LPCSTR n, LPSTR c, LPSECURITY_ATTRIBUTES pa, LPSECURITY_ATTRIBUTES ta,
+ BOOL inh, DWORD f, LPVOID e, LPCSTR d,
+ LPSTARTUPINFOA si, LPPROCESS_INFORMATION pi)
+{
+ HANDLE h;
+ if (si->dwFlags & STARTF_USESTDHANDLES)
+ h = si->hStdOutput;
+ else
+ h = GetStdHandle (STD_OUTPUT_HANDLE);
+ set_ishybrid_and_switch_to_pcon (h);
+ return CreateProcessA_Orig (n, c, pa, ta, inh, f, e, d, si, pi);
+}
+static BOOL WINAPI
+CreateProcessW_Hooked
+ (LPCWSTR n, LPWSTR c, LPSECURITY_ATTRIBUTES pa, LPSECURITY_ATTRIBUTES ta,
+ BOOL inh, DWORD f, LPVOID e, LPCWSTR d,
+ LPSTARTUPINFOW si, LPPROCESS_INFORMATION pi)
+{
+ HANDLE h;
+ if (si->dwFlags & STARTF_USESTDHANDLES)
+ h = si->hStdOutput;
+ else
+ h = GetStdHandle (STD_OUTPUT_HANDLE);
+ set_ishybrid_and_switch_to_pcon (h);
+ return CreateProcessW_Orig (n, c, pa, ta, inh, f, e, d, si, pi);
+}
#else /* USE_API_HOOK */
#define WriteFile_Orig 0
#define ReadFile_Orig 0
@@ -2778,6 +2810,9 @@ fhandler_pty_slave::fixup_after_exec ()
DO_HOOK (NULL, ReadConsoleInputW);
DO_HOOK (NULL, PeekConsoleInputA);
DO_HOOK (NULL, PeekConsoleInputW);
+ /* CreateProcess() is hooked for GDB etc. */
+ DO_HOOK (NULL, CreateProcessA);
+ DO_HOOK (NULL, CreateProcessW);
}
#endif /* USE_API_HOOK */
}
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2019-09-20 21:59 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-09-20 21:59 [newlib-cygwin] Cygwin: pty: Make GDB work again on pty Ken Brown
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).