[Lldb-commits] [lldb] [LLDB] Add a target.launch-working-dir setting (PR #113521)

David Spickett via lldb-commits lldb-commits at lists.llvm.org
Thu Oct 31 02:36:34 PDT 2024


DavidSpickett wrote:

> That was just a symptom, but what we want is users not having to specify process launch -w at all. We want our users to simply do run and that things just work.

We have:
* process launch -w does not carry the working dir to subsequent launches.
  * Please open an issue for that.
  * Maybe it can be fixed with the setting, but you don't need to deal with that.
* Your users want to use `run` as they would normally, I think I would too.
  * Adding a setting is a reasonable approach for this part.
  * It's kinda like `git -C` but for all targets launched by lldb.

You will have to decide whether `process launch -w` or the setting wins, I would say `process launch -w` wins and if `-w` is not passed then the setting is used.

> launch-working-dir sounds like working-dir to me.

Although one might think that `working-dir` actually changes the working directory of a running target if you change it at runtime.  We already have a few settings that actually only apply on first launch but aren't named as such.

So let's leave the `launch` bit in and document that changing it at runtime will not change the process' working dir, to be extra clear.

> Should this be target.process not target?

On second thought, if this is on target then the launch workdir dir should be too:
```
target.run-args -- A list containing all the arguments to be passed to the executable when it is run. Note that this does NOT include the argv[0] which is in target.arg0.
```
...so ignore advice from me on a Wednesday I guess :)

Also you could reference how this setting interacts with the other ways to pass arguments like `lldb program -- arg1 arg2`, whether it's additive or one wins. For a working dir, one has to win of course.

https://github.com/llvm/llvm-project/pull/113521


More information about the lldb-commits mailing list