public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
* [Bug remote/14329] New: GDB will get hang on Windows when using pipe to get stdout and stderr from stub
@ 2012-07-04  1:45 terry.guo at arm dot com
  2012-07-04  1:48 ` [Bug remote/14329] " terry.guo at arm dot com
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: terry.guo at arm dot com @ 2012-07-04  1:45 UTC (permalink / raw)
  To: gdb-prs

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.


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2012-07-18  4:58 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-07-04  1:45 [Bug remote/14329] New: GDB will get hang on Windows when using pipe to get stdout and stderr from stub terry.guo at arm dot com
2012-07-04  1:48 ` [Bug remote/14329] " terry.guo at arm dot com
2012-07-04  1:51 ` terry.guo at arm dot com
2012-07-18  4:36 ` cvs-commit at gcc dot gnu.org
2012-07-18  4:58 ` terry.guo at arm dot com

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).