[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug in hsys.c?
From: |
Juro Bystricky |
Subject: |
bug in hsys.c? |
Date: |
Tue, 2 Jan 2001 13:02:34 -0800 |
I'm porting gdb 5.0 to Windows platform. There seems to be a subtle bug in
the file /gdb/rdi-share/hsys.c. It took me
a fairly long time to discover it, so I would like to report it.
The file ../gdb/rdi-share/hsys.c contains the following:
/* taken straight from armulator source */
#ifdef __riscos
extern int _fisatty(FILE *);
# define isatty_(f) _fisatty(f)
# define EMFILE -1
# define EBADF -1
int _kernel_escape_seen(void) { return 0 ;}
#else
# if defined(_WINDOWS) || defined(_CONSOLE)
# define isatty_(f) (f == stdin || f == stdout)
# else
# ifdef __ZTC__
# include <io.h>
# define isatty_(f) isatty((f)->_file)
# else
# ifdef macintosh
# include <ioctl.h>
# define isatty_(f) (~ioctl((f)->_file,FIOINTERACTIVE,NULL))
# else
# define isatty_(f) isatty(fileno(f))
# endif
# endif
# endif
#endif
The problem is, the hash define "_WINDOWS" is not being defined by anyone
(should be done by config?).
I grepped the whole works, and "_WINDOWS" is never defined. Seems to be a
private definition used by ARM development tools
used in ARM environment. So the above compiles for Windows platforms as
#define isatty_(f) isatty(fileno(f))
This works fine, if we run GDB from the command line. However, if we spawn
GDB from another process, by
Win32 API CreateProcess() , with redirected stdin,stdout handles we run
into problems with redirection.
The problems are solved (mostly) by compiling the above macro as
#define isatty_(f) (f == stdin || f == stdout)
which was apparently meant to happen to begin with on a Windows platform. So
the remedy would be either
somewhere define _WINDOWS, or use _WIN32 instead.
thanks
Juro Bystricky
System-on-Chip Software Development
Vancouver Design Center
Suite #320 - 11120 Horseshoe Way
Richmond, B.C.
Canada V7A 5H7
Tel: (604) 275-5151 ext 106
Fax: (604) 276-2167
E-mail: address@hidden
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- bug in hsys.c?,
Juro Bystricky <=