From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 101310 invoked by alias); 31 Aug 2017 21:41:00 -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 101219 invoked by uid 89); 31 Aug 2017 21:41:00 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-10.9 required=5.0 tests=BAYES_00,GIT_PATCH_2,GIT_PATCH_3,KAM_LAZY_DOMAIN_SECURITY,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; Thu, 31 Aug 2017 21:40:58 +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 3274A6149C; Thu, 31 Aug 2017 21:40:57 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 3274A6149C Authentication-Results: ext-mx10.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx10.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 BAB4D70916; Thu, 31 Aug 2017 21:40:56 +0000 (UTC) From: Sergio Durigan Junior To: Eli Zaretskii Cc: gdb-patches@sourceware.org, palves@redhat.com Subject: Re: [PATCH/RFC] Implement the ability to set the current working directory in GDBserver References: <20170830043811.776-1-sergiodj@redhat.com> <83bmmx2kpq.fsf@gnu.org> Date: Thu, 31 Aug 2017 21:41:00 -0000 In-Reply-To: <83bmmx2kpq.fsf@gnu.org> (Eli Zaretskii's message of "Wed, 30 Aug 2017 17:28:49 +0300") Message-ID: <8737875sbb.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-08/txt/msg00550.txt.bz2 On Wednesday, August 30 2017, Eli Zaretskii wrote: >> From: Sergio Durigan Junior >> Cc: Pedro Alves , >> Eli Zaretskii , >> Sergio Durigan Junior >> Date: Wed, 30 Aug 2017 00:38:11 -0400 >> >> --- a/gdb/NEWS >> +++ b/gdb/NEWS >> @@ -17,11 +17,22 @@ >> "target remote", you can disable the startup with shell by using the >> new "--no-startup-with-shell" GDBserver command line option. >> >> + ** On Unix systems, GDBserver is now able to enter a directory >> + before starting an inferior. > > Can you tell why this is limited to Unix systems? The chdir function > is available much wider than just on Unix. No particular reason. This is the same text I've been using in my latest patches for gdbserver, so I chose to use it again. I'll rewrite it to remove this part. >> + This is done by using the "cd" command in GDB, which instructs it >> + to tell GDBserver about this directory change the next time an >> + inferior is run. If you want to make GDBserver enter the >> + directory your GDB is currently in, you can do a "cd ." in GDB. > > Couldn't GDB do this "cd ." step under the hood, without bothering > users with that? The problem is that we don't really know if the user will want to change gdbserver's current directory or not. If we always assume so, this will lead to many breakages as the directory tree will not be always the same on host and target. That's why 'user_set_cwd' is initially false. However, there's the case when the user may want to change gdbserver's directory to the same directory GDB is in. That's why I included this explanation in the docs. The more I think about this, the less I'm satisfied with the current solution. But I can't really think of a better alternative that doesn't involve having a separate command to manipulate gdbserver's cwd. >> +Whenever you specify a new working directory in @value{GDBN}, and if >> +you are performing a remote debug (@pxref{Remote Debugging}), this >> +change will be reflected in @command{gdbserver} the next time you run >> +the program being debugged (@pxref{QSetWorkingDir packet}). Sometimes >> +you may want to make @command{gdbserver} enter a directory in which >> +@value{GDBN} is already in; in this case, you can perform a @code{cd >> +.} which will not change the current directory in @value{GDBN} but >> +will force @command{gdbserver} to enter it. > > The "@code{cd .}" part should be @kbd{cd .}, and I'd take it in @w{..} > for a good measure, to prevent it from being broken between 2 lines. Thanks, fixed. >> +This packet is only transmitted when the user issues a @code{cd} >> +command in @value{GDBN} (@xref{Working Directory, ,Your Program's >> +Working Directory}). > > The @xref should be @pxref, as the former is not appropriate in > parentheses. Fixed. > The documentation parts are okay with these nits fixed. 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/