[Lldb-commits] [PATCH] D74636: [lldb-vscode] Add inheritEnvironment option

Pavel Labath via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Tue Mar 24 02:07:52 PDT 2020


labath added a comment.

In D74636#1938283 <https://reviews.llvm.org/D74636#1938283>, @clayborg wrote:

> I would either add the option to SBLaunchInfo so it can be specified, or execute the command. If the target is created, it is setting a target specific setting. If had to pick I would add the API to SBLaunchInfo. Whenever I see something that can't be done through the API, I like to add that API if it is warranted. In our case the value in the SBLaunchInfo should probably be stored as a lldb_private::LazyBool which can have the following values:
>
>   enum LazyBool { eLazyBoolCalculate = -1, eLazyBoolNo = 0, eLazyBoolYes = 1 };
>
>
> It would eLazyBoolCalculate to in the launch info, and if it gets set to true or false, then we use that, if it is set to eLazyBoolCalculate we use the target setting.


As of https://reviews.llvm.org/D76045, one can pass nullptr/None  as the environment to Launch/LaunchSimple in order to get the "default" environment handling. This is does not work with the SBLaunchInfo, but the same thing can be achieved there (after https://reviews.llvm.org/D76111) by doing launch_info.SetEnvironment(target.GetEnvironment()). So I don't think that another way of inheriting the default environment is needed (or even desired).

The question here isn't really about what can or cannot be done via SBLaunchInfo api (all of this can be done). It's more of the opposite. I.e., what to do if we **cannot** use SBLaunchInfo because the user wants to do the launch itself (via `launchCommands` => CLI). I can see how applying the other settings would be useful, but given that `launchCommands` is a fairly advanced feature, I think it would also be acceptable to leave this up to the user. But in either case, I think we should be consistent, and not apply a random subset of settings.

So, I think it would be best to leave the `target.inherit-env` alone here, and create a separate patch for the handling of settings in the `launchCommands` scenario.



================
Comment at: lldb/tools/lldb-vscode/package.json:90
+								"description": "Inherit the debugger environment when launching a process. Only works for binaries launched directly by LLDB.",
+								"default": false
+							},
----------------
Why is this false? It seems true is a much more reasonable default here, and it would be consistent with the normal lldb behavior.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D74636/new/

https://reviews.llvm.org/D74636





More information about the lldb-commits mailing list