This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: PATCH: Avoid console windows on Win32


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]