This is the mail archive of the
gdb-prs@sourceware.org
mailing list for the GDB project.
[Bug remote/14329] New: GDB will get hang on Windows when using pipeto get stdout and stderr from stub
- From: "terry.guo at arm dot com" <sourceware-bugzilla at sourceware dot org>
- To: gdb-prs at sourceware dot org
- Date: Wed, 04 Jul 2012 01:45:14 +0000
- Subject: [Bug remote/14329] New: GDB will get hang on Windows when using pipeto get stdout and stderr from stub
- Auto-submitted: auto-generated
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.