From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 23142 invoked by alias); 3 Oct 2017 16:47:41 -0000 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 Received: (qmail 23132 invoked by uid 89); 3 Oct 2017 16:47:41 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RP_MATCHES_RCVD,SPF_HELO_PASS autolearn=ham version=3.3.2 spammy= X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 03 Oct 2017 16:47:40 +0000 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id CE330C059B61; Tue, 3 Oct 2017 16:47:38 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com CE330C059B61 Authentication-Results: ext-mx08.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx08.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=sergiodj@redhat.com Received: from localhost (unused-10-15-17-193.yyz.redhat.com [10.15.17.193]) by smtp.corp.redhat.com (Postfix) with ESMTPS id A773860606; Tue, 3 Oct 2017 16:47:38 +0000 (UTC) From: Sergio Durigan Junior To: Pedro Alves Cc: GDB Patches , Eli Zaretskii Subject: Re: [PATCH v5 2/3] Implement "set cwd" command on GDB References: <20170912042325.14927-1-sergiodj@redhat.com> <20170929225852.21872-1-sergiodj@redhat.com> <20170929225852.21872-3-sergiodj@redhat.com> <874lrg5goz.fsf@redhat.com> <6520ea6a-6be7-db93-1d3e-1b156bc95564@redhat.com> Date: Tue, 03 Oct 2017 16:47:00 -0000 In-Reply-To: <6520ea6a-6be7-db93-1d3e-1b156bc95564@redhat.com> (Pedro Alves's message of "Tue, 3 Oct 2017 17:44:10 +0100") Message-ID: <87mv5841qt.fsf@redhat.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.2 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-IsSubscribed: yes X-SW-Source: 2017-10/txt/msg00058.txt.bz2 On Tuesday, October 03 2017, Pedro Alves wrote: > On 10/03/2017 05:39 PM, Sergio Durigan Junior wrote: > >>> But what if inferior_cwd _is_ NULL, when ... >>> >>> >>>> memset (&si, 0, sizeof (si)); >>>> si.cb = sizeof (si); >>>> >>>> @@ -2514,6 +2527,10 @@ windows_create_inferior (struct target_ops *ops, const char *exec_file, >>>> flags |= DEBUG_PROCESS; >>>> } >>>> >>>> + if (cygwin_conv_path (CCP_POSIX_TO_WIN_W, inferior_cwd, >>>> + infcwd, strlen (inferior_cwd)) < 0) >>>> + error (_("Error converting inferior cwd: %d"), errno); >>> >>> ... we get here? It looks to me like this conversion should >>> skipped here then, and ... >> >> You're right, this should be skipped. >> >>>> + >>>> #ifdef __USEWIDE >>>> args = (cygwin_buf_t *) alloca ((wcslen (toexec) + wcslen (cygallargs) + 2) >>>> * sizeof (wchar_t)); >>>> @@ -2574,7 +2591,7 @@ windows_create_inferior (struct target_ops *ops, const char *exec_file, >>>> TRUE, /* inherit handles */ >>>> flags, /* start flags */ >>>> w32_env, /* environment */ >>>> - NULL, /* current directory */ >>>> + infcwd, /* current directory */ >>> >>> ... here still pass NULL. >> >> Here we pass NULL because that was the old behaviour when we did not >> care about the inferior's cwd. This is the same approach that we use on >> fork_inferior: if the user hasn't provided any paths via "set cwd", then >> we don't do anything. > > Exactly, I'm saying that you _should_ pass NULL iff > inferior_cwd is NULL. That's what msdn's documentation of > CreateProcess says you should pass in order to have the > process inherit its parent's cwd. Oh, right, sorry, I mistakenly thought we were talking about the code below, which uses "inferior_cwd" directly. Indeed, this part should pass NULL, and I've fixed it locally to do that. Thanks, -- Sergio GPG key ID: 237A 54B1 0287 28BF 00EF 31F4 D0EB 7628 65FC 5E36 Please send encrypted e-mail if possible http://sergiodj.net/