public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
* No I/O redirection under GDB
@ 2014-04-05  2:29 Duncan Roe
  2014-04-05  2:51 ` Eliot Moss
  0 siblings, 1 reply; 5+ messages in thread
From: Duncan Roe @ 2014-04-05  2:29 UTC (permalink / raw)
  To: cygwin

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,

Cheers ... Duncan.

--
 Please avoid sending me Word or PowerPoint attachments.
 See http://www.gnu.org/philosophy/no-word-attachments.html

--
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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: No I/O redirection under GDB
  2014-04-05  2:29 No I/O redirection under GDB Duncan Roe
@ 2014-04-05  2:51 ` Eliot Moss
  2014-04-05  4:16   ` WORKED AROUND " Duncan Roe
  0 siblings, 1 reply; 5+ messages in thread
From: Eliot Moss @ 2014-04-05  2:51 UTC (permalink / raw)
  To: cygwin

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

--
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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* WORKED AROUND Re: No I/O redirection under GDB
  2014-04-05  2:51 ` Eliot Moss
@ 2014-04-05  4:16   ` Duncan Roe
  2014-04-05  9:23     ` NOT " Duncan Roe
  0 siblings, 1 reply; 5+ messages in thread
From: Duncan Roe @ 2014-04-05  4:16 UTC (permalink / raw)
  To: cygwin

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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* NOT WORKED AROUND Re: No I/O redirection under GDB
  2014-04-05  4:16   ` WORKED AROUND " Duncan Roe
@ 2014-04-05  9:23     ` Duncan Roe
  2014-04-07  0:51       ` Christopher Faylor
  0 siblings, 1 reply; 5+ messages in thread
From: Duncan Roe @ 2014-04-05  9:23 UTC (permalink / raw)
  To: cygwin

Sorry for the noise everyone.

I started to compose the last mail thinking "set inferior-tty" would solve my
problem. Then on further testing, I found it didn't.

I'm still up for fixing gdb to do the job properly - or can someone on this list
tell me why I'd be wasting my time?

Cheers ... Duncan.

On Sat, Apr 05, 2014 at 03:15:14PM +1100, Duncan Roe wrote:
> 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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: NOT WORKED AROUND Re: No I/O redirection under GDB
  2014-04-05  9:23     ` NOT " Duncan Roe
@ 2014-04-07  0:51       ` Christopher Faylor
  0 siblings, 0 replies; 5+ messages in thread
From: Christopher Faylor @ 2014-04-07  0:51 UTC (permalink / raw)
  To: cygwin

On Sat, Apr 05, 2014 at 08:23:37PM +1100, Duncan Roe wrote:
>Sorry for the noise everyone.
>
>I started to compose the last mail thinking "set inferior-tty" would solve my
>problem. Then on further testing, I found it didn't.
>
>I'm still up for fixing gdb to do the job properly - or can someone on this list
>tell me why I'd be wasting my time?

The situation hasn't changed.  gdb doesn't currently deal with
redirection.  It's not impossible to do but I doubt it's in anyone's
plans.

cgf

--
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

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2014-04-07  0:51 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-04-05  2:29 No I/O redirection under GDB Duncan Roe
2014-04-05  2:51 ` Eliot Moss
2014-04-05  4:16   ` WORKED AROUND " Duncan Roe
2014-04-05  9:23     ` NOT " Duncan Roe
2014-04-07  0:51       ` Christopher Faylor

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).