diff options
| author | Aaron Smith <aaron.smith@microsoft.com> | 2019-02-07 18:22:00 +0000 |
|---|---|---|
| committer | Aaron Smith <aaron.smith@microsoft.com> | 2019-02-07 18:22:00 +0000 |
| commit | 981e63581a9a804ff6a2994b2d95193cd43d11f8 (patch) | |
| tree | c63fbf1bd4c34d2a9c1c361d7984b0bf0a40f5ba /lldb/source/Host/windows/ProcessLauncherWindows.cpp | |
| parent | f21c022380f52b5f2275ad5433fc291b2fee820c (diff) | |
| download | bcm5719-llvm-981e63581a9a804ff6a2994b2d95193cd43d11f8.tar.gz bcm5719-llvm-981e63581a9a804ff6a2994b2d95193cd43d11f8.zip | |
[gdb-remote] Use lldb's portable Host::GetEnvironment() instead of getenv
Reviewers: zturner, llvm-commits, labath, serge-sans-paille
Reviewed By: labath
Subscribers: Hui, labath, lldb-commits
Differential Revision: https://reviews.llvm.org/D56230
llvm-svn: 353440
Diffstat (limited to 'lldb/source/Host/windows/ProcessLauncherWindows.cpp')
| -rw-r--r-- | lldb/source/Host/windows/ProcessLauncherWindows.cpp | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/lldb/source/Host/windows/ProcessLauncherWindows.cpp b/lldb/source/Host/windows/ProcessLauncherWindows.cpp index 2f540547c7c..e8208c3be94 100644 --- a/lldb/source/Host/windows/ProcessLauncherWindows.cpp +++ b/lldb/source/Host/windows/ProcessLauncherWindows.cpp @@ -12,6 +12,7 @@ #include "llvm/ADT/SmallVector.h" #include "llvm/Support/ConvertUTF.h" +#include "llvm/Support/Program.h" #include <string> #include <vector> @@ -37,7 +38,19 @@ void CreateEnvironmentBuffer(const Environment &env, buffer.push_back(0); buffer.push_back(0); } + +bool GetFlattenedWindowsCommandString(Args args, std::string &command) { + if (args.empty()) + return false; + + std::vector<llvm::StringRef> args_ref; + for (auto &entry : args.entries()) + args_ref.push_back(entry.ref); + + command = llvm::sys::flattenWindowsCommandLine(args_ref); + return true; } +} // namespace HostProcess ProcessLauncherWindows::LaunchProcess(const ProcessLaunchInfo &launch_info, @@ -84,7 +97,7 @@ ProcessLauncherWindows::LaunchProcess(const ProcessLaunchInfo &launch_info, env_block = environment.data(); executable = launch_info.GetExecutableFile().GetPath(); - launch_info.GetArguments().GetQuotedCommandString(commandLine); + GetFlattenedWindowsCommandString(launch_info.GetArguments(), commandLine); std::wstring wexecutable, wcommandLine, wworkingDirectory; llvm::ConvertUTF8toWide(executable, wexecutable); |

