[Lldb-commits] [lldb] [lldb][windows] allow longer paths than MAX_PATH in GetFileNameByLoadAddress (PR #200225)

via lldb-commits lldb-commits at lists.llvm.org
Thu May 28 10:10:09 PDT 2026


llvmorg-github-actions[bot] wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-lldb

Author: Charles Zablit (charles-zablit)

<details>
<summary>Changes</summary>

DLLs can be longer than MAX_PATH. This is causing test failures when running `check-lldb` in a Windows Docker container. 

This patch allow long paths when calling `GetFileNameByLoadAddress`.

https://github.com/llvm/llvm-project/pull/198795#discussion_r3276277895 was correct.

---
Full diff: https://github.com/llvm/llvm-project/pull/200225.diff


1 Files Affected:

- (modified) lldb/source/Plugins/Process/Windows/Common/DebuggerThread.cpp (+7-4) 


``````````diff
diff --git a/lldb/source/Plugins/Process/Windows/Common/DebuggerThread.cpp b/lldb/source/Plugins/Process/Windows/Common/DebuggerThread.cpp
index c4bfa11e9635d..660bd7bd75498 100644
--- a/lldb/source/Plugins/Process/Windows/Common/DebuggerThread.cpp
+++ b/lldb/source/Plugins/Process/Windows/Common/DebuggerThread.cpp
@@ -555,11 +555,14 @@ static std::optional<std::string> GetFileNameByLoadAddress(HANDLE hProcess,
   }
 
   // Fallback: ask the kernel for the file backing the mapping at this address.
-  std::array<wchar_t, MAX_PATH + 1> mapped_filename;
-  if (!::GetMappedFileNameW(hProcess, base_addr, mapped_filename.data(),
-                            mapped_filename.size()))
+  std::vector<wchar_t> mapped_filename(PATHCCH_MAX_CCH);
+  DWORD mapped_len = ::GetMappedFileNameW(
+      hProcess, base_addr, mapped_filename.data(), mapped_filename.size());
+  if (!mapped_len)
     return std::nullopt;
-  return ConvertNtDevicePathToDosPath(mapped_filename);
+  std::optional<std::string> dos_path = ConvertNtDevicePathToDosPath(
+      llvm::ArrayRef<wchar_t>(mapped_filename.data(), mapped_len + 1));
+  return dos_path;
 }
 
 // Resolve the LOAD_DLL_DEBUG_INFO::lpImageName field.

``````````

</details>


https://github.com/llvm/llvm-project/pull/200225


More information about the lldb-commits mailing list