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;
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;
_______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits