From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 57941 invoked by alias); 24 Oct 2016 13:43:58 -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 57929 invoked by uid 89); 24 Oct 2016 13:43:58 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-3.3 required=5.0 tests=BAYES_00,RP_MATCHES_RCVD,SPF_HELO_PASS autolearn=ham version=3.3.2 spammy=H*M:6771 X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 24 Oct 2016 13:43:56 +0000 Received: from int-mx14.intmail.prod.int.phx2.redhat.com (int-mx14.intmail.prod.int.phx2.redhat.com [10.5.11.27]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id B175A96A0; Mon, 24 Oct 2016 13:43:55 +0000 (UTC) Received: from [127.0.0.1] (ovpn01.gateway.prod.ext.ams2.redhat.com [10.39.146.11]) by int-mx14.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u9ODhsIA028005; Mon, 24 Oct 2016 09:43:54 -0400 Subject: Re: CYGWIN file input redirection To: Eli Zaretskii References: <83twcxn3ne.fsf@gnu.org> <8360ot3kzq.fsf@gnu.org> <83zim523ch.fsf@gnu.org> <83eg38rarq.fsf@gnu.org> <83oa29518t.fsf@gnu.org> Cc: gdb-patches@sourceware.org, samsurfer117@gmail.com From: Pedro Alves Message-ID: <6cfdbdfb-71b8-6771-abad-6cbb48ac3372@redhat.com> Date: Mon, 24 Oct 2016 13:43:00 -0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.2.0 MIME-Version: 1.0 In-Reply-To: <83oa29518t.fsf@gnu.org> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit X-SW-Source: 2016-10/txt/msg00666.txt.bz2 On 10/24/2016 02:24 PM, Eli Zaretskii wrote: > I'm not sure I see the problem. If you debug GDB's redirection code, > you will probably not redirect that GDB's standard streams, right? > IOW, you would > > > gdb ./gdb.exe > (top-gdb) run foo.exe > (gdb) run < bar > baz > > Right? Or did you mean something else? OK. I guess I was confused. So let's just forget my comment. > >> It'd be nice to add comments mentioning what syntax works and doesn't >> work. Is there something users should know about syntax, that >> should be added to the manual? > > The code is supposed to support everything cmd.exe supports, and > nothing else. Ah, I see I didn't implement the likes of "2>&1". Will > do. > > The only thing beyond what cmd.exe supports is that one can use > Unix-style forward slashes in redirected file names, which comes in > handy because GDB's file-name completion helps. Not sure if this > should be in the manual. WDYT? Seems fine not to mention that, since gdb supports forward slashes throughout, anyway. If it didn't support them here probably someone would call it a bug. > >> Ideally some test would "prove" this all works, which would >> also make it possible to more confidently change the implementation >> later on if we find it necessary. It's been years since I'd tried to >> run the testsuite for mingw gdb (under cygwin/msys/msys2 of course) >> and I have no idea whether people are doing that nowadays. I have >> the impression that maybe no one is.. And then, I can't seem to >> find any existing test that exercises redirection, even >> on Unix... :-/ Oh well. > > Right. I don't have a setup for running the test suite. I did, of > course, test the code manually. > >>>> + if (inferior_io_terminal >>>> + && !(inf_stdin != INVALID_HANDLE_VALUE >>>> + && inf_stdout != INVALID_HANDLE_VALUE >>>> + && inf_stderr != INVALID_HANDLE_VALUE)) >> >> I find these double-negatives hard to read. I'd suggest: >> >> if (inferior_io_terminal >> && (inf_stdin == INVALID_HANDLE_VALUE >> || inf_stdout == INVALID_HANDLE_VALUE >> || inf_stderr == INVALID_HANDLE_VALUE)) > > Interesting, I actually find the latter harder to grasp. The former > says "if not all of the handles are valid". I can add a macro > VALID_HANDLE, if that would help. Leave it be as you had it then. It was just a minor suggestion. > > Thanks for the review, I will add the missing bits and fixes and > resubmit. Thanks, Pedro Alves