From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 26252 invoked by alias); 25 Jul 2013 10:20:01 -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 26236 invoked by uid 89); 25 Jul 2013 10:20:00 -0000 X-Spam-SWARE-Status: No, score=0.1 required=5.0 tests=AWL,BAYES_50,RDNS_NONE,TW_TV,TW_VB autolearn=no version=3.3.1 Received: from Unknown (HELO calimero.vinschen.de) (217.91.18.234) by sourceware.org (qpsmtpd/0.84/v0.84-167-ge50287c) with ESMTP; Thu, 25 Jul 2013 10:19:56 +0000 Received: by calimero.vinschen.de (Postfix, from userid 500) id 43E875200A1; Thu, 25 Jul 2013 12:19:48 +0200 (CEST) Date: Thu, 25 Jul 2013 10:20:00 -0000 From: Corinna Vinschen To: gdb-patches@sourceware.org Subject: Re: [PATCH 1/3] New option --cygwin-tty. Message-ID: <20130725101948.GA30499@calimero.vinschen.de> Reply-To: gdb-patches@sourceware.org Mail-Followup-To: gdb-patches@sourceware.org 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> <51F0EA14.1070900@codesourcery.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <51F0EA14.1070900@codesourcery.com> User-Agent: Mutt/1.5.21 (2010-09-15) X-SW-Source: 2013-07/txt/msg00606.txt.bz2 On Jul 25 17:04, Yao Qi wrote: > 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". Read the source code comments. The hex number is a per-installation hash value which does not tell anything about the Cygwin version. The earliest supported Cygwin version is 1.7.0, so the answer is "all of them" for all practical purposes. Corinna -- Corinna Vinschen Cygwin Maintainer Red Hat