[Reproducers] Add file provider
authorJonas Devlieghere <jonas@devlieghere.com>
Tue, 29 Jan 2019 20:36:38 +0000 (20:36 +0000)
committerJonas Devlieghere <jonas@devlieghere.com>
Tue, 29 Jan 2019 20:36:38 +0000 (20:36 +0000)
commit46575176e9642e9f8567e75e05a98867396803cc
tree0572584914eb135af50920d5bb3a3faebb7e5911
parent6159e8693ea182078a509b197373fab2127ecd66
[Reproducers] Add file provider

This patch adds the file provider which is responsible for capturing
files used by LLDB.

When capturing a reproducer, we use a file collector that is very
similar to the one used in clang. For every file that we touch, we add
an entry with a mapping from its virtual to its real path. When we
decide to generate a reproducer we copy over the files and their
permission into to reproducer folder.

When replaying a reproducer, we load the VFS mapping and instantiate a
RedirectingFileSystem. The latter will transparently use the files
available in the reproducer.

I've tested this on two macOS machines with an artificial example.
Still, it is very likely that I missed some places where we (still) use
native file system calls. I'm hoping to flesh those out while testing
with more advanced examples. However, I will fix those things in
separate patches.

Differential revision: https://reviews.llvm.org/D54617

llvm-svn: 352538
15 files changed:
lldb/include/lldb/Host/FileSystem.h
lldb/include/lldb/Utility/FileCollector.h [new file with mode: 0644]
lldb/include/lldb/Utility/Reproducer.h
lldb/lit/Reproducer/Inputs/FileCapture.in [new file with mode: 0644]
lldb/lit/Reproducer/Inputs/FileReplay.in [new file with mode: 0644]
lldb/lit/Reproducer/TestFileRepro.test [new file with mode: 0644]
lldb/lit/Reproducer/TestGDBRemoteRepro.test
lldb/source/Host/common/FileSystem.cpp
lldb/source/Host/macosx/objcxx/Host.mm
lldb/source/Initialization/SystemInitializerCommon.cpp
lldb/source/Utility/CMakeLists.txt
lldb/source/Utility/FileCollector.cpp [new file with mode: 0644]
lldb/source/Utility/Reproducer.cpp
lldb/unittests/Utility/CMakeLists.txt
lldb/unittests/Utility/FileCollectorTest.cpp [new file with mode: 0644]