This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [RFA] testsuite: Add a test for passing of environment variables to inferior
- From: Eli Zaretskii <eliz at gnu dot org>
- To: gdb-patches at sourceware dot org
- Date: Tue, 04 Oct 2011 16:43:03 +0200
- Subject: Re: [RFA] testsuite: Add a test for passing of environment variables to inferior
- References: <006301cc8292$367539b0$a35fad10$%muller@ics-cnrs.unistra.fr> <20111004134506.GB24369@calimero.vinschen.de>
- Reply-to: Eli Zaretskii <eliz at gnu dot org>
> 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.