This is the mail archive of the
cygwin
mailing list for the Cygwin project.
WORKED AROUND Re: No I/O redirection under GDB
- From: Duncan Roe <duncan_roe at acslink dot net dot au>
- To: cygwin at cygwin dot com
- Date: Sat, 5 Apr 2014 15:15:14 +1100
- Subject: WORKED AROUND Re: No I/O redirection under GDB
- Authentication-results: sourceware.org; auth=none
- References: <20140405022905 dot GA8268 at dimstar dot local dot net> <533F6FAC dot 5060200 at cs dot umass dot edu>
On Fri, Apr 04, 2014 at 10:51:24PM -0400, Eliot Moss wrote:
> On 4/4/2014 10:29 PM, Duncan Roe wrote:
> >I just found that gdb's "run" command doesn't action redirection (e.g. run
> ></dev/pty2 >/dev/pty2 2>&1, where the shell on /dev/pty2 is doing a long sleep).
> >Instead, the invoked program gets the redirections as command line arguments.
> >
> >Looking through the archives, I found
> >https://sourceware.org/ml/cygwin/1999-04/msg00355.html documenting this
> >behaviour. Chris Faylor commented at the time that fixing it was more trouble
> >than it appeared.
> >
> >That was 15 years ago - has anything changed since? Anyone up for this or should
> >I have a go? I *could* simply make my target do the redirection itself, but that
> >doesn't help anyone else. OTOH if changing gdb really *is* that hard, maybe I
> >should just change my program anyway.
> >
> >Any advice welcomed,
>
> I think this is the intended design (see:
> https://sourceware.org/gdb/current/onlinedocs/gdb/Input_002fOutput.html#Input_002fOutput
> ). If you want *gdb's* input and output redirected, I would think you want to invoke
> gdb with I/O redirection on the command line, as in:
>
> gdb foo < infile > outfile
>
> Regards -- Eliot Moss
>
Thanks for replying.
Sorry but your suggested command line doesn't help: I need gdb command i/o in
one screen and program i/o in another.
The set inferior-tty command documented in the link you posted *very nearly*
gave me what I was after. Having updated my startup script to use it, I now find
that I can't use Control-C to interrupt the session: it's ignored in the gdb
window and causes catastrophic gdb failure in the application window (as well as
waking the shell from sleep). It's better than nothing I guess.
So, I'm back to needing i/o redirection in the run command (as also documented
in your link). It works in Linux.
Cheers ... Duncan.
--
Problem reports: http://cygwin.com/problems.html
FAQ: http://cygwin.com/faq/
Documentation: http://cygwin.com/docs.html
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple