Fix windows and freebsd builds for r322174 (Environment)

llvm-svn: 322176
This commit is contained in:
Pavel Labath 2018-01-10 12:25:48 +00:00
parent a330a407c4
commit 3ff377a927
2 changed files with 8 additions and 9 deletions

View File

@ -21,14 +21,15 @@ using namespace lldb;
using namespace lldb_private;
namespace {
void CreateEnvironmentBuffer(const Args &env, std::vector<char> &buffer) {
if (env.GetArgumentCount() == 0)
void CreateEnvironmentBuffer(const Environment &env,
std::vector<char> &buffer) {
if (env.size() == 0)
return;
// Environment buffer is a null terminated list of null terminated strings
for (auto &entry : env.entries()) {
for (const auto &KV : env) {
std::wstring warg;
if (llvm::ConvertUTF8toWide(entry.ref, warg)) {
if (llvm::ConvertUTF8toWide(Environment::compose(KV), warg)) {
buffer.insert(buffer.end(), (char *)warg.c_str(),
(char *)(warg.c_str() + warg.size() + 1));
}
@ -75,9 +76,8 @@ ProcessLauncherWindows::LaunchProcess(const ProcessLaunchInfo &launch_info,
if (launch_info.GetFlags().Test(eLaunchFlagDebug))
flags |= DEBUG_ONLY_THIS_PROCESS;
auto &env = const_cast<Args &>(launch_info.GetEnvironmentEntries());
LPVOID env_block = nullptr;
::CreateEnvironmentBuffer(env, environment);
::CreateEnvironmentBuffer(launch_info.GetEnvironment(), environment);
if (!environment.empty())
env_block = environment.data();

View File

@ -407,9 +407,8 @@ Status ProcessFreeBSD::DoLaunch(Module *module,
m_monitor = new ProcessMonitor(
this, module, launch_info.GetArguments().GetConstArgumentVector(),
launch_info.GetEnvironmentEntries().GetConstArgumentVector(),
stdin_file_spec, stdout_file_spec, stderr_file_spec, working_dir,
launch_info, error);
launch_info.GetEnvironment().getEnvp(), stdin_file_spec, stdout_file_spec,
stderr_file_spec, working_dir, launch_info, error);
m_module = module;