From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 25613 invoked by alias); 12 Jul 2012 01:41:07 -0000 Received: (qmail 25602 invoked by uid 22791); 12 Jul 2012 01:41:06 -0000 X-SWARE-Spam-Status: No, hits=-2.4 required=5.0 tests=AWL,BAYES_00,KHOP_RCVD_UNTRUST,KHOP_THREADED,MSGID_MULTIPLE_AT,RCVD_IN_DNSWL_LOW,RCVD_IN_HOSTKARMA_NO,RCVD_IN_HOSTKARMA_YE X-Spam-Check-By: sourceware.org Received: from service87.mimecast.com (HELO service87.mimecast.com) (91.220.42.44) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Thu, 12 Jul 2012 01:40:53 +0000 Received: from cam-owa1.Emea.Arm.com (fw-tnat.cambridge.arm.com [217.140.96.21]) by service87.mimecast.com; Thu, 12 Jul 2012 02:40:48 +0100 Received: from shawin053 ([10.164.2.89]) by cam-owa1.Emea.Arm.com with Microsoft SMTPSVC(6.0.3790.0); Thu, 12 Jul 2012 02:41:53 +0100 From: "Terry Guo" To: "Eli Zaretskii" Cc: References: <000001cd5338$ded61b20$9c825160$%guo@arm.com> <83hatw8zn1.fsf@gnu.org> <000301cd59bd$ce1c8900$6a559b00$%guo@arm.com> <000101cd5f22$2371cdc0$6a556940$%guo@arm.com> <83k3yab0x6.fsf@gnu.org> In-Reply-To: <83k3yab0x6.fsf@gnu.org> Subject: RE: [PATCH]Fix that GDB will get hang on Windows when using pipe to get stdout and stderr from stub Date: Thu, 12 Jul 2012 01:41:00 -0000 Message-ID: <000301cd5fcf$838d31b0$8aa79510$@guo@arm.com> MIME-Version: 1.0 X-MC-Unique: 112071202404800201 Content-Type: text/plain; charset=WINDOWS-1252 Content-Transfer-Encoding: quoted-printable X-IsSubscribed: yes Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2012-07/txt/msg00150.txt.bz2 > -----Original Message----- > From: Eli Zaretskii [mailto:eliz@gnu.org] > Sent: Thursday, July 12, 2012 2:36 AM > To: Terry Guo > Cc: gdb-patches@sourceware.org; Joey Ye > Subject: Re: [PATCH]Fix that GDB will get hang on Windows when using > pipe to get stdout and stderr from stub >=20 > > From: "Terry Guo" > > Cc: , > > "Joey Ye" > > Date: Wed, 11 Jul 2012 13:00:46 +0800 > > > > Hi Eli, > > > > Could you please help to review this updated patch when you have time? > > Thanks. >=20 > What exactly changed since the previous version? Changes are about code secure and readability. No functionality change. 1). Previously I have code: char buf[81]; int to_read =3D 80; Now I change it to: #define GDB_MI_MSG_WIDTH 80 char buf[GDB_MI_MSG_WIDTH + 1]; int to_read =3D GDB_MI_MSG_WIDTH; 2). Another change is to add string length check. It is: s =3D read (scb->error_fd, &buf, to_read); if ((s =3D=3D -1) || (s =3D=3D 0 && !close_fd)) break if (s =3D=3D 0 && close_fd) { .... } =09 /* Current patch add this new line to check length */ gdb_assert (s > 0 && s <=3D GDB_MI_MSG_WIDTH); buf[s] =3D '\0'; The original patch is at=20 http://sourceware.org/ml/gdb-patches/2012-06/msg00790.html The updated patch is at http://sourceware.org/ml/gdb-patches/2012-07/msg00053.html BR, Terry