[Lldb-commits] [PATCH] D76470: [lldb/Target] Rework the way the inferior environment is created

Frederic Riss via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Fri Mar 20 16:18:08 PDT 2020


friss added a comment.

In D76470#1934201 <https://reviews.llvm.org/D76470#1934201>, @jingham wrote:

> In D76470#1934146 <https://reviews.llvm.org/D76470#1934146>, @friss wrote:
>
> > In D76470#1933910 <https://reviews.llvm.org/D76470#1933910>, @jingham wrote:
> >
> > > Is there any command-based way to see the entire environment that a process will get when it launches?  By populating target.env-vars with the inherited environment there was a way to mostly do that, but I don't see that anymore.  It seems a shame not to be able to see that...
> >
> >
> > No, there is no way to do this, but it's not really a regression. If you do  `settings show target.env-vars` today before running then you won't see what is going to be passed. Only after the first run will it be populated. This was a surprise to me and I find it highly inconsistent. Maybe I can add another property that would get updated with the computed environment. Do we have anything like read-only properties?
>
>
> No, but I don't think I'd do this with a property anyway.  You are asking the target to compute the result of the various settings that affect the environment of a process it might launch.  That sounds more like the result of a command ("target show-environment" or something like that.)  If we knew how to get the environment from a running process, the same command could show the current environment in a running process, which would sometimes be handy.
>
> I agree the behavior before was pretty unhelpful, so I don't think you need to add a new command to access this in this change set.  But we should put it on our list of things to do.


The command was not hard to add, so I just did it. I used "target show-launch-environment" because I thought "show-environment" would imply that it fetches the inferior environment. I also made `env-vars` take precedence over `unset-env-vars`


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D76470





More information about the lldb-commits mailing list