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 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,7 +232,7 @@ : ctx.GetWorkingDirectory()); const char *process_event = ctx.GetProcessEvent(); nub_process_t pid = DNBProcessLaunch( - resolved_path, &inferior_argv[0], &inferior_envp[0], cwd, stdin_path, + resolved_path, &inferior_argv[0], const_cast(*_NSGetEnviron()), cwd, stdin_path, stdout_path, stderr_path, no_stdio, launch_flavor, g_disable_aslr, process_event, launch_err_str, sizeof(launch_err_str)); 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("LLDB_TEST_MAGIC_VARIABLE=LLDB_TEST_MAGIC_VALUE")); auto ClientOr = TestClient::launch(getLogFileName(),