From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 24831 invoked by alias); 10 Jun 2006 23:44:01 -0000 Received: (qmail 24820 invoked by uid 22791); 10 Jun 2006 23:44:01 -0000 X-Spam-Check-By: sourceware.org Received: from nevyn.them.org (HELO nevyn.them.org) (66.93.172.17) by sourceware.org (qpsmtpd/0.31.1) with ESMTP; Sat, 10 Jun 2006 23:43:59 +0000 Received: from drow by nevyn.them.org with local (Exim 4.54) id 1FpD7V-0002la-In for gdb-patches@sourceware.org; Sat, 10 Jun 2006 19:43:57 -0400 Date: Sat, 10 Jun 2006 23:44:00 -0000 From: Daniel Jacobowitz To: gdb-patches@sourceware.org Subject: Re: Windows semihosting (remote-fileio) fix for console reads Message-ID: <20060610234357.GB10491@nevyn.them.org> Mail-Followup-To: gdb-patches@sourceware.org References: <20060610182130.GA3527@nevyn.them.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.11+cvs20060403 X-IsSubscribed: yes Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2006-06/txt/msg00134.txt.bz2 On Sun, Jun 11, 2006 at 12:28:33AM +0300, Eli Zaretskii wrote: > That rings a bell, but I'll need to dig deep into old files to find > out the details. In the meantime, could you please post a short test > program that demonstrates this failure? I'm afraid I don't have one; I tested by changing the size of the read performed by remote-fileio, which requires a remote target and stub to reproduce. It turned out to be trivial to reproduce it manually though. Here. Running this under Cygwin works (there, stdin is a pipe); this includes running it from a Cygwin bash in a command terminal. But if you Start->Run cmd.exe, and then run the test program, read will fail. [Interestingly, if I use a stack buffer and it's far too small for the read request, Cygwin returns EINVAL... nice trick.] #include #include #include #include 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; } -- Daniel Jacobowitz CodeSourcery