[Lldb-commits] [lldb] [lldb] Fix and re-enable TestUseSourceCache.py (PR #111237)
Emre Kultursay via lldb-commits
lldb-commits at lists.llvm.org
Mon Oct 7 15:17:55 PDT 2024
emrekultursay wrote:
> it failed in this case because the source file is opened with the `FILE_SHARE_DELETE` share mode, which allows the file to be removed, see `llvm::sys::fs::openNativeFileInternal()` in `llvm/lib/Support/Windows/Path.inc`.
Was there an LLDB change about how it opens a source file? When this test was written, LLDB called:
```
liblldb.dll!shouldUseMmap(...) Line 323
at c:\src\llvm-project\llvm\lib\support\memorybuffer.cpp(327)
liblldb.dll!getOpenFileImpl<llvm::WritableMemoryBuffer>(...) Line 446
at c:\src\llvm-project\llvm\lib\support\memorybuffer.cpp(446)
liblldb.dll!getFileAux<llvm::WritableMemoryBuffer>(...) Line 254
at c:\src\llvm-project\llvm\lib\support\memorybuffer.cpp(254)
liblldb.dll!llvm::WritableMemoryBuffer::getFile(...) Line 261
at c:\src\llvm-project\llvm\lib\support\memorybuffer.cpp(261)
liblldb.dll!lldb_private::FileSystem::CreateDataBuffer(...) Line 294
at c:\src\llvm-project\lldb\source\host\common\filesystem.cpp(294)
liblldb.dll!lldb_private::FileSystem::CreateDataBuffer(...) Line 310
at c:\src\llvm-project\lldb\source\host\common\filesystem.cpp(310)
liblldb.dll!lldb_private::SourceManager::File::CommonInitializer(...) Line 459
at c:\src\llvm-project\lldb\source\core\sourcemanager.cpp(459)
liblldb.dll!lldb_private::SourceManager::File::File(...) Line 397
at c:\src\llvm-project\lldb\source\core\sourcemanager.cpp(397)
```
...and that `shouldUseMmap` was returning `true` for large files, which resulted in a `MemoryBufferMMapFile`. I don't see any relevant changes on those files, so I don't know the where `openNativeFileInternal()` comes into the picture.
> Judging by this patch, that may no longer be necessary. Or does that only apply for certain situations (certain windows versions, files which are not large enough to be mmapped, etc.)?
LLDB used memory mapping for very large files. Maybe the test `main.cpp` doesn't satisfy the "memory-mapped file" criteria any more? I couldn't find an explanation based on Windows 10 vs. Windows 11 file system locking.
https://github.com/llvm/llvm-project/pull/111237
More information about the lldb-commits
mailing list