From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 2221 invoked by alias); 25 Jul 2013 09:05:16 -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 2193 invoked by uid 89); 25 Jul 2013 09:05:14 -0000 X-Spam-SWARE-Status: No, score=-2.8 required=5.0 tests=AWL,BAYES_50,KHOP_RCVD_UNTRUST,KHOP_THREADED,RCVD_IN_HOSTKARMA_W,RCVD_IN_HOSTKARMA_WL,RDNS_NONE,TW_TV,TW_VB 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; Thu, 25 Jul 2013 09:05:12 +0000 Received: from svr-orw-fem-01.mgc.mentorg.com ([147.34.98.93]) by relay1.mentorg.com with esmtp id 1V2HTt-0004Y3-0w from Yao_Qi@mentor.com for gdb-patches@sourceware.org; Thu, 25 Jul 2013 02:05:05 -0700 Received: from SVR-ORW-FEM-05.mgc.mentorg.com ([147.34.97.43]) by svr-orw-fem-01.mgc.mentorg.com over TLS secured channel with Microsoft SMTPSVC(6.0.3790.4675); Thu, 25 Jul 2013 02:05:04 -0700 Received: from qiyao.dyndns.org (147.34.91.1) by svr-orw-fem-05.mgc.mentorg.com (147.34.97.43) with Microsoft SMTP Server id 14.2.247.3; Thu, 25 Jul 2013 02:05:04 -0700 Message-ID: <51F0EA14.1070900@codesourcery.com> Date: Thu, 25 Jul 2013 09: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] New option --cygwin-tty. References: <1374728963-25187-1-git-send-email-yao@codesourcery.com> <1374728963-25187-2-git-send-email-yao@codesourcery.com> <000901ce8909$dd069470$9713bd50$@muller@ics-cnrs.unistra.fr> <51F0D9D2.1090804@codesourcery.com> <20130725081820.GA11021@calimero.vinschen.de> In-Reply-To: <20130725081820.GA11021@calimero.vinschen.de> Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 8bit X-SW-Source: 2013-07/txt/msg00604.txt.bz2 On 07/25/2013 04:18 PM, Corinna Vinschen wrote: >> Yeah, I agree, but I am worried that stdio handlers (such as stdout) >> >should be set before any writes to them, so we should set the flag >> >(cygwin_tty) at the early stage of GDB start up (before command 'set >> >windows-os-tty on' is processed). If it is not a problem, I am >> >fine. > You can use the _setmode() call at any time to switch text/binary mode > on the descriptors. > The doc on _setmode on MSDN says _setmode () should be called before any input or output operations. http://msdn.microsoft.com/en-us/library/tw4k6df8.aspx "_setmode is typically used to modify the default translation mode of stdin and stdout, but you can use it on any file. If you apply _setmode to the file descriptor for a stream, call _setmode before you perform any input or output operations on the stream." Beside setmode, we also need setvbuf to disable buffering. It should be called before any input or output on the stream. >> >I am looking at Corinna's example to see how to detect GDB is >> >running in Cygwin's TTY. If it works, probably we can get rid of >> >this new GDB option completely. > It has been tested under Mingw-w64 and VC++. If you're using Mingw.Org, > it probably needs some tweaking. Right, it needs some tweaks on headers files for Mingw.Org. What is the minimum version of cygwin required for this example? In cygwin 1.7.20, the file name is "\cygwin-8c26184c318518a4-pty0-from-master", while in 1.7.9, it is "\cygwin-c5e39b7a9d22bafb-tty0-from-master". -- Yao (齐尧)