This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
[PATCH v4 0/3] New "set cwd" command
- From: Sergio Durigan Junior <sergiodj at redhat dot com>
- To: GDB Patches <gdb-patches at sourceware dot org>
- Cc: Pedro Alves <palves at redhat dot com>, Eli Zaretskii <eliz at gnu dot org>
- Date: Thu, 28 Sep 2017 00:10:43 -0400
- Subject: [PATCH v4 0/3] New "set cwd" command
- Authentication-results: sourceware.org; auth=none
- Authentication-results: ext-mx05.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com
- Authentication-results: ext-mx05.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=sergiodj at redhat dot com
- Dmarc-filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 6D33D2FDC39
- References: <20170912042325.14927-1-sergiodj@redhat.com>
v1: https://sourceware.org/ml/gdb-patches/2017-09/msg00321.html
v2: https://sourceware.org/ml/gdb-patches/2017-09/msg00458.html
v3: https://sourceware.org/ml/gdb-patches/2017-09/msg00658.html
Changes from v3:
* Patch #1 (former patch #3):
- Do not s/tilde_expand/gdb_tilde_expand/ on
gdb/cli/cli-cmds.c:cd_command (leave as a possible cleanup for
later patches).
- Use only GLOB_TILDE_CHECK (and not "GLOB_TILDE | GLOB_TILDE_CHECK
| GLOB_ONLYDIR") when calling "glob", making "gdb_tilde_expand" to
behave as a general-purpose "tilde-expander" (i.e., don't deal only
with dirs).
* Patch #2 (former patch #4):
- Rewrite several parts of the documentation (NEWS, gdb.texinfo,
commit log, etc.) in order to remove target-dependent sentences
explaining how GDB deals with the inferior's cwd.
- Expand documentation to explain what "~" means on Windows.
- Improve Windows-related code to perform wide-char conversion when
needed, and mirror slashes of paths provided by the user. Call
"gdb_tilde_expand" before passing the path to CreateProcess.
- Make "set cwd" (without arguments) actually clean up the
previously set inferior's cwd (i.e., reset it to an empty value),
instead of defaulting to "~" as "cd" does. Adjust testsuite and
code accordingly.
* Patch #3 (former patch #5):
- Rewrite several parts of the documentation (NEWS, gdb.texinfo,
commit log, etc.) in order to remove target-dependent sentences
explaining how GDB deals with the inferior's cwd.
- s/gdbserver/remote server/ in the manual.
- s/@code/@kbd/ for writing commands in the manual.
- Improve debug string on gdb/gdbserver/server.c:handle_general_set
when dealing with "QSetWorkingDir".
- Implement the "set cwd"-without-arguments cleanup on gdbserver, by
making "QSetWorkingDir" accept an empty argument. This way, we'll
always send the packet to the remote stub, even when the user
hasn't set any cwd for the inferior.
- Improved debug string on gdb/remote.c's code to handle
"QSetWorkingDir".
- Improved message when calling "untested" because "[use_gdb_stub]"
is true.
This patch series is a followup of the discussion that happened at:
https://sourceware.org/ml/gdb-patches/2017-09/msg00160.html
It implements a new GDB command, "set cwd", which is used to set the
current working directory of the inferior that will be started. This
command works for both native and remote debugging scenarios.
The idea here is that "set cwd" will become the de facto way of
setting the inferior's cwd. Currently, the user can use "cd" for
that, but there are side effects: with "cd", GDB also switches to
another directory, and that can impact the loading of scripts and
other files. With "set cwd", we separate the logic into a new
command.
To maintain backward compatibility, if the user issues a "cd" command
but doesn't use "set cwd", then the inferior's cwd will still be
changed according to what the user specified. However, "set cwd" has
precedence over "cd", so it can always be used to override it.