This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [PATCH 1/3] Detect GDB is in cygwin
- From: Yao Qi <yao at codesourcery dot com>
- To: <gdb-patches at sourceware dot org>
- Date: Tue, 6 Aug 2013 11:04:43 +0800
- Subject: Re: [PATCH 1/3] Detect GDB is in cygwin
- References: <1375087546-22591-1-git-send-email-yao at codesourcery dot com> <1375087546-22591-2-git-send-email-yao at codesourcery dot com> <83txjdxtpd dot fsf at gnu dot org> <51F786CB dot 3020700 at codesourcery dot com> <83a9l4xdst dot fsf at gnu dot org> <51FA137B dot 6070207 at codesourcery dot com> <20130803045452 dot GA997 at ednor dot casa dot cgf dot cx> <51FE1493 dot 9070707 at codesourcery dot com> <20130805044122 dot GA1825 at ednor dot casa dot cgf dot cx> <51FF4483 dot 5000102 at codesourcery dot com> <20130806020839 dot GA3362 at ednor dot casa dot cgf dot cx>
On 08/06/2013 10:08 AM, Christopher Faylor wrote:
I'm saying that it looks like your code will detect "echo yes | gdb"
as running on a cygwin pty.
In this case, the file name of handle looks like
"\cygwin-c5e39b7a9d22bafb-pipe-0xBC0-0x1". It is expected to return
true in this case too, that is to say, we need to set stdout/stderr
unbuffered in this case too.
In my test configuration, I use two "methods" to access remote Cygwin
respectively, one is "ssh" and the other is "ssh -t". We need these
changes on stdout/stderr for these two "methods".
See the code in my patch ...
+ /* Now check the name pattern. With pseudo-tty allocated in ssh,
+ the filename of handle of stdin looks like this:
+
+ \cygwin-c5e39b7a9d22bafb-{p,t}ty1-from-master
This is the name pattern I get if I "ssh -t" to remote Cygwin.
+
+ Without pseudo-tty allocated in ssh, the filename of handle of
+ stdin looks like this:
+
+ \cygwin-c5e39b7a9d22bafb-pipe-0x14C8-0x3
This is the name patter I get if I "ssh" to remtoe Cygwin.
+
+ If the file name is prefixed with "\cygwin-", GDB is running in
+ cygwin. */
+
+ return (cp != NULL && wcsncmp (cp, L"\\cygwin-", 8) == 0);
We really need to return true for these two cases. I find it is
confusing to say "using pty" or "not using pty" in the comments, so I
choose "with pty allocated" or "without pty allocated", which is much
clear to me.
+/* Return true if GDB is running in Cygwin pseudo-tty. */
+
+int
+using_cygwin_pty (void)
Probably you are confused by the function name and the comments. Does
it below help?
/* Return true if GDB is running in Cygwin. */
int
using_cygwin (void)
--
Yao (éå)