[Lldb-commits] [PATCH] D41352: debugserver: Propagate environment in launch-mode (pr35671)

Greg Clayton via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Wed Dec 20 10:44:03 PST 2017


clayborg added inline comments.


================
Comment at: tools/debugserver/source/debugserver.cpp:1426
+    for (i = 0; (env_entry = host_env[i]) != NULL; ++i)
+      remote->Context().PushEnvironment(env_entry);
+  }
----------------
We need to check if the env var is already in the environment in remote->Context() first before pushing the new version. I would assume that if you exec a program with an env like:
```
FOO=bar
USER=me
FOO=baz
```

That FOO=baz will end up being the value that is used. If the user specifies things with --env, we will just overwrite it. We might add a PushEnvironmentIfNeeded() function to the Context() class that will make sure it isn't in the list first and push it only if needed.


https://reviews.llvm.org/D41352





More information about the lldb-commits mailing list