[Lldb-commits] [PATCH] D39010: lldb-server tests: Propagate environment variables (pr34192)

Pavel Labath via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Tue Oct 17 10:02:03 PDT 2017


labath created this revision.

Without this, the launching of the test inferior may fail if it depends
on some component of the environment (most likely LD_LIBRARY_PATH). This
makes sure we propagate the environment variable to the inferior
process.


https://reviews.llvm.org/D39010

Files:
  unittests/tools/lldb-server/tests/TestClient.cpp


Index: unittests/tools/lldb-server/tests/TestClient.cpp
===================================================================
--- unittests/tools/lldb-server/tests/TestClient.cpp
+++ unittests/tools/lldb-server/tests/TestClient.cpp
@@ -101,6 +101,14 @@
 }
 
 bool TestClient::SetInferior(llvm::ArrayRef<std::string> inferior_args) {
+  StringList env;
+  Host::GetEnvironment(env);
+  for (size_t i = 0; i < env.GetSize(); ++i) {
+    if (SendEnvironmentPacket(env[i].c_str()) != 0) {
+      GTEST_LOG_(ERROR) << "failed to set environment variable `" << env[i] << "`";
+      return false;
+    }
+  }
   std::stringstream command;
   command << "A";
   for (size_t i = 0; i < inferior_args.size(); i++) {


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D39010.119349.patch
Type: text/x-patch
Size: 705 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20171017/0d6c2fd2/attachment.bin>


More information about the lldb-commits mailing list