public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
From: "terry.guo at arm dot com" <sourceware-bugzilla@sourceware.org>
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	[thread overview]
Message-ID: <bug-14329-4717@http.sourceware.org/bugzilla/> (raw)

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.


             reply	other threads:[~2012-07-04  1:45 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-07-04  1:45 terry.guo at arm dot com [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-14329-4717@http.sourceware.org/bugzilla/ \
    --to=sourceware-bugzilla@sourceware.org \
    --cc=gdb-prs@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).