RE: [RFA] testsuite: Add a test for passing of environment variables to inferior

Pierre Muller
2011-10-04T14:48:52Z

> -----Message d'origine-----
> De : gdb-patches-owner@sourceware.org [mailto:gdb-patches-
> owner@sourceware.org] De la part de Eli Zaretskii
> Envoyé : mardi 4 octobre 2011 16:43
> À : gdb-patches@sourceware.org
> Objet : Re: [RFA] testsuite: Add a test for passing of environment
variables
> to inferior
>
> > Date: Tue, 4 Oct 2011 15:45:06 +0200
> > From: Corinna Vinschen <vinschen@redhat.com>
> >
> > Yes, that would be necessary. I'm wondering if we can't just utilze the
> > global environ variable for this and spare us all the hassle. Something
> > along these lines:
> >
> > char **old_env = environ;
> > environ = in_env;
> > cygwin_internal (CW_SYNC_WINENV);
> > CreateProcessW (NULL environment pointer);
> > environ = old_env;
>
> If my reading of sync_winenv is correct, you'd need one more call to
> cygwin_internal after restoring `environ'. Otherwise, the Windows
> environment of GDB will be left at the value passed to the inferior,
> which could have all kinds of weird unexpected effects elsewhere in
> GDB.
No, this is not enough, see my next email...

Pierre