aboutsummaryrefslogtreecommitdiff
path: root/lldb/source/Host/common/FileSystem.cpp
diff options
context:
space:
mode:
authorJonas Devlieghere <jonas@devlieghere.com>2020-08-20 16:19:17 -0700
committerJonas Devlieghere <jonas@devlieghere.com>2020-08-20 18:08:59 -0700
commit73af341beb8435c7da1dd5e7a8abacb2de6a236d (patch)
tree57267efe91745a89b2c1976e81f09af4d9cb161d /lldb/source/Host/common/FileSystem.cpp
parentc90ca0c8e4956e051e2f29cff0c38f9f03b32f87 (diff)
downloadllvm-73af341beb8435c7da1dd5e7a8abacb2de6a236d.zip
llvm-73af341beb8435c7da1dd5e7a8abacb2de6a236d.tar.gz
llvm-73af341beb8435c7da1dd5e7a8abacb2de6a236d.tar.bz2
[lldb] Capture and load home directory from the reproducer.
When replaying the reproducer, lldb should source the .lldbinit file that was captured by the reproducer and not the one in the current home directory. This requires that we store the home directory as part of the reproducer. By returning the virtual home directory during replay, we ensure the correct virtual path gets constructed which the VFS can then find and remap to the correct file in the reproducer root. This patch adds a new HomeDirectoryProvider, similar to the existing WorkingDirectoryProvider. As the home directory is not part of the VFS, it is stored in LLDB's FileSystem instance.
Diffstat (limited to 'lldb/source/Host/common/FileSystem.cpp')
-rw-r--r--lldb/source/Host/common/FileSystem.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/lldb/source/Host/common/FileSystem.cpp b/lldb/source/Host/common/FileSystem.cpp
index d295c01..b8c962c 100644
--- a/lldb/source/Host/common/FileSystem.cpp
+++ b/lldb/source/Host/common/FileSystem.cpp
@@ -361,6 +361,10 @@ bool FileSystem::ResolveExecutableLocation(FileSpec &file_spec) {
}
bool FileSystem::GetHomeDirectory(SmallVectorImpl<char> &path) const {
+ if (!m_home_directory.empty()) {
+ path.assign(m_home_directory.begin(), m_home_directory.end());
+ return true;
+ }
return llvm::sys::path::home_directory(path);
}
@@ -507,3 +511,7 @@ void FileSystem::Collect(const llvm::Twine &file) {
else
m_collector->addFile(file);
}
+
+void FileSystem::SetHomeDirectory(std::string home_directory) {
+ m_home_directory = std::move(home_directory);
+}