From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 28733 invoked by alias); 20 Apr 2011 12:06:09 -0000 Received: (qmail 28709 invoked by uid 22791); 20 Apr 2011 12:06:06 -0000 X-SWARE-Spam-Status: No, hits=-1.5 required=5.0 tests=AWL,BAYES_00,MSGID_MULTIPLE_AT X-Spam-Check-By: sourceware.org Received: from mailhost.u-strasbg.fr (HELO mailhost.u-strasbg.fr) (130.79.200.152) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Wed, 20 Apr 2011 12:05:52 +0000 Received: from md1.u-strasbg.fr (md1.u-strasbg.fr [IPv6:2001:660:2402::186]) by mailhost.u-strasbg.fr (8.14.3/jtpda-5.5pre1) with ESMTP id p3KC5h7M091194 ; Wed, 20 Apr 2011 14:05:43 +0200 (CEST) (envelope-from pierre.muller@ics-cnrs.unistra.fr) Received: from mailserver.u-strasbg.fr (ms1.u-strasbg.fr [130.79.204.10]) by md1.u-strasbg.fr (8.14.4/jtpda-5.5pre1) with ESMTP id p3KC5hor002594 ; Wed, 20 Apr 2011 14:05:43 +0200 (CEST) (envelope-from pierre.muller@ics-cnrs.unistra.fr) Received: from E6510Muller (gw-ics.u-strasbg.fr [130.79.210.225]) (user=mullerp mech=LOGIN) by mailserver.u-strasbg.fr (8.14.4/jtpda-5.5pre1) with ESMTP id p3KC5gaC039164 (version=TLSv1/SSLv3 cipher=AES128-SHA bits=128 verify=NO) ; Wed, 20 Apr 2011 14:05:43 +0200 (CEST) (envelope-from pierre.muller@ics-cnrs.unistra.fr) From: "Pierre Muller" To: Cc: "'Corinna Vinschen'" References: <000601cbff45$66fa5820$34ef0860$@muller@ics-cnrs.unistra.fr> <20110420115528.GA5842@calimero.vinschen.de> In-Reply-To: <20110420115528.GA5842@calimero.vinschen.de> Subject: RE: [RFC] Add support for locally modified environment variables for windows-nat.c Date: Wed, 20 Apr 2011 12:06:00 -0000 Message-ID: <001501cbff53$465030a0$d2f091e0$@muller@ics-cnrs.unistra.fr> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable 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-04/txt/msg00350.txt.bz2 > -----Message d'origine----- > De : gdb-patches-owner@sourceware.org [mailto:gdb-patches- > owner@sourceware.org] De la part de Corinna Vinschen > Envoy=C3=A9 : mercredi 20 avril 2011 13:55 > =C3=80 : gdb-patches@sourceware.org > Objet : Re: [RFC] Add support for locally modified environment variables = for > windows-nat.c >=20 > On Apr 20 12:26, Pierre Muller wrote: > > A while ago > > Sebastian Puebla submitted a patch for > > support of locally modified environment variables. > > > > http://sourceware.org/ml/gdb-patches/2010-05/msg00317.html > > http://sourceware.org/ml/gdb-patches/2010-08/msg00026.html > > http://sourceware.org/ml/gdb-patches/2010-11/msg00128.html > > > > Nevertheless, I suspect that his patch would not have worked for Cygwin, > > because Cygwin converts several environment variables > > from windows style to POSIX style. >=20 > Do you suspect or did you actually test it? What you're trying to > accomplish is actually the task of the >=20 > cygwin_internal (CW_SYNC_WINENV); >=20 > call right before calling CreateProcess. This allows to keep the actual > underlying details of the environment handling entirely in the hands of > Cygwin. Especially copying an internal list of env vars from Cygwin > into GDB makes me very uncomfortable since this is bound to break as > soon as we decide to handle things a bit different in Cygwin. The problem is that this does not handle (gdb) set environment TEST=3DMy dummy test which is supposed to be passed to the inferior. after the commands above the in_env char * vector will have an additional entry "TEST=3DMy dummy test" but the internal environment variables of GDB itself are not changed. I suspect that cygwin_internal (CW_SYNC_WINENV); only acts on the environment variables of GDB itself. Does that mean that we should instead copy this in_env array using cygwin set_env function before calling cygwin_internal? If this is true, do we need to restore the environment state of GDB after? =20 > Of course it's cgf's call, but I don't think this is the right thing to > do. If this is actually broken, it's the cygwin_internal(CW_SYNC_WINENV) > implementation in Cygwin which should be fixed, rather than GDB going > out of its way to emulate what happens in Cygwin internally. Thanks you for explaining the cygwin_internal call. Of course my current patch does invalidate this as out_env array is used=20 instead of the current GDB environment variables. If you think that the proposal above is the right track for Cygwin, I will try to implement this. Pierre