Author: Charles Zablit Date: 2026-06-26T14:06:37+01:00 New Revision: d9c24ae3418ee1d2b2fa174e0d3e18b985282f5e
URL: https://github.com/llvm/llvm-project/commit/d9c24ae3418ee1d2b2fa174e0d3e18b985282f5e DIFF: https://github.com/llvm/llvm-project/commit/d9c24ae3418ee1d2b2fa174e0d3e18b985282f5e.diff LOG: [lldb][windows] allow long paths in process launcher (#206029) `MAX_PATH` is defined as `260` on Windows. Unicode paths however can be up to `32,767` characters long. Use `llvm::sys::windows::widenPath` to convert paths to unicode paths to allow targets that have long path names. This is the first part of a series of multiple commits that will fix long path support in lldb on Windows as well as adding regression tests. rdar://180711797 Added: Modified: lldb/source/Host/windows/ProcessLauncherWindows.cpp Removed: ################################################################################ diff --git a/lldb/source/Host/windows/ProcessLauncherWindows.cpp b/lldb/source/Host/windows/ProcessLauncherWindows.cpp index 08750ebb95113..c0583f54bb316 100644 --- a/lldb/source/Host/windows/ProcessLauncherWindows.cpp +++ b/lldb/source/Host/windows/ProcessLauncherWindows.cpp @@ -15,6 +15,7 @@ #include "llvm/ADT/SmallVector.h" #include "llvm/Support/ConvertUTF.h" #include "llvm/Support/Program.h" +#include "llvm/Support/Windows/WindowsSupport.h" #include "llvm/Support/WindowsError.h" #include <string> @@ -226,16 +227,20 @@ ProcessLauncherWindows::LaunchProcess(const ProcessLaunchInfo &launch_info, // command line is not empty, its contents may be modified by CreateProcessW. WCHAR *pwcommandLine = wcommandLine.empty() ? nullptr : &wcommandLine[0]; - std::wstring wexecutable, wworkingDirectory; - llvm::ConvertUTF8toWide(launch_info.GetExecutableFile().GetPath(), - wexecutable); + llvm::SmallVector<wchar_t, MAX_PATH> wexecutable; + if (std::error_code ec = llvm::sys::windows::widenPath( + launch_info.GetExecutableFile().GetPath(), wexecutable)) { + error = Status(ec); + return HostProcess(); + } + std::wstring wworkingDirectory; llvm::ConvertUTF8toWide(launch_info.GetWorkingDirectory().GetPath(), wworkingDirectory); PROCESS_INFORMATION pi = {}; BOOL result = ::CreateProcessW( - wexecutable.c_str(), pwcommandLine, nullptr, nullptr, + wexecutable.data(), pwcommandLine, nullptr, nullptr, /*bInheritHandles=*/!inherited_handles.empty() || pty_mode != PseudoConsole::Mode::None, flags, environment.data(), _______________________________________________ lldb-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
