[PATCH v5 0/3] New "set cwd" command

Sergio Durigan Junior sergiodj@redhat.com
Fri Sep 29 22:58:00 GMT 2017


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
v4: https://sourceware.org/ml/gdb-patches/2017-09/msg00846.html

Changes from v4:

* Patch #1:

  - s/HAVE_GDB_TILDE_EXPAND_H/GDB_TILDE_EXPAND_H/ on
    gdb/common/gdb_tilde_expand.h.

* Patch #2:

  - Include more rationale/details about the "set/show cwd" commands
    in the commit log.

  - Improve set cwd code flow on fork_inferior.

  - Remove <stdio.h> inclusion from gdb.base/set-cwd.c

  - Don't mention "gdbserver" on "untested" message at
    gdb/set-cwd.exp.  Instead, say "remote server".

  - s/proc + with_test_prefix/proc_with_prefix/

  - Fix typos.

  - Rewrite certain tests to take timeout scenarios into account.

  - Uniquefy "runto_main" messages.

  - Rewrite parts of Windows code in order to (a) take into account
    when "inferior_cwd" is NULL, and (b) create a proper buffer to be
    filled by "cygwin_conv_path".

* Patch #3:

  - Rewrite gdb/NEWS entry in order to remove the confusion about when
    gdbserver is able to change the inferior's cwd.

  - Fix typos.

  - Rewrite/remove paragraph explaining when the "QSetWorkingDir"
    packet is sent by GDB.


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.



More information about the Gdb-patches mailing list