[Lldb-commits] [lldb] [lldb][Windows] Open paths longer than MAX_PATH in FileSystem::Open (PR #229727)

Charles Zablit via lldb-commits lldb-commits at lists.llvm.org
Wed Oct 7 04:18:04 PDT 2026


https://github.com/charles-zablit created https://github.com/llvm/llvm-project/pull/229727

None

>From 72c6dde22837ee4dcdd0b03ac7b3fc6971813625 Mon Sep 17 00:00:00 2001
From: Charles Zablit <c_zablit at apple.com>
Date: Wed, 7 Oct 2026 12:16:55 +0100
Subject: [PATCH] [lldb][Windows] Open paths longer than MAX_PATH in
 FileSystem::Open

---
 lldb/source/Host/windows/FileSystem.cpp | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/lldb/source/Host/windows/FileSystem.cpp b/lldb/source/Host/windows/FileSystem.cpp
index f070364151b3f6c..49961f9ec3a480a 100644
--- a/lldb/source/Host/windows/FileSystem.cpp
+++ b/lldb/source/Host/windows/FileSystem.cpp
@@ -20,6 +20,7 @@
 
 #include "llvm/Support/ConvertUTF.h"
 #include "llvm/Support/FileSystem.h"
+#include "llvm/Support/Windows/WindowsSupport.h"
 
 using namespace lldb_private;
 
@@ -100,12 +101,12 @@ FILE *FileSystem::Fopen(const char *path, const char *mode) {
 }
 
 int FileSystem::Open(const char *path, int flags, int mode) {
-  std::wstring wpath;
-  if (!llvm::ConvertUTF8toWide(path, wpath))
+  llvm::SmallVector<wchar_t, MAX_PATH> wpath;
+  if (llvm::sys::windows::widenPath(path, wpath))
     return -1;
   // All other bits are rejected by _wsopen_s
   mode = mode & (_S_IREAD | _S_IWRITE);
   int result;
-  ::_wsopen_s(&result, wpath.c_str(), flags, _SH_DENYNO, mode);
+  ::_wsopen_s(&result, wpath.data(), flags, _SH_DENYNO, mode);
   return result;
 }



More information about the lldb-commits mailing list