diff options
| author | Adrian McCarthy <amccarth@google.com> | 2019-02-28 19:14:02 +0000 |
|---|---|---|
| committer | Adrian McCarthy <amccarth@google.com> | 2019-02-28 19:14:02 +0000 |
| commit | 34f2bee0fb04e9725eadd95f7abedf72f19bcabd (patch) | |
| tree | 46188c23b791661ebeb144bf2d272584e1f06c24 /lldb/source/Host | |
| parent | e47d32f165c01e6cb3dcf71f6a9963ce66ea0972 (diff) | |
| download | bcm5719-llvm-34f2bee0fb04e9725eadd95f7abedf72f19bcabd.tar.gz bcm5719-llvm-34f2bee0fb04e9725eadd95f7abedf72f19bcabd.zip | |
Improve process launch comments for Windows
The existing comment about over-allocating the command line was incorrect. The
contents of the command line may be changed, but it's not necessary to over
allocate. The changes will be limited to the existing contents of the string
(e.g., by replacing spaces with L'\0' to tokenize the command line).
Also added a comment explaining a possible cause of failure to save the next
programmer some time when they try to debug a 64-bit process from a 32-bit
LLDB.
llvm-svn: 355121
Diffstat (limited to 'lldb/source/Host')
| -rw-r--r-- | lldb/source/Host/windows/ProcessLauncherWindows.cpp | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/lldb/source/Host/windows/ProcessLauncherWindows.cpp b/lldb/source/Host/windows/ProcessLauncherWindows.cpp index e8208c3be94..221b0a16ae1 100644 --- a/lldb/source/Host/windows/ProcessLauncherWindows.cpp +++ b/lldb/source/Host/windows/ProcessLauncherWindows.cpp @@ -104,17 +104,21 @@ ProcessLauncherWindows::LaunchProcess(const ProcessLaunchInfo &launch_info, llvm::ConvertUTF8toWide(commandLine, wcommandLine); llvm::ConvertUTF8toWide(launch_info.GetWorkingDirectory().GetCString(), wworkingDirectory); + // If the command line is empty, it's best to pass a null pointer to tell + // CreateProcessW to use the executable name as the command line. If the + // command line is not empty, its contents may be modified by CreateProcessW. + WCHAR *pwcommandLine = wcommandLine.empty() ? nullptr : &wcommandLine[0]; - wcommandLine.resize(PATH_MAX); // Needs to be over-allocated because - // CreateProcessW can modify it BOOL result = ::CreateProcessW( - wexecutable.c_str(), &wcommandLine[0], NULL, NULL, TRUE, flags, env_block, + wexecutable.c_str(), pwcommandLine, NULL, NULL, TRUE, flags, env_block, wworkingDirectory.size() == 0 ? NULL : wworkingDirectory.c_str(), &startupinfo, &pi); if (!result) { // Call GetLastError before we make any other system calls. error.SetError(::GetLastError(), eErrorTypeWin32); + // Note that error 50 ("The request is not supported") will occur if you + // try debug a 64-bit inferior from a 32-bit LLDB. } if (result) { |

