gdb problem

RS rs@atp.tuwien.ac.at
Mon Jan 26 20:04:00 GMT 2004


Using gdb under cygwin I had a problem that can be demonstrated with
following
little program:

==================================
#include <stdio.h>

int main()
{
  char str[100];
  printf("Hello !\n");
  scanf("%s", str);
  printf("str: %s\n", str);
  scanf("%s", str);
  printf("str: %s\n", str);
  return -1;
}
==================================

With Linux (Debian Woody) gdb works fine:
==================================
$ gdb hello
GNU gdb 2002-04-01-cvs
Copyright 2002 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you
are
welcome to change it and/or distribute copies of it under certain
conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for
details.
This GDB was configured as "i386-linux"...
(gdb) r
Starting program: /home/rs/t/hello
Hello !
ttt
str: ttt
sss
str: sss

Program exited with code 0377.
==================================

Under Cygwin (Win98 and Win2k) text written to stdout is printed only
after finishing the
last input to stdin:
==================================
bash-2.05b$ gdb hello
GNU gdb 2003-09-20-cvs (cygwin-special)
Copyright 2003 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you
are
welcome to change it and/or distribute copies of it under certain
conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for
details.
This GDB was configured as "i686-pc-cygwin"...
(gdb) r
Starting program: /home/rs/t/hello.exe
ttt
sss
Hello !
str: ttt
str: sss

Program exited with code 0177777.
==================================

Thank you for any hint,
Robert




--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/



More information about the Cygwin mailing list