From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 16391 invoked by alias); 4 Oct 2011 14:43:52 -0000 Received: (qmail 16382 invoked by uid 22791); 4 Oct 2011 14:43:52 -0000 X-SWARE-Spam-Status: No, hits=-1.0 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_NONE,SPF_SOFTFAIL X-Spam-Check-By: sourceware.org Received: from mtaout22.012.net.il (HELO mtaout22.012.net.il) (80.179.55.172) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 04 Oct 2011 14:43:36 +0000 Received: from conversion-daemon.a-mtaout22.012.net.il by a-mtaout22.012.net.il (HyperSendmail v2007.08) id <0LSJ00100Q2ZON00@a-mtaout22.012.net.il> for gdb-patches@sourceware.org; Tue, 04 Oct 2011 16:43:02 +0200 (IST) Received: from HOME-C4E4A596F7 ([77.124.91.138]) by a-mtaout22.012.net.il (HyperSendmail v2007.08) with ESMTPA id <0LSJ001ECQ7PB620@a-mtaout22.012.net.il> for gdb-patches@sourceware.org; Tue, 04 Oct 2011 16:43:02 +0200 (IST) Date: Tue, 04 Oct 2011 14:43:00 -0000 From: Eli Zaretskii Subject: Re: [RFA] testsuite: Add a test for passing of environment variables to inferior In-reply-to: <20111004134506.GB24369@calimero.vinschen.de> To: gdb-patches@sourceware.org Reply-to: Eli Zaretskii Message-id: <83zkhgrf60.fsf@gnu.org> References: <006301cc8292$367539b0$a35fad10$%muller@ics-cnrs.unistra.fr> <20111004134506.GB24369@calimero.vinschen.de> X-IsSubscribed: yes Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2011-10/txt/msg00076.txt.bz2 > Date: Tue, 4 Oct 2011 15:45:06 +0200 > From: Corinna Vinschen > > 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.