This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: Windows semihosting (remote-fileio) fix for console reads
> Date: Sat, 10 Jun 2006 19:43:57 -0400
> From: Daniel Jacobowitz <drow@false.org>
>
> #include <unistd.h>
> #include <stdio.h>
> #include <errno.h>
> #include <string.h>
>
> static char buf[32768];
>
> int
> main (int argc, char **argv)
> {
> int ret, err;
>
> sprintf (buf, "Type something:\n");
> write (1, buf, strlen (buf));
> errno = 0;
> ret = read (0, buf, 26609);
> err = errno;
>
> sprintf (buf, "read returned %d, errno %d\n", ret, err);
> write (1, buf, strlen (buf));
> return 0;
> }
I tried this on two XP boxes: on one, 26609 was the smallest value
that failed, on the other it started to fail with 31005. Go figure.
Anyway, I suggest to go for 16K; 8K sounds too conservative.