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

Pavel Labath via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Mon Dec 18 07:26:49 PST 2017


labath updated this revision to Diff 127358.
labath added a comment.

re-clang-format the patch


https://reviews.llvm.org/D41352

Files:
  tools/debugserver/source/debugserver.cpp
  unittests/tools/lldb-server/tests/LLGSTest.cpp


Index: unittests/tools/lldb-server/tests/LLGSTest.cpp
===================================================================
--- unittests/tools/lldb-server/tests/LLGSTest.cpp
+++ unittests/tools/lldb-server/tests/LLGSTest.cpp
@@ -16,11 +16,6 @@
 using namespace llvm;
 
 TEST_F(TestBase, LaunchModePreservesEnvironment) {
-  if (TestClient::IsDebugServer()) {
-    GTEST_LOG_(WARNING) << "Test fails with debugserver: llvm.org/pr35671";
-    return;
-  }
-
   putenv(const_cast<char *>("LLDB_TEST_MAGIC_VARIABLE=LLDB_TEST_MAGIC_VALUE"));
 
   auto ClientOr = TestClient::launch(getLogFileName(),
Index: tools/debugserver/source/debugserver.cpp
===================================================================
--- tools/debugserver/source/debugserver.cpp
+++ tools/debugserver/source/debugserver.cpp
@@ -190,15 +190,6 @@
   for (i = 0; i < inferior_argc; i++)
     inferior_argv[i] = ctx.ArgumentAtIndex(i);
 
-  // Pass the environment array the same way:
-
-  size_t inferior_envc = ctx.EnvironmentCount();
-  // Initialize inferior_argv with inferior_argc + 1 NULLs
-  std::vector<const char *> inferior_envp(inferior_envc + 1, NULL);
-
-  for (i = 0; i < inferior_envc; i++)
-    inferior_envp[i] = ctx.EnvironmentAtIndex(i);
-
   // Our launch type hasn't been set to anything concrete, so we need to
   // figure our how we are going to launch automatically.
 
@@ -241,9 +232,10 @@
                                        : ctx.GetWorkingDirectory());
   const char *process_event = ctx.GetProcessEvent();
   nub_process_t pid = DNBProcessLaunch(
-      resolved_path, &inferior_argv[0], &inferior_envp[0], cwd, stdin_path,
-      stdout_path, stderr_path, no_stdio, launch_flavor, g_disable_aslr,
-      process_event, launch_err_str, sizeof(launch_err_str));
+      resolved_path, &inferior_argv[0],
+      const_cast<const char **>(*_NSGetEnviron()), cwd, stdin_path, stdout_path,
+      stderr_path, no_stdio, launch_flavor, g_disable_aslr, process_event,
+      launch_err_str, sizeof(launch_err_str));
 
   g_pid = pid;
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D41352.127358.patch
Type: text/x-patch
Size: 2034 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20171218/96657468/attachment-0001.bin>


More information about the lldb-commits mailing list