From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 758 invoked by alias); 4 Jul 2012 01:45:31 -0000 Received: (qmail 739 invoked by uid 22791); 4 Jul 2012 01:45:30 -0000 X-SWARE-Spam-Status: No, hits=-3.0 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00 X-Spam-Check-By: sourceware.org Received: from localhost (HELO sourceware.org) (127.0.0.1) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Wed, 04 Jul 2012 01:45:16 +0000 From: "terry.guo at arm dot com" To: gdb-prs@sourceware.org Subject: [Bug remote/14329] New: GDB will get hang on Windows when using pipe to get stdout and stderr from stub Date: Wed, 04 Jul 2012 01:45:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gdb X-Bugzilla-Component: remote X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: terry.guo at arm dot com X-Bugzilla-Status: NEW X-Bugzilla-Priority: P2 X-Bugzilla-Assigned-To: unassigned at sourceware dot org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Changed-Fields: Message-ID: X-Bugzilla-URL: http://sourceware.org/bugzilla/ Auto-Submitted: auto-generated Content-Type: text/plain; charset="UTF-8" MIME-Version: 1.0 Mailing-List: contact gdb-prs-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-prs-owner@sourceware.org X-SW-Source: 2012-q3/txt/msg00006.txt.bz2 http://sourceware.org/bugzilla/show_bug.cgi?id=14329 Bug #: 14329 Summary: GDB will get hang on Windows when using pipe to get stdout and stderr from stub Product: gdb Version: 7.4 Status: NEW Severity: normal Priority: P2 Component: remote AssignedTo: unassigned@sourceware.org ReportedBy: terry.guo@arm.com Classification: Unclassified This Bugzilla entry is created for mailing list discussion at http://sourceware.org/ml/gdb-patches/2012-06/msg00790.html. This bug is first found at tool chain (2012Q1) released at https://launchpad.net/gcc-arm-embedded/ which is a gdb-7.3 based cross tool chain for arm-none-eabi. Then confirmed that the gdb trunk has same issue. The above MINGW arm-none-eabi GDB will get hang on Windows when use pipe to get stderr and stdout from stub. The command used to start stub in GDB is "target extended-remote | stub-that-write-stderr-before-stdout". For my case, after send "$vFlashDone#ea" to stub, GDB get hang. The GDB source show that GDB will keep waiting for ACK message from stdout of stub, after send the packet. Unfortunately my stub will write some kind of log information into stderr and this action takes place before stub write ACK message to its stdout. So the only pipe is occupied by stderr which is waiting for GDB to consume, while GDB keep waiting for message from the stdout which hasn't pipe to use. We finally end up with a deadlock on pipe between GDB/stderr/stdout. The proposed solution is to let GDB also probe and consume stderr when waiting for stdout. In this way such deadlock can be avoided. The Linux version GDB hasn't such issue. I think it's because we use different way to handle PIPE as stated in functions pipe_open and pipe_windows_open. For Linux we have two socketpair kind pipes, one for stdout and one for stderr. While for windows, we only have one pipe which is created by _pipe function. -- Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug.