[Lldb-commits] [lldb] Make env and source map dictionaries #95137 (PR #106919)

Adrian Vogelsgesang via lldb-commits lldb-commits at lists.llvm.org
Mon Sep 2 12:06:34 PDT 2024


================
@@ -1831,7 +1831,13 @@ lldb::SBError LaunchProcess(const llvm::json::Object &request) {
     launch_info.SetArguments(MakeArgv(args).data(), true);
 
   // Pass any environment variables along that the user specified.
-  auto envs = GetStrings(arguments, "env");
+  auto envMap = GetStringMap(*arguments, "env");
+  std::vector<std::string> envs;
+  envs.reserve(envMap.size());
+  for (const auto &[key, value] : envMap) {
+    envs.emplace_back(key + '=' + value);
+  }
+
   if (!envs.empty())
     launch_info.SetEnvironmentEntries(MakeArgv(envs).data(), true);
----------------
vogelsgesang wrote:

instead of setting concatenated strings, I think we should use `SBLaunchInfo::SetEnvironment` and `SBEnvironment::Set`

https://github.com/llvm/llvm-project/pull/106919


More information about the lldb-commits mailing list