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

* [Bug remote/14329] GDB will get hang on Windows when using pipe to get stdout and stderr from stub
  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 ` terry.guo at arm dot com
  2012-07-04  1:51 ` terry.guo at arm dot com
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: terry.guo at arm dot com @ 2012-07-04  1:48 UTC (permalink / raw)
  To: gdb-prs

http://sourceware.org/bugzilla/show_bug.cgi?id=14329

Terry Guo <terry.guo at arm dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Target|                            |arm-none-eabi
             Status|NEW                         |ASSIGNED
               Host|                            |x86 windows
         AssignedTo|unassigned at sourceware    |terry.guo at arm dot com
                   |dot org                     |
              Build|                            |Mingw

-- 
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

* [Bug remote/14329] GDB will get hang on Windows when using pipe to get stdout and stderr from stub
  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
  3 siblings, 0 replies; 5+ messages in thread
From: terry.guo at arm dot com @ 2012-07-04  1:51 UTC (permalink / raw)
  To: gdb-prs

http://sourceware.org/bugzilla/show_bug.cgi?id=14329

Terry Guo <terry.guo at arm dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |WAITING

--- Comment #1 from Terry Guo <terry.guo at arm dot com> 2012-07-04 01:51:45 UTC ---
Review comment is at
http://sourceware.org/ml/gdb-patches/2012-06/msg00833.html.

-- 
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

* [Bug remote/14329] GDB will get hang on Windows when using pipe to get stdout and stderr from stub
  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
  3 siblings, 0 replies; 5+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2012-07-18  4:36 UTC (permalink / raw)
  To: gdb-prs

http://sourceware.org/bugzilla/show_bug.cgi?id=14329

--- Comment #2 from cvs-commit at gcc dot gnu.org <cvs-commit at gcc dot gnu.org> 2012-07-18 04:36:31 UTC ---
CVSROOT:    /cvs/src
Module name:    src
Changes by:    xguo@sourceware.org    2012-07-18 04:36:24

Modified files:
    gdb            : ChangeLog defs.h ser-base.c 

Log message:
    2012-07-18  Terry Guo  <terry.guo@arm.com>

    PR 14329
    * defs.h (GDB_MI_MSG_WIDTH): New.
    * ser_base (ser_base_read_error_fd): New function.
    (do_ser_base_readchar): Poll error file descriptor as well as
    standard output.
    (generic_readchar): Refactor error handling.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gdb/ChangeLog.diff?cvsroot=src&r1=1.14472&r2=1.14473
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gdb/defs.h.diff?cvsroot=src&r1=1.317&r2=1.318
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gdb/ser-base.c.diff?cvsroot=src&r1=1.24&r2=1.25

-- 
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

* [Bug remote/14329] GDB will get hang on Windows when using pipe to get stdout and stderr from stub
  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
                   ` (2 preceding siblings ...)
  2012-07-18  4:36 ` cvs-commit at gcc dot gnu.org
@ 2012-07-18  4:58 ` terry.guo at arm dot com
  3 siblings, 0 replies; 5+ messages in thread
From: terry.guo at arm dot com @ 2012-07-18  4:58 UTC (permalink / raw)
  To: gdb-prs

http://sourceware.org/bugzilla/show_bug.cgi?id=14329

Terry Guo <terry.guo at arm dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|WAITING                     |RESOLVED
         Resolution|                            |FIXED

-- 
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).