From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 16152 invoked by alias); 6 Aug 2013 03:05:50 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 16143 invoked by uid 89); 6 Aug 2013 03:05:49 -0000 X-Spam-SWARE-Status: No, score=-4.2 required=5.0 tests=AWL,BAYES_00,KHOP_RCVD_UNTRUST,KHOP_THREADED,RCVD_IN_HOSTKARMA_W,RCVD_IN_HOSTKARMA_WL,RDNS_NONE autolearn=no version=3.3.1 Received: from Unknown (HELO relay1.mentorg.com) (192.94.38.131) by sourceware.org (qpsmtpd/0.84/v0.84-167-ge50287c) with ESMTP; Tue, 06 Aug 2013 03:05:47 +0000 Received: from svr-orw-fem-01.mgc.mentorg.com ([147.34.98.93]) by relay1.mentorg.com with esmtp id 1V6Xae-0004M0-1m from Yao_Qi@mentor.com for gdb-patches@sourceware.org; Mon, 05 Aug 2013 20:05:40 -0700 Received: from SVR-ORW-FEM-03.mgc.mentorg.com ([147.34.97.39]) by svr-orw-fem-01.mgc.mentorg.com over TLS secured channel with Microsoft SMTPSVC(6.0.3790.4675); Mon, 5 Aug 2013 20:05:39 -0700 Received: from qiyao.dyndns.org (147.34.91.1) by svr-orw-fem-03.mgc.mentorg.com (147.34.97.39) with Microsoft SMTP Server id 14.2.247.3; Mon, 5 Aug 2013 20:05:39 -0700 Message-ID: <520067CB.4000300@codesourcery.com> Date: Tue, 06 Aug 2013 03:05:00 -0000 From: Yao Qi User-Agent: Mozilla/5.0 (X11; Linux i686; rv:17.0) Gecko/20130110 Thunderbird/17.0.2 MIME-Version: 1.0 To: Subject: Re: [PATCH 1/3] Detect GDB is in cygwin References: <1375087546-22591-1-git-send-email-yao@codesourcery.com> <1375087546-22591-2-git-send-email-yao@codesourcery.com> <83txjdxtpd.fsf@gnu.org> <51F786CB.3020700@codesourcery.com> <83a9l4xdst.fsf@gnu.org> <51FA137B.6070207@codesourcery.com> <20130803045452.GA997@ednor.casa.cgf.cx> <51FE1493.9070707@codesourcery.com> <20130805044122.GA1825@ednor.casa.cgf.cx> <51FF4483.5000102@codesourcery.com> <20130806020839.GA3362@ednor.casa.cgf.cx> In-Reply-To: <20130806020839.GA3362@ednor.casa.cgf.cx> Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 8bit X-SW-Source: 2013-08/txt/msg00164.txt.bz2 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 (齐尧)