public inbox for gdb@sourceware.org
 help / color / mirror / Atom feed
* strange behaviour -- gdbtk & stdin on winxp
@ 2005-04-15 20:36 James Lemke
  2005-04-15 20:50 ` Keith Seitz
  0 siblings, 1 reply; 6+ messages in thread
From: James Lemke @ 2005-04-15 20:36 UTC (permalink / raw)
  To: gdb

I did some searching on the archives but didn't find anything similar.
I'm using xscale-elf-insight.exe built from 6.1 sources, serially
connected to an xscale board.  I'm debugging a simple program that reads
a string via fgets((char *)input_char, MAX_INPUT_LINE, stdin).

All works as expected with xscale-elf-gdb or xscale-elf-insight -nw. 
But with the GUI, fgets() returns immediately with NULL, and errno set
to 9 (EBADF).

When built for a Linux host, xscale-elf-insight with and without -nw
work fine.

Does this problem sound familiar to anyone?
Jim.

-- 
James Lemke   jim@TheLemkes.ca   Orillia, Ontario
1992 ST1100, STOC #3750;   FWD# M:245401 H:246889
Life is what happens while you're busy making other plans. --John Lennon

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

* Re: strange behaviour -- gdbtk & stdin on winxp
  2005-04-15 20:36 strange behaviour -- gdbtk & stdin on winxp James Lemke
@ 2005-04-15 20:50 ` Keith Seitz
  2005-04-15 21:13   ` James Lemke
  2005-04-18 14:55   ` James Lemke
  0 siblings, 2 replies; 6+ messages in thread
From: Keith Seitz @ 2005-04-15 20:50 UTC (permalink / raw)
  To: James Lemke; +Cc: gdb

On Fri, 2005-04-15 at 16:36 -0400, James Lemke wrote:
> All works as expected with xscale-elf-gdb or xscale-elf-insight -nw. 
> But with the GUI, fgets() returns immediately with NULL, and errno set
> to 9 (EBADF).
> 
> When built for a Linux host, xscale-elf-insight with and without -nw
> work fine.

I am assuming that you're trying to run on windows, and your problem
doesn't surprise me in the least. Quite frankly, I don't think we ever
got windows working as well as unix hosts.

While I would guess this works for native cygwin apps, I'll bet insight
never gets stdin reopened for some "terminal", and I don't believe that
there is any special magic in gdb/insight to re-route stdin calls to the
console window (although on a remote that shouldn't be too hard). 

I suspect some hacking is in your future...

Keith

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

* Re: strange behaviour -- gdbtk & stdin on winxp
  2005-04-15 20:50 ` Keith Seitz
@ 2005-04-15 21:13   ` James Lemke
  2005-04-18 14:55   ` James Lemke
  1 sibling, 0 replies; 6+ messages in thread
From: James Lemke @ 2005-04-15 21:13 UTC (permalink / raw)
  To: Keith Seitz; +Cc: gdb

On Fri, 2005-04-15 at 16:50, Keith Seitz wrote:
> On Fri, 2005-04-15 at 16:36 -0400, James Lemke wrote:
> > All works as expected with xscale-elf-gdb or xscale-elf-insight -nw. 
> > But with the GUI, fgets() returns immediately with NULL, and errno set
> > to 9 (EBADF).
> > 
> > When built for a Linux host, xscale-elf-insight with and without -nw
> > work fine.
> 
> I am assuming that you're trying to run on windows, and your problem
> doesn't surprise me in the least. Quite frankly, I don't think we ever
> got windows working as well as unix hosts.
> 
> While I would guess this works for native cygwin apps, I'll bet insight
> never gets stdin reopened for some "terminal", and I don't believe that
> there is any special magic in gdb/insight to re-route stdin calls to the
> console window (although on a remote that shouldn't be too hard). 
> 
> I suspect some hacking is in your future...

Yup, sounds like it.  Thanks for the thoughts.
Jim.

-- 
James Lemke   jim@TheLemkes.ca   Orillia, Ontario
1992 ST1100, STOC #3750;   FWD# M:245401 H:246889
Life is what happens while you're busy making other plans. --John Lennon

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

* Re: strange behaviour -- gdbtk & stdin on winxp
  2005-04-15 20:50 ` Keith Seitz
  2005-04-15 21:13   ` James Lemke
@ 2005-04-18 14:55   ` James Lemke
  2005-04-18 16:17     ` Dave Korn
  1 sibling, 1 reply; 6+ messages in thread
From: James Lemke @ 2005-04-18 14:55 UTC (permalink / raw)
  To: Keith Seitz; +Cc: gdb

On Fri, 2005-04-15 at 16:50, Keith Seitz wrote:
> On Fri, 2005-04-15 at 16:36 -0400, James Lemke wrote:
> > All works as expected with xscale-elf-gdb or xscale-elf-insight -nw. 
> > But with the GUI, fgets() returns immediately with NULL, and errno set
> > to 9 (EBADF).
> > 
> > When built for a Linux host, xscale-elf-insight with and without -nw
> > work fine.
> 
> I am assuming that you're trying to run on windows, and your problem
> doesn't surprise me in the least. Quite frankly, I don't think we ever
> got windows working as well as unix hosts.
> 
> While I would guess this works for native cygwin apps, I'll bet insight
> never gets stdin reopened for some "terminal", and I don't believe that
> there is any special magic in gdb/insight to re-route stdin calls to the
> console window (although on a remote that shouldn't be too hard). 
> 
> I suspect some hacking is in your future...

FYI and to archive for future searchers...

If I use an rxvt window (rxvt -e /bin/bash) vs the default Cygwin
window, insight reads from stdin fine just as it does on Linux.

Cheers,
Jim.

-- 
James Lemke   jim@TheLemkes.ca   Orillia, Ontario
1992 ST1100, STOC #3750;   FWD# M:245401 H:246889
Life is what happens while you're busy making other plans. --John Lennon

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

* RE: strange behaviour -- gdbtk & stdin on winxp
  2005-04-18 14:55   ` James Lemke
@ 2005-04-18 16:17     ` Dave Korn
  2005-04-18 17:47       ` James Lemke
  0 siblings, 1 reply; 6+ messages in thread
From: Dave Korn @ 2005-04-18 16:17 UTC (permalink / raw)
  To: 'James Lemke', 'Keith Seitz'; +Cc: gdb

----Original Message----
>From: James Lemke
>Sent: 18 April 2005 15:55

> On Fri, 2005-04-15 at 16:50, Keith Seitz wrote:
>> On Fri, 2005-04-15 at 16:36 -0400, James Lemke wrote:
>>> All works as expected with xscale-elf-gdb or xscale-elf-insight -nw.
>>> But with the GUI, fgets() returns immediately with NULL, and errno set
>>> to 9 (EBADF). 
>>> 
>>> When built for a Linux host, xscale-elf-insight with and without -nw
>>> work fine.
>> 
>> I am assuming that you're trying to run on windows, and your problem
>> doesn't surprise me in the least. Quite frankly, I don't think we ever
>> got windows working as well as unix hosts.
>> 
>> While I would guess this works for native cygwin apps, I'll bet insight
>> never gets stdin reopened for some "terminal", and I don't believe that
>> there is any special magic in gdb/insight to re-route stdin calls to the
>> console window (although on a remote that shouldn't be too hard).
>> 
>> I suspect some hacking is in your future...
> 
> FYI and to archive for future searchers...
> 
> If I use an rxvt window (rxvt -e /bin/bash) vs the default Cygwin
> window, insight reads from stdin fine just as it does on Linux.
> 
> Cheers,
> Jim.


  Jim, do you have 'tty' set in your $CYGWIN environment variable?  I don't
know if it'll help or not, but it affects tty-handling in the cygwin lib:

http://cygwin.com/cygwin-ug-net/using-cygwinenv.html

"(no)tty - if set, Cygwin enables extra support (i.e., termios) for
UNIX-like ttys. It is not compatible with some Windows programs. Defaults to
not set, in which case the tty is opened in text mode. Note that this has
been changed such that ^D works as expected instead of ^Z, and is settable
via stty. This option must be specified before starting a Cygwin shell and
it cannot be changed in the shell."

  It might or might not help to experiment with it.

    cheers,
      DaveK
-- 
Can't think of a witty .sigline today....

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

* RE: strange behaviour -- gdbtk & stdin on winxp
  2005-04-18 16:17     ` Dave Korn
@ 2005-04-18 17:47       ` James Lemke
  0 siblings, 0 replies; 6+ messages in thread
From: James Lemke @ 2005-04-18 17:47 UTC (permalink / raw)
  To: Dave Korn; +Cc: gdb

>   Jim, do you have 'tty' set in your $CYGWIN environment variable?  I don't
> know if it'll help or not, but it affects tty-handling in the cygwin lib:
> 
> http://cygwin.com/cygwin-ug-net/using-cygwinenv.html
> 
> "(no)tty - if set, Cygwin enables extra support (i.e., termios) for
> UNIX-like ttys. It is not compatible with some Windows programs. Defaults to
> not set, in which case the tty is opened in text mode. Note that this has
> been changed such that ^D works as expected instead of ^Z, and is settable
> via stty. This option must be specified before starting a Cygwin shell and
> it cannot be changed in the shell."
> 
>   It might or might not help to experiment with it.

Thanks for the idea Dave.  Unfortunately it didn't help.
I tried adding the following to c:\autoexec.bat:
set CYGWIN=tty

and the following to ~/.bash_profile:
export CYGWIN=tty

-- 
James Lemke   jim@TheLemkes.ca   Orillia, Ontario
1992 ST1100, STOC #3750;   FWD# M:245401 H:246889
Life is what happens while you're busy making other plans. --John Lennon

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

end of thread, other threads:[~2005-04-18 17:47 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-04-15 20:36 strange behaviour -- gdbtk & stdin on winxp James Lemke
2005-04-15 20:50 ` Keith Seitz
2005-04-15 21:13   ` James Lemke
2005-04-18 14:55   ` James Lemke
2005-04-18 16:17     ` Dave Korn
2005-04-18 17:47       ` James Lemke

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