[Lldb-commits] [lldb] [lldb][windows] allow longer paths than MAX_PATH in GetFileNameByLoadAddress (PR #200225)
Charles Zablit via lldb-commits
lldb-commits at lists.llvm.org
Fri May 29 04:33:05 PDT 2026
================
@@ -555,11 +556,21 @@ 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()))
- return std::nullopt;
- return ConvertNtDevicePathToDosPath(mapped_filename);
+ std::vector<wchar_t> mapped_filename(MAX_PATH + 1);
+ DWORD mapped_len = 0;
+ while (true) {
+ mapped_len = ::GetMappedFileNameW(
+ hProcess, base_addr, mapped_filename.data(), mapped_filename.size());
+ if (mapped_len > 0)
+ break;
+ if (::GetLastError() != ERROR_INSUFFICIENT_BUFFER ||
+ mapped_filename.size() >= PATHCCH_MAX_CCH)
+ return std::nullopt;
----------------
charles-zablit wrote:
I flipped the conditions so that it matches what we do in `GetModulePath` in `PythonPathSetup.cpp`.
https://github.com/llvm/llvm-project/pull/200225
More information about the lldb-commits
mailing list