Index: lldb/include/lldb/Host/FileSystem.h =================================================================== --- lldb/include/lldb/Host/FileSystem.h +++ lldb/include/lldb/Host/FileSystem.h @@ -33,11 +33,10 @@ FileSystem() : m_fs(llvm::vfs::getRealFileSystem()), m_collector(nullptr) {} FileSystem(std::shared_ptr collector) - : m_fs(llvm::vfs::getRealFileSystem()), m_collector(std::move(collector)), - m_mapped(false) {} - FileSystem(llvm::IntrusiveRefCntPtr fs, - bool mapped = false) - : m_fs(std::move(fs)), m_collector(nullptr), m_mapped(mapped) {} + : m_fs(llvm::vfs::getRealFileSystem()), + m_collector(std::move(collector)) {} + FileSystem(llvm::IntrusiveRefCntPtr fs) + : m_fs(std::move(fs)), m_collector(nullptr) {} FileSystem(const FileSystem &fs) = delete; FileSystem &operator=(const FileSystem &fs) = delete; @@ -46,7 +45,6 @@ static void Initialize(); static void Initialize(std::shared_ptr collector); - static llvm::Error Initialize(const FileSpec &mapping); static void Initialize(llvm::IntrusiveRefCntPtr fs); static void Terminate(); @@ -189,9 +187,6 @@ std::error_code GetRealPath(const llvm::Twine &path, llvm::SmallVectorImpl &output) const; - llvm::ErrorOr GetExternalPath(const llvm::Twine &path); - llvm::ErrorOr GetExternalPath(const FileSpec &file_spec); - llvm::IntrusiveRefCntPtr GetVirtualFileSystem() { return m_fs; } @@ -206,7 +201,6 @@ llvm::IntrusiveRefCntPtr m_fs; std::shared_ptr m_collector; std::string m_home_directory; - bool m_mapped = false; }; } // namespace lldb_private Index: lldb/source/Host/common/FileSystem.cpp =================================================================== --- lldb/source/Host/common/FileSystem.cpp +++ lldb/source/Host/common/FileSystem.cpp @@ -54,22 +54,6 @@ InstanceImpl().emplace(collector); } -llvm::Error FileSystem::Initialize(const FileSpec &mapping) { - lldbassert(!InstanceImpl() && "Already initialized."); - - llvm::ErrorOr> buffer = - llvm::vfs::getRealFileSystem()->getBufferForFile(mapping.GetPath()); - - if (!buffer) - return llvm::errorCodeToError(buffer.getError()); - - InstanceImpl().emplace(llvm::vfs::getVFSFromYAML(std::move(buffer.get()), - nullptr, mapping.GetPath()), - true); - - return llvm::Error::success(); -} - void FileSystem::Initialize(IntrusiveRefCntPtr fs) { lldbassert(!InstanceImpl() && "Already initialized."); InstanceImpl().emplace(fs); @@ -300,21 +284,16 @@ Collect(path); const bool is_volatile = !IsLocal(path); - const ErrorOr external_path = GetExternalPath(path); - - if (!external_path) - return nullptr; - std::unique_ptr buffer; if (size == 0) { auto buffer_or_error = - llvm::WritableMemoryBuffer::getFile(*external_path, is_volatile); + llvm::WritableMemoryBuffer::getFile(path, is_volatile); if (!buffer_or_error) return nullptr; buffer = std::move(*buffer_or_error); } else { auto buffer_or_error = llvm::WritableMemoryBuffer::getFileSlice( - *external_path, size, offset, is_volatile); + path, size, offset, is_volatile); if (!buffer_or_error) return nullptr; buffer = std::move(*buffer_or_error); @@ -457,12 +436,10 @@ const mode_t open_mode = (open_flags & O_CREAT) ? GetOpenMode(permissions) : 0; - auto path = GetExternalPath(file_spec); - if (!path) - return errorCodeToError(path.getError()); + auto path = file_spec.GetPath(); int descriptor = llvm::sys::RetryAfterSignal( - -1, OpenWithFS, *this, path->c_str(), open_flags, open_mode); + -1, OpenWithFS, *this, path.c_str(), open_flags, open_mode); if (!File::DescriptorIsValid(descriptor)) return llvm::errorCodeToError( @@ -474,29 +451,6 @@ return std::move(file); } -ErrorOr FileSystem::GetExternalPath(const llvm::Twine &path) { - if (!m_mapped) - return path.str(); - - // If VFS mapped we know the underlying FS is a RedirectingFileSystem. - ErrorOr Result = - static_cast(*m_fs).lookupPath(path.str()); - if (!Result) { - if (Result.getError() == llvm::errc::no_such_file_or_directory) { - return path.str(); - } - return Result.getError(); - } - - if (Optional ExtRedirect = Result->getExternalRedirect()) - return std::string(*ExtRedirect); - return make_error_code(llvm::errc::not_supported); -} - -ErrorOr FileSystem::GetExternalPath(const FileSpec &file_spec) { - return GetExternalPath(file_spec.GetPath()); -} - void FileSystem::Collect(const FileSpec &file_spec) { Collect(file_spec.GetPath()); } Index: lldb/source/Host/macosx/objcxx/Host.mm =================================================================== --- lldb/source/Host/macosx/objcxx/Host.mm +++ lldb/source/Host/macosx/objcxx/Host.mm @@ -1305,15 +1305,12 @@ lldb::pid_t pid = LLDB_INVALID_PROCESS_ID; - // From now on we'll deal with the external (devirtualized) path. - auto exe_path = fs.GetExternalPath(exe_spec); - if (!exe_path) - return Status(exe_path.getError()); + auto exe_path = exe_spec.GetPath(); if (ShouldLaunchUsingXPC(launch_info)) - error = LaunchProcessXPC(exe_path->c_str(), launch_info, pid); + error = LaunchProcessXPC(exe_path.c_str(), launch_info, pid); else - error = LaunchProcessPosixSpawn(exe_path->c_str(), launch_info, pid); + error = LaunchProcessPosixSpawn(exe_path.c_str(), launch_info, pid); if (pid != LLDB_INVALID_PROCESS_ID) { // If all went well, then set the process ID into the launch info Index: lldb/source/Initialization/SystemInitializerCommon.cpp =================================================================== --- lldb/source/Initialization/SystemInitializerCommon.cpp +++ lldb/source/Initialization/SystemInitializerCommon.cpp @@ -43,36 +43,6 @@ /// Initialize the FileSystem based on the current reproducer mode. static llvm::Error InitializeFileSystem() { auto &r = repro::Reproducer::Instance(); - if (repro::Loader *loader = r.GetLoader()) { - FileSpec vfs_mapping = loader->GetFile(); - if (vfs_mapping) { - if (llvm::Error e = FileSystem::Initialize(vfs_mapping)) - return e; - } else { - FileSystem::Initialize(); - } - - // Set the current working directory form the reproducer. - llvm::Expected working_dir = - repro::GetDirectoryFrom(loader); - if (!working_dir) - return working_dir.takeError(); - if (std::error_code ec = FileSystem::Instance() - .GetVirtualFileSystem() - ->setCurrentWorkingDirectory(*working_dir)) { - return llvm::errorCodeToError(ec); - } - - // Set the home directory from the reproducer. - llvm::Expected home_dir = - repro::GetDirectoryFrom(loader); - if (!home_dir) - return home_dir.takeError(); - FileSystem::Instance().SetHomeDirectory(*home_dir); - - return llvm::Error::success(); - } - if (repro::Generator *g = r.GetGenerator()) { repro::VersionProvider &vp = g->GetOrCreate(); vp.SetVersion(lldb_private::GetVersion());