[PATCH v4 3/3] Extend "set cwd" to work on gdbserver

Pedro Alves palves@redhat.com
Fri Sep 29 15:21:00 GMT 2017


On 09/28/2017 05:10 AM, Sergio Durigan Junior wrote:
> --- a/gdb/NEWS
> +++ b/gdb/NEWS
> @@ -26,6 +26,14 @@
>  
>  * New features in the GDB remote stub, GDBserver
>  
> +  ** GDBserver is now able to set the inferior's current working
> +     directory.

That's confusing IMO, because it sounds like you're saying
you can change the inferior's current working directory at
any time, even on inferiors that are already running...

I'd go for:

  ** GDBserver is now able to start inferior processes with a
     specified initial working directory.

> +
> +     The user can set the desired working directory to be used by the
> +     remote inferior on GDB, using the new "set cwd" command, which
> +     will instruct GDB to tell GDBserver about this directory change
> +     the next time an inferior is run.

And instead of the above, say:

     The user can set the desired working directory to be used from GDB
     using the new "set cwd" command.

Note "on" -> "from".  I think that conveys it better.

The "which will instruct" part is distracting and unnecessary
implementation detail, IMO.


> +@item QSetWorkingDir:@r{[}@var{directory}@r{]}
> +@anchor{QSetWorkingDir packet}
> +@cindex set working directory, remote request
> +@cindex @samp{QSetWorkingDir} packet
> +This packet is used to inform the remote server of the intended
> +current working directory for programs that are going to be executed.
> +
> +The packet is composed by @var{directory}, an hex encoded
> +representation of the directory that the remote inferior will use as
> +its current working directory.  If @var{directory} is an empty string,
> +the remote server should reset the inferior's current working
> +directory to its original, empty value.
> +
> +This packet is always transmitted when the inferior is run.  If the
> +user has not explcitly specified a directory with the @kbd{set cwd}

typo: explicitly

> +command, then an empty packet will be sent to the remote server, which

Not an empty packet, and empty directory.  Really-empty packets are 
special in the remote protocol.

> +will have no effect.  

WDYM will have no effect, when just above you've explained that empty
means reset ?  I think you should just remove this paragraph starting
with "This packet is always transmitted".  That's implementation
detail.  GDB could for example not resend the packet if the value
didn't change between runs, no?

> Otherwise, the specified inferior's working
> +directory will be transmitted (@pxref{Working Directory, ,Your
> +Program's Working Directory}).

This too should be tweaked accordingly.

> +
> +This packet is only available in extended mode (@pxref{extended
> +mode}).
> +

Thanks,
Pedro Alves



More information about the Gdb-patches mailing list