This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: PATCH: Avoid console windows on Win32
- From: Mark Mitchell <mark at codesourcery dot com>
- To: mark at codesourcery dot com
- Cc: gcc-patches at gcc dot gnu dot org, ian at airs dot com
- Date: Mon, 20 Mar 2006 14:40:21 -0800
- Subject: Re: PATCH: Avoid console windows on Win32
- References: <200603202011.k2KKBxTv026443@sethra.codesourcery.com>
Mark Mitchell wrote:
> 2006-03-20 Mark Mitchell <mark@codesourcery.com>
>
> * pex-win32.c (<errno.h>): Include.
> (fix_argv): Remove.
> (argv_to_cmdline): New function.
> (std_suffixes): New variable.
> (no_suffixes): Likewise.
> (find_executable): New function.
> (win32_spawn): Likewise.
> (spawn_script): Use win32_spawn instead of _spawnv[p].
> (pex_win32_exec_child): Replace MSVCRT calls with Win32 API calls.
> (pex_win32_wait): Likewise.
An additional argument in favor of this patch is that it fixes a GDB bug
with "target remote |".
In particular, the pre-patch code plays games with the standard streams.
First, it duplicates the current standard fds (stdin, etc.). Then, it
makes the standard fds of the parent match what it wants for the child.
Then, it calls spawn. Then, it switch the parent fds back.
Unfortunately, GDB has a thread that is waiting for interesting things
to happen on the standard input handle. The manipulations in libiberty
end up closing that handle. GDB's thread thereby gets confused.
The patch avoids this problem because there are no games with the
standard handles of the parent; we just set things up for the child to
get the right handles.
--
Mark Mitchell
CodeSourcery
mark@codesourcery.com
(650) 331-3385 x713