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

Eli Zaretskii
2011-10-04T14:43:52Z

> 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.