Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Pedro Alves <palves@redhat.com>
To: Eli Zaretskii <eliz@gnu.org>
Cc: gdb-patches@sourceware.org, samsurfer117@gmail.com
Subject: Re: CYGWIN file input redirection
Date: Mon, 24 Oct 2016 13:43:00 -0000	[thread overview]
Message-ID: <6cfdbdfb-71b8-6771-abad-6cbb48ac3372@redhat.com> (raw)
In-Reply-To: <83oa29518t.fsf@gnu.org>

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


  reply	other threads:[~2016-10-24 13:43 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-09-26 14:27 Steve Mucci
2016-09-30 14:06 ` Eli Zaretskii
2016-10-15 11:33   ` Eli Zaretskii
2016-10-15 12:40     ` Eli Zaretskii
2016-10-22  9:31       ` Eli Zaretskii
2016-10-24 12:36         ` Pedro Alves
2016-10-24 13:24           ` Eli Zaretskii
2016-10-24 13:43             ` Pedro Alves [this message]
2016-10-29  9:55               ` MS-Windows file input redirection, v2 Eli Zaretskii
2016-10-29 15:06                 ` Pedro Alves
2016-10-29 15:11                   ` Eli Zaretskii

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=6cfdbdfb-71b8-6771-abad-6cbb48ac3372@redhat.com \
    --to=palves@redhat.com \
    --cc=eliz@gnu.org \
    --cc=gdb-patches@sourceware.org \
    --cc=samsurfer117@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox