This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH 1/3] Detect GDB is in cygwin


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 (éå)


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]