This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [PATCH]Fix that GDB will get hang on Windows when using pipe to get stdout and stderr from stub
- From: Eli Zaretskii <eliz at gnu dot org>
- To: Terry Guo <terry dot guo at arm dot com>
- Cc: gdb-patches at sourceware dot org, Joey dot Ye at arm dot com, Matthew dot Gretton-Dann at arm dot com, palves at redhat dot com, daniel dot jacobowitz at gmail dot com
- Date: Wed, 27 Jun 2012 19:53:38 +0300
- Subject: Re: [PATCH]Fix that GDB will get hang on Windows when using pipe to get stdout and stderr from stub
- References: <000001cd5338$ded61b20$9c825160$%guo@arm.com>
- Reply-to: Eli Zaretskii <eliz at gnu dot org>
> From: "Terry Guo" <terry.guo@arm.com>
> Cc: <eliz@gnu.org>,
> "Joey Ye" <Joey.Ye@arm.com>,
> "Matthew Gretton-Dann" <Matthew.Gretton-Dann@arm.com>,
> "'Pedro Alves'" <palves@redhat.com>,
> <daniel.jacobowitz@gmail.com>
> Date: Tue, 26 Jun 2012 09:13:14 +0800
>
> I noticed a cross-built 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 following patch can avoid such deadlock by letting GDB also probe and
> consume stderr when waiting for stdout. Please review and comment.
I only read it superficially, but it looked fine to me.
Thanks.