[Lldb-commits] [PATCH] D58648: Improve process launch comments for Windows
Adrian McCarthy via Phabricator via lldb-commits
lldb-commits at lists.llvm.org
Mon Feb 25 15:21:50 PST 2019
amccarth updated this revision to Diff 188263.
amccarth added a comment.
Forgot to include context in original diff.
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D58648/new/
https://reviews.llvm.org/D58648
Files:
lldb/source/Host/windows/ProcessLauncherWindows.cpp
Index: lldb/source/Host/windows/ProcessLauncherWindows.cpp
===================================================================
--- lldb/source/Host/windows/ProcessLauncherWindows.cpp
+++ lldb/source/Host/windows/ProcessLauncherWindows.cpp
@@ -104,17 +104,21 @@
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) {
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D58648.188263.patch
Type: text/x-patch
Size: 1485 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20190225/24c13aa6/attachment-0001.bin>
More information about the lldb-commits
mailing list