LLDB mainline
Public Types | Public Member Functions | Static Public Member Functions | Static Public Attributes | Static Private Member Functions | Private Attributes | List of all members
lldb_private::FileSystem Class Reference

#include <FileSystem.h>

Public Types

enum  EnumerateDirectoryResult { eEnumerateDirectoryResultNext , eEnumerateDirectoryResultEnter , eEnumerateDirectoryResultQuit }
 
typedef EnumerateDirectoryResult(* EnumerateDirectoryCallbackType) (void *baton, llvm::sys::fs::file_type file_type, llvm::StringRef)
 
typedef std::function< EnumerateDirectoryResult(llvm::sys::fs::file_type file_type, llvm::StringRef)> DirectoryCallback
 

Public Member Functions

 FileSystem ()
 
 FileSystem (llvm::IntrusiveRefCntPtr< llvm::vfs::FileSystem > fs)
 
 FileSystem (std::unique_ptr< TildeExpressionResolver > tilde_resolver)
 
 FileSystem (const FileSystem &fs)=delete
 
FileSystemoperator= (const FileSystem &fs)=delete
 
Status Symlink (const FileSpec &src, const FileSpec &dst)
 
Status Readlink (const FileSpec &src, FileSpec &dst)
 
Status ResolveSymbolicLink (const FileSpec &src, FileSpec &dst)
 
FILE * Fopen (const char *path, const char *mode)
 Wraps ::fopen in a platform-independent way.
 
int Open (const char *path, int flags, int mode=0600)
 Wraps ::open in a platform-independent way.
 
llvm::Expected< std::unique_ptr< File > > Open (const FileSpec &file_spec, File::OpenOptions options, uint32_t permissions=lldb::eFilePermissionsFileDefault, bool should_close_fd=true)
 
bool ResolveExecutableLocation (FileSpec &file_spec)
 Call into the Host to see if it can help find the file.
 
bool GetHomeDirectory (llvm::SmallVectorImpl< char > &path) const
 Get the user home directory.
 
bool GetHomeDirectory (FileSpec &file_spec) const
 
void EnumerateDirectory (llvm::Twine path, bool find_directories, bool find_files, bool find_other, EnumerateDirectoryCallbackType callback, void *callback_baton)
 
std::error_code GetRealPath (const llvm::Twine &path, llvm::SmallVectorImpl< char > &output) const
 
llvm::IntrusiveRefCntPtr< llvm::vfs::FileSystem > GetVirtualFileSystem ()
 
void SetHomeDirectory (std::string home_directory)
 
llvm::vfs::directory_iterator DirBegin (const FileSpec &file_spec, std::error_code &ec)
 Get a directory iterator.
 
llvm::vfs::directory_iterator DirBegin (const llvm::Twine &dir, std::error_code &ec)
 
llvm::ErrorOr< llvm::vfs::Status > GetStatus (const FileSpec &file_spec) const
 Returns the Status object for the given file.
 
llvm::ErrorOr< llvm::vfs::Status > GetStatus (const llvm::Twine &path) const
 
llvm::sys::TimePoint GetModificationTime (const FileSpec &file_spec) const
 Returns the modification time of the given file.
 
llvm::sys::TimePoint GetModificationTime (const llvm::Twine &path) const
 
uint64_t GetByteSize (const FileSpec &file_spec) const
 Returns the on-disk size of the given file in bytes.
 
uint64_t GetByteSize (const llvm::Twine &path) const
 
uint32_t GetPermissions (const FileSpec &file_spec) const
 Return the current permissions of the given file.
 
uint32_t GetPermissions (const llvm::Twine &path) const
 
uint32_t GetPermissions (const FileSpec &file_spec, std::error_code &ec) const
 
uint32_t GetPermissions (const llvm::Twine &path, std::error_code &ec) const
 
bool Exists (const FileSpec &file_spec) const
 Returns whether the given file exists.
 
bool Exists (const llvm::Twine &path) const
 
bool Readable (const FileSpec &file_spec) const
 Returns whether the given file is readable.
 
bool Readable (const llvm::Twine &path) const
 
bool IsDirectory (const FileSpec &file_spec) const
 Returns whether the given path is a directory.
 
bool IsDirectory (const llvm::Twine &path) const
 
bool IsLocal (const FileSpec &file_spec) const
 Returns whether the given path is local to the file system.
 
bool IsLocal (const llvm::Twine &path) const
 
std::error_code MakeAbsolute (llvm::SmallVectorImpl< char > &path) const
 Make the given file path absolute.
 
std::error_code MakeAbsolute (FileSpec &file_spec) const
 
void Resolve (llvm::SmallVectorImpl< char > &path)
 Resolve path to make it canonical.
 
void Resolve (FileSpec &file_spec)
 
Status RemoveFile (const FileSpec &file_spec)
 Remove a single file.
 
Status RemoveFile (const llvm::Twine &path)
 
std::shared_ptr< DataBufferCreateDataBuffer (const llvm::Twine &path, uint64_t size=0, uint64_t offset=0)
 Create memory buffer from path.
 
std::shared_ptr< DataBufferCreateDataBuffer (const FileSpec &file_spec, uint64_t size=0, uint64_t offset=0)
 
std::shared_ptr< WritableDataBufferCreateWritableDataBuffer (const llvm::Twine &path, uint64_t size=0, uint64_t offset=0)
 
std::shared_ptr< WritableDataBufferCreateWritableDataBuffer (const FileSpec &file_spec, uint64_t size=0, uint64_t offset=0)
 

Static Public Member Functions

static FileSystemInstance ()
 
template<class... T>
static void Initialize (T &&...t)
 
static void Terminate ()
 

Static Public Attributes

static const char * DEV_NULL = "/dev/null"
 
static const char * PATH_CONVERSION_ERROR
 

Static Private Member Functions

static std::optional< FileSystem > & InstanceImpl ()
 

Private Attributes

llvm::IntrusiveRefCntPtr< llvm::vfs::FileSystem > m_fs
 
std::unique_ptr< TildeExpressionResolverm_tilde_resolver
 
std::string m_home_directory
 

Detailed Description

Definition at line 30 of file FileSystem.h.

Member Typedef Documentation

◆ DirectoryCallback

typedef std::function<EnumerateDirectoryResult( llvm::sys::fs::file_type file_type, llvm::StringRef)> lldb_private::FileSystem::DirectoryCallback

Definition at line 191 of file FileSystem.h.

◆ EnumerateDirectoryCallbackType

typedef EnumerateDirectoryResult(* lldb_private::FileSystem::EnumerateDirectoryCallbackType) (void *baton, llvm::sys::fs::file_type file_type, llvm::StringRef)

Definition at line 186 of file FileSystem.h.

Member Enumeration Documentation

◆ EnumerateDirectoryResult

Enumerator
eEnumerateDirectoryResultNext 

Enumerate next entry in the current directory.

eEnumerateDirectoryResultEnter 

Recurse into the current entry if it is a directory or symlink, or next if not.

eEnumerateDirectoryResultQuit 

Stop directory enumerations at any level.

Definition at line 176 of file FileSystem.h.

Constructor & Destructor Documentation

◆ FileSystem() [1/4]

lldb_private::FileSystem::FileSystem ( )
inline

Definition at line 35 of file FileSystem.h.

◆ FileSystem() [2/4]

lldb_private::FileSystem::FileSystem ( llvm::IntrusiveRefCntPtr< llvm::vfs::FileSystem >  fs)
inline

Definition at line 38 of file FileSystem.h.

◆ FileSystem() [3/4]

lldb_private::FileSystem::FileSystem ( std::unique_ptr< TildeExpressionResolver tilde_resolver)
inline

Definition at line 41 of file FileSystem.h.

◆ FileSystem() [4/4]

lldb_private::FileSystem::FileSystem ( const FileSystem fs)
delete

Member Function Documentation

◆ CreateDataBuffer() [1/2]

std::shared_ptr< DataBuffer > FileSystem::CreateDataBuffer ( const FileSpec file_spec,
uint64_t  size = 0,
uint64_t  offset = 0 
)

Definition at line 313 of file common/FileSystem.cpp.

References CreateDataBuffer(), and lldb_private::FileSpec::GetPath().

◆ CreateDataBuffer() [2/2]

std::shared_ptr< DataBuffer > FileSystem::CreateDataBuffer ( const llvm::Twine &  path,
uint64_t  size = 0,
uint64_t  offset = 0 
)

◆ CreateWritableDataBuffer() [1/2]

std::shared_ptr< WritableDataBuffer > FileSystem::CreateWritableDataBuffer ( const FileSpec file_spec,
uint64_t  size = 0,
uint64_t  offset = 0 
)

◆ CreateWritableDataBuffer() [2/2]

std::shared_ptr< WritableDataBuffer > FileSystem::CreateWritableDataBuffer ( const llvm::Twine &  path,
uint64_t  size = 0,
uint64_t  offset = 0 
)

◆ DirBegin() [1/2]

vfs::directory_iterator FileSystem::DirBegin ( const FileSpec file_spec,
std::error_code &  ec 
)

Get a directory iterator.

Definition at line 57 of file common/FileSystem.cpp.

References DirBegin(), and lldb_private::FileSpec::GetPath().

Referenced by DirBegin(), and DiskFilesOrDirectories().

◆ DirBegin() [2/2]

llvm::vfs::directory_iterator lldb_private::FileSystem::DirBegin ( const llvm::Twine &  dir,
std::error_code &  ec 
)

◆ EnumerateDirectory()

void FileSystem::EnumerateDirectory ( llvm::Twine  path,
bool  find_directories,
bool  find_files,
bool  find_other,
EnumerateDirectoryCallbackType  callback,
void *  callback_baton 
)

◆ Exists() [1/2]

bool FileSystem::Exists ( const FileSpec file_spec) const

Returns whether the given file exists.

Definition at line 139 of file common/FileSystem.cpp.

References Exists(), and lldb_private::FileSpec::GetPath().

Referenced by lldb_private::process_gdb_remote::ProcessGDBRemote::CanDebug(), lldb_private::ProcessWindows::CanDebug(), lldb_private::TargetProperties::CheckJITObjectsDir(), lldb_private::HostInfoLinux::ComputeSupportExeDirectory(), lldb_private::HostInfoAndroid::ComputeTempFileBaseDirectory(), lldb_private::TargetList::CreateTargetInternal(), CommandObjectTargetSymbolsAdd::DoExecute(), CommandObjectTargetCreate::DoExecute(), lldb::SBFileSpec::Exists(), Exists(), lldb_private::ObjectFile::FindPlugin(), lldb_private::plugin::dwarf::SymbolFileDWARF::GetDwoSymbolFileForCompileUnit(), lldb_private::Platform::GetFileExists(), lldb_private::plugin::dwarf::SymbolFileDWARFDebugMap::GetModuleByCompUnitInfo(), lldb::SBDebugger::InitializeWithErrorHandling(), lldb_private::MonitoringProcessLauncher::LaunchProcess(), lldb_private::DynamicLoader::LoadBinaryWithUUIDAndAddress(), lldb_private::PlatformDarwin::LocateExecutable(), lldb_private::SymbolLocatorDebugSymbols::LocateExecutableObjectFile(), lldb_private::PlatformDarwin::LocateExecutableScriptingResources(), lldb_private::SymbolLocatorDefault::LocateExecutableSymbolFile(), LocateMacOSXFilesUsingDebugSymbols(), lldb_private::DataFileCache::RemoveCacheFile(), Resolve(), ResolveExecutableLocation(), lldb_private::process_gdb_remote::GDBRemoteCommunication::StartDebugserverProcess(), and VerifyPathExists().

◆ Exists() [2/2]

bool lldb_private::FileSystem::Exists ( const llvm::Twine &  path) const

◆ Fopen()

FILE * FileSystem::Fopen ( const char *  path,
const char *  mode 
)

Wraps ::fopen in a platform-independent way.

Definition at line 75 of file FileSystemPosix.cpp.

Referenced by lldb_private::Instruction::TestEmulation().

◆ GetByteSize() [1/2]

uint64_t FileSystem::GetByteSize ( const FileSpec file_spec) const

◆ GetByteSize() [2/2]

uint64_t lldb_private::FileSystem::GetByteSize ( const llvm::Twine &  path) const

◆ GetHomeDirectory() [1/2]

bool FileSystem::GetHomeDirectory ( FileSpec file_spec) const

Definition at line 359 of file common/FileSystem.cpp.

References GetHomeDirectory(), and lldb_private::FileSpec::SetPath().

◆ GetHomeDirectory() [2/2]

bool FileSystem::GetHomeDirectory ( llvm::SmallVectorImpl< char > &  path) const

◆ GetModificationTime() [1/2]

sys::TimePoint FileSystem::GetModificationTime ( const FileSpec file_spec) const

◆ GetModificationTime() [2/2]

llvm::sys::TimePoint lldb_private::FileSystem::GetModificationTime ( const llvm::Twine &  path) const

◆ GetPermissions() [1/4]

uint32_t FileSystem::GetPermissions ( const FileSpec file_spec) const

Return the current permissions of the given file.

Returns a bitmask for the current permissions of the file (zero or more of the permission bits defined in File::Permissions).

Definition at line 111 of file common/FileSystem.cpp.

References lldb_private::FileSpec::GetPath(), and GetPermissions().

Referenced by GetPermissions(), lldb_private::process_gdb_remote::GDBRemoteCommunicationServerCommon::Handle_vFile_Mode(), lldb_private::Platform::Install(), and lldb_private::RemoteAwarePlatform::ResolveExecutable().

◆ GetPermissions() [2/4]

uint32_t FileSystem::GetPermissions ( const FileSpec file_spec,
std::error_code &  ec 
) const

Definition at line 115 of file common/FileSystem.cpp.

References lldb_private::FileSpec::GetPath(), and GetPermissions().

◆ GetPermissions() [3/4]

uint32_t lldb_private::FileSystem::GetPermissions ( const llvm::Twine &  path) const

◆ GetPermissions() [4/4]

uint32_t lldb_private::FileSystem::GetPermissions ( const llvm::Twine &  path,
std::error_code &  ec 
) const

◆ GetRealPath()

std::error_code FileSystem::GetRealPath ( const llvm::Twine &  path,
llvm::SmallVectorImpl< char > &  output 
) const

Definition at line 219 of file common/FileSystem.cpp.

References m_fs.

◆ GetStatus() [1/2]

llvm::ErrorOr< vfs::Status > FileSystem::GetStatus ( const FileSpec file_spec) const

Returns the Status object for the given file.

Definition at line 73 of file common/FileSystem.cpp.

References lldb_private::FileSpec::GetPath(), and GetStatus().

Referenced by DiskFilesOrDirectories(), and GetStatus().

◆ GetStatus() [2/2]

llvm::ErrorOr< llvm::vfs::Status > lldb_private::FileSystem::GetStatus ( const llvm::Twine &  path) const

◆ GetVirtualFileSystem()

llvm::IntrusiveRefCntPtr< llvm::vfs::FileSystem > lldb_private::FileSystem::GetVirtualFileSystem ( )
inline

Definition at line 201 of file FileSystem.h.

References m_fs.

Referenced by lldb_private::SymbolLocatorDebugSymbols::FindSymbolFileInBundle().

◆ Initialize()

template<class... T>
static void lldb_private::FileSystem::Initialize ( T &&...  t)
inlinestatic

Definition at line 50 of file FileSystem.h.

References InstanceImpl(), and lldbassert.

Referenced by lldb_private::SystemInitializerCommon::Initialize().

◆ Instance()

FileSystem & FileSystem::Instance ( )
static

Definition at line 45 of file common/FileSystem.cpp.

References InstanceImpl().

Referenced by lldb_private::PlatformDarwin::AddClangModuleCompilationOptionsForSDKType(), lldb::SBTarget::AddModule(), lldb_private::process_gdb_remote::ProcessGDBRemote::BuildDynamicRegisterInfo(), lldb_private::NativeProcessWindows::CacheLoadedModules(), lldb_private::CacheSignature::CacheSignature(), lldb_private::Platform::CallLocateModuleCallbackIfSet(), ProcessElfCore::CanDebug(), lldb_private::process_gdb_remote::ProcessGDBRemote::CanDebug(), ProcessMachCore::CanDebug(), lldb_private::ProcessWindows::CanDebug(), lldb_private::TargetProperties::CheckJITObjectsDir(), lldb_private::ClangExpressionParser::ClangExpressionParser(), lldb_private::SourceManager::File::CommonInitializer(), lldb_private::ComputeClangResourceDirectory(), lldb_private::HostInfoLinux::ComputeSupportExeDirectory(), lldb_private::HostInfoMacOSX::ComputeSupportExeDirectory(), lldb_private::HostInfoLinux::ComputeSystemPluginsDirectory(), lldb_private::HostInfoAndroid::ComputeTempFileBaseDirectory(), lldb_private::HostInfoBase::ComputeTempFileBaseDirectory(), lldb_private::HostInfoMacOSX::ComputeUserPluginsDirectory(), lldb_private::ConnectionFileDescriptor::ConnectFile(), lldb_private::ConnectionFileDescriptor::ConnectSerialPort(), lldb_private::ScriptInterpreterIORedirect::Create(), lldb_private::ClangModulesDeclVendor::Create(), lldb_private::TypeSystemClang::CreateASTContext(), ObjectContainerBSDArchive::CreateInstance(), SymbolVendorELF::CreateInstance(), SymbolVendorMacOSX::CreateInstance(), SymbolVendorPECOFF::CreateInstance(), lldb_private::wasm::SymbolVendorWasm::CreateInstance(), ProcessMachCore::CreateInstance(), lldb_private::minidump::ProcessMinidump::CreateInstance(), ProcessElfCore::CreateInstance(), lldb_private::Platform::CreateSymlink(), lldb_private::TargetList::CreateTargetInternal(), lldb_private::PlatformQemuUser::DebugProcess(), DefaultComputeClangResourceDirectory(), DiskFilesOrDirectories(), ProcessKDP::DoConnectRemote(), CommandObjectLogDump::DoExecute(), CommandObjectPlatformInstall::DoExecute(), CommandObjectSettingsWrite::DoExecute(), CommandObjectTargetModulesAdd::DoExecute(), CommandObjectTargetSymbolsAdd::DoExecute(), CommandObjectBreakpointRead::DoExecute(), CommandObjectBreakpointWrite::DoExecute(), CommandObjectCommandsSource::DoExecute(), CommandObjectMemoryRead::DoExecute(), CommandObjectMemoryWrite::DoExecute(), CommandObjectPluginLoad::DoExecute(), CommandObjectProcessLoad::DoExecute(), CommandObjectProcessSaveCore::DoExecute(), CommandObjectSettingsRead::DoExecute(), CommandObjectTargetCreate::DoExecute(), CommandObjectTargetModulesDumpClangPCMInfo::DoExecute(), CommandObjectTraceSave::DoExecute(), lldb_private::SymbolLocatorDebugSymbols::DownloadObjectAndSymbolFile(), lldb::DumpProcessGDBRemotePacketHistory(), DupDescriptor(), lldb_private::Debugger::EnableLog(), lldb::SBFileSpec::Exists(), lldb_private::Module::FileHasChanged(), lldb_private::PlatformDarwin::FindBundleBinaryInExecSearchPaths(), lldb_private::process_gdb_remote::GDBRemoteCommunicationServerCommon::FindModuleFile(), lldb_private::process_gdb_remote::GDBRemoteCommunicationServerLLGS::FindModuleFile(), lldb_private::ObjectFile::FindPlugin(), lldb_private::SymbolVendor::FindPlugin(), lldb_private::PlatformDarwin::FindSDKInXcodeForModules(), lldb_private::SymbolLocatorDebugSymbols::FindSymbolFileInBundle(), lldb_private::DynamicLoaderDarwin::FindTargetModuleForImageInfo(), lldb_private::ModuleCache::Get(), GetCommandLineToolsLibraryPath(), lldb_private::PlatformAppleSimulator::GetCoreSimulatorPath(), GetCwdInitFile(), ObjectFileMachO::GetDependentModules(), GetDsymForUUIDExecutable(), lldb_private::plugin::dwarf::SymbolFileDWARF::GetDwoSymbolFileForCompileUnit(), lldb_private::plugin::dwarf::SymbolFileDWARF::GetDwpSymbolFile(), GetELFProcessCPUType(), GetEnvDeveloperDir(), lldb_private::SourceManager::GetFile(), lldb_private::OptionValueFileSpec::GetFileContents(), lldb_private::Platform::GetFileExists(), lldb_private::PlatformRemoteDarwinDevice::GetFileInSDK(), lldb_private::NativeProcessWindows::GetFileLoadAddress(), lldb_private::line_editor::EditlineHistory::GetHistoryFilePath(), GetHomeREPLInitFile(), lldb_private::process_freebsd::NativeProcessFreeBSD::GetLoadedModuleFileSpec(), lldb_private::process_linux::NativeProcessLinux::GetLoadedModuleFileSpec(), lldb_private::process_netbsd::NativeProcessNetBSD::GetLoadedModuleFileSpec(), lldb_private::NativeProcessWindows::GetLoadedModuleFileSpec(), lldb_private::plugin::dwarf::SymbolFileDWARFDebugMap::GetModuleByCompUnitInfo(), lldb_private::Host::GetModuleFileSpecForHostAddress(), lldb_private::process_gdb_remote::GDBRemoteCommunicationServerCommon::GetModuleInfo(), lldb::SBModuleSpecList::GetModuleSpecifications(), lldb_private::ObjectFile::GetModuleSpecifications(), ObjectContainerBSDArchive::GetModuleSpecifications(), GetModuleSpecInfoFromUUIDDictionary(), GetNetBSDProcessCPUType(), lldb_private::Module::GetObjectFile(), ObjectContainerBSDArchive::GetObjectFile(), lldb_private::PlatformMacOSX::GetSDKDirectory(), lldb_private::PlatformDarwin::GetSDKDirectoryForModules(), lldb_private::ModuleList::GetSharedModule(), lldb_private::PlatformDarwin::GetSharedModule(), lldb_private::PlatformDarwinDevice::GetSharedModuleWithLocalCache(), lldb_private::PlatformAppleSimulator::GetSymbolFile(), lldb_private::PlatformRemoteDarwinDevice::GetSymbolFile(), lldb_private::DynamicLoader::GetTargetExecutable(), DynamicLoaderHexagonDYLD::GetTargetExecutable(), GetTripleForProcess(), lldb::SBHostOS::GetUserHomeDirectory(), lldb_private::Platform::GetWorkingDirectory(), lldb_private::HostInfoMacOSX::GetXcodeContentsDirectory(), lldb_private::HostInfoMacOSX::GetXcodeDeveloperDirectory(), GetXcodeSDK(), GetXcodeSelectPath(), lldb_private::process_gdb_remote::GDBRemoteCommunicationServerCommon::Handle_qPlatform_shell(), lldb_private::process_gdb_remote::GDBRemoteCommunicationServerCommon::Handle_vFile_Mode(), lldb_private::process_gdb_remote::GDBRemoteCommunicationServerCommon::Handle_vFile_Open(), lldb_private::process_gdb_remote::GDBRemoteCommunicationServerCommon::Handle_vFile_symlink(), lldb_private::CommandInterpreter::HandleCommandsFromFile(), CommandObjectBreakpointRead::CommandOptions::HandleOptionArgumentCompletion(), lldb_private::CppModuleConfiguration::hasValidConfig(), lldb_private::ClangHighlighter::Highlight(), lldb_private::PluginManager::Initialize(), lldb::SBDebugger::InitializeWithErrorHandling(), lldb_private::Platform::Install(), lldb_private::Debugger::InstanceInitialize(), lldb_private::platform_android::AdbClient::SyncService::internalPushFile(), lldb_private::REPL::IOHandlerInputComplete(), lldb_private::Process::LaunchPrivate(), lldb_private::MonitoringProcessLauncher::LaunchProcess(), lldb_private::ProcessDebugger::LaunchProcess(), lldb_private::DynamicLoader::LoadBinaryWithUUIDAndAddress(), lldb::SBTarget::LoadCore(), DynamicLoaderDarwinKernel::KextImageInfo::LoadImageUsingMemoryModule(), DynamicLoaderFreeBSDKernel::KModImageInfo::LoadImageUsingMemoryModule(), loadMatchingPDBFile(), lldb_private::Lua::LoadModule(), lldb_private::process_gdb_remote::ProcessGDBRemote::LoadModules(), LoadPluginCallback(), lldb_private::Module::LoadScriptingResourceInTarget(), lldb_private::PlatformDarwin::LocateExecutable(), lldb_private::SymbolLocatorDebugSymbols::LocateExecutableObjectFile(), lldb_private::PlatformDarwin::LocateExecutableScriptingResources(), lldb_private::SymbolLocatorDefault::LocateExecutableSymbolFile(), LocateMacOSXFilesUsingDebugSymbols(), LookForDsymNextToExecutablePath(), lldb_private::ObjectFile::MapFileData(), ObjectFileELF::MapFileDataWritable(), lldb_private::SourceManager::File::ModificationTimeIsStale(), lldb_private::Module::Module(), lldb_private::ModuleSpec::ModuleSpec(), lldb_private::ProcessWindows::OnDebuggerConnected(), lldb_private::PipePosix::OpenAsReader(), lldb_private::FileCache::OpenFile(), lldb_private::PseudoTerminal::OpenSecondary(), ObjectFileELF::ParseDependentModules(), DynamicLoaderMacOSXDYLD::ParseLoadCommands(), ObjectFileMachO::ParseSymtab(), lldb_private::PlatformProperties::PlatformProperties(), lldb_private::process_linux::NativeProcessLinux::PopulateMemoryRegionCache(), lldb_private::Property::Property(), lldb_private::Platform::PutFile(), ReadCode(), RecurseCopy_Callback(), lldb::SBStream::RedirectToFile(), DynamicLoaderHexagonDYLD::RefreshModules(), lldb_private::PathMappingList::RemapPath(), lldb_private::DataFileCache::RemoveCacheFile(), resolve_tilde(), lldb_private::Platform::ResolveExecutable(), lldb_private::RemoteAwarePlatform::ResolveExecutable(), lldb_private::PlatformAppleSimulator::ResolveExecutable(), lldb_private::PlatformRemoteDarwinDevice::ResolveExecutable(), lldb::SBFileSpec::ResolveExecutableLocation(), lldb_private::HostInfoAndroid::ResolveLibraryPath(), lldb::SBFileSpec::ResolvePath(), lldb_private::Platform::ResolveRemoteExecutable(), lldb_private::Platform::ResolveRemotePath(), lldb_private::ZipFileResolver::ResolveSharedLibraryPath(), lldb_private::Platform::ResolveSymbolFile(), lldb_private::PlatformDarwin::ResolveSymbolFile(), lldb_private::Host::RunShellCommand(), lldb::SBProcess::SaveCore(), ObjectFileMachO::SaveCore(), ObjectFileMinidump::SaveCore(), lldb_private::trace_intel_pt::TraceIntelPTBundleSaver::SaveToDisk(), lldb_private::CommandInterpreter::SaveTranscript(), lldb::SBFileSpec::SBFileSpec(), lldb_private::SourceManager::File::SetFileSpec(), lldb_private::Module::SetFileSpecAndObjectName(), CommandObjectLogEnable::CommandOptions::SetOptionValue(), CommandObjectLogDump::CommandOptions::SetOptionValue(), CommandObjectMemoryWrite::OptionGroupWriteMemory::SetOptionValue(), lldb_private::ProcessLaunchInfo::SetShell(), lldb_private::Module::SetSymbolFileFileSpec(), lldb_private::OptionValueFileSpec::SetValueFromString(), lldb_private::CommandInterpreter::SourceInitFile(), lldb_private::CommandInterpreter::SourceInitFileCwd(), lldb_private::CommandInterpreter::SourceInitFileHome(), lldb_private::ObjectFile::SplitArchivePathWithObject(), lldb_private::process_gdb_remote::GDBRemoteCommunication::StartDebugserverProcess(), lldb_private::StreamFile::StreamFile(), lldb_private::Instruction::TestEmulation(), lldb_private::plugin::dwarf::SymbolFileDWARF::UpdateExternalModuleListIfNeeded(), lldb_private::PlatformDarwinDevice::UpdateSDKDirectoryInfosIfNeeded(), lldb_private::ModuleListProperties::UpdateSymlinkMappings(), VerifyClangPath(), and VerifyPathExists().

◆ InstanceImpl()

std::optional< FileSystem > & FileSystem::InstanceImpl ( )
staticprivate

Definition at line 52 of file common/FileSystem.cpp.

Referenced by Initialize(), Instance(), and Terminate().

◆ IsDirectory() [1/2]

bool FileSystem::IsDirectory ( const FileSpec file_spec) const

Returns whether the given path is a directory.

Definition at line 158 of file common/FileSystem.cpp.

References lldb_private::FileSpec::GetPath(), and IsDirectory().

Referenced by lldb_private::TargetProperties::CheckJITObjectsDir(), DiskFilesOrDirectories(), and IsDirectory().

◆ IsDirectory() [2/2]

bool lldb_private::FileSystem::IsDirectory ( const llvm::Twine &  path) const

◆ IsLocal() [1/2]

bool FileSystem::IsLocal ( const FileSpec file_spec) const

Returns whether the given path is local to the file system.

Definition at line 168 of file common/FileSystem.cpp.

References lldb_private::FileSpec::GetPath(), and IsLocal().

Referenced by CreateDataBuffer(), CreateWritableDataBuffer(), and IsLocal().

◆ IsLocal() [2/2]

bool lldb_private::FileSystem::IsLocal ( const llvm::Twine &  path) const

◆ MakeAbsolute() [1/2]

std::error_code FileSystem::MakeAbsolute ( FileSpec file_spec) const

◆ MakeAbsolute() [2/2]

std::error_code FileSystem::MakeAbsolute ( llvm::SmallVectorImpl< char > &  path) const

Make the given file path absolute.

Definition at line 202 of file common/FileSystem.cpp.

References m_fs.

Referenced by MakeAbsolute(), and Resolve().

◆ Open() [1/2]

int FileSystem::Open ( const char *  path,
int  flags,
int  mode = 0600 
)

◆ Open() [2/2]

Expected< FileUP > FileSystem::Open ( const FileSpec file_spec,
File::OpenOptions  options,
uint32_t  permissions = lldb::eFilePermissionsFileDefault,
bool  should_close_fd = true 
)

◆ operator=()

FileSystem & lldb_private::FileSystem::operator= ( const FileSystem fs)
delete

◆ Readable() [1/2]

bool FileSystem::Readable ( const FileSpec file_spec) const

Returns whether the given file is readable.

Definition at line 147 of file common/FileSystem.cpp.

References lldb_private::FileSpec::GetPath(), and Readable().

Referenced by Readable().

◆ Readable() [2/2]

bool lldb_private::FileSystem::Readable ( const llvm::Twine &  path) const

◆ Readlink()

Status FileSystem::Readlink ( const FileSpec src,
FileSpec dst 
)

◆ RemoveFile() [1/2]

Status FileSystem::RemoveFile ( const FileSpec file_spec)

Remove a single file.

The path must specify a file and not a directory.

Definition at line 464 of file common/FileSystem.cpp.

References lldb_private::FileSpec::GetPath(), and RemoveFile().

Referenced by lldb_private::DataFileCache::RemoveCacheFile(), and RemoveFile().

◆ RemoveFile() [2/2]

Status FileSystem::RemoveFile ( const llvm::Twine &  path)

Definition at line 468 of file common/FileSystem.cpp.

◆ Resolve() [1/2]

void FileSystem::Resolve ( FileSpec file_spec)

◆ Resolve() [2/2]

void FileSystem::Resolve ( llvm::SmallVectorImpl< char > &  path)

Resolve path to make it canonical.

Definition at line 224 of file common/FileSystem.cpp.

References Exists(), m_tilde_resolver, and MakeAbsolute().

Referenced by lldb_private::process_gdb_remote::ProcessGDBRemote::BuildDynamicRegisterInfo(), lldb_private::NativeProcessWindows::CacheLoadedModules(), lldb_private::ComputeClangResourceDirectory(), lldb_private::HostInfoMacOSX::ComputeSupportExeDirectory(), lldb_private::HostInfoLinux::ComputeSystemPluginsDirectory(), lldb_private::HostInfoBase::ComputeTempFileBaseDirectory(), lldb_private::HostInfoMacOSX::ComputeUserPluginsDirectory(), SymbolVendorELF::CreateInstance(), SymbolVendorPECOFF::CreateInstance(), lldb_private::wasm::SymbolVendorWasm::CreateInstance(), lldb_private::TargetList::CreateTargetInternal(), DefaultComputeClangResourceDirectory(), CommandObjectPlatformInstall::DoExecute(), CommandObjectSettingsWrite::DoExecute(), CommandObjectTargetSymbolsAdd::DoExecute(), CommandObjectBreakpointRead::DoExecute(), CommandObjectBreakpointWrite::DoExecute(), CommandObjectCommandsSource::DoExecute(), CommandObjectPluginLoad::DoExecute(), CommandObjectProcessLoad::DoExecute(), CommandObjectProcessSaveCore::DoExecute(), CommandObjectSettingsRead::DoExecute(), CommandObjectTargetCreate::DoExecute(), CommandObjectTraceSave::DoExecute(), lldb_private::process_gdb_remote::GDBRemoteCommunicationServerCommon::FindModuleFile(), lldb_private::PlatformAppleSimulator::GetCoreSimulatorPath(), GetCwdInitFile(), ObjectFileMachO::GetDependentModules(), GetDsymForUUIDExecutable(), lldb_private::plugin::dwarf::SymbolFileDWARF::GetDwoSymbolFileForCompileUnit(), lldb_private::PlatformRemoteDarwinDevice::GetFileInSDK(), lldb_private::NativeProcessWindows::GetFileLoadAddress(), GetHomeREPLInitFile(), lldb_private::process_freebsd::NativeProcessFreeBSD::GetLoadedModuleFileSpec(), lldb_private::process_linux::NativeProcessLinux::GetLoadedModuleFileSpec(), lldb_private::process_netbsd::NativeProcessNetBSD::GetLoadedModuleFileSpec(), lldb_private::NativeProcessWindows::GetLoadedModuleFileSpec(), lldb_private::Host::GetModuleFileSpecForHostAddress(), lldb_private::process_gdb_remote::GDBRemoteCommunicationServerCommon::GetModuleInfo(), lldb::SBModuleSpecList::GetModuleSpecifications(), GetModuleSpecInfoFromUUIDDictionary(), lldb_private::ModuleList::GetSharedModule(), lldb_private::PlatformDarwinDevice::GetSharedModuleWithLocalCache(), lldb_private::PlatformAppleSimulator::GetSymbolFile(), lldb_private::PlatformRemoteDarwinDevice::GetSymbolFile(), lldb::SBHostOS::GetUserHomeDirectory(), lldb_private::Platform::GetWorkingDirectory(), lldb_private::process_gdb_remote::GDBRemoteCommunicationServerCommon::Handle_qPlatform_shell(), lldb_private::process_gdb_remote::GDBRemoteCommunicationServerCommon::Handle_vFile_Mode(), lldb_private::process_gdb_remote::GDBRemoteCommunicationServerCommon::Handle_vFile_Open(), lldb_private::process_gdb_remote::GDBRemoteCommunicationServerCommon::Handle_vFile_symlink(), CommandObjectBreakpointRead::CommandOptions::HandleOptionArgumentCompletion(), lldb_private::MonitoringProcessLauncher::LaunchProcess(), lldb_private::ProcessDebugger::LaunchProcess(), lldb::SBTarget::LoadCore(), lldb_private::process_gdb_remote::ProcessGDBRemote::LoadModules(), LoadPluginCallback(), lldb_private::SymbolLocatorDebugSymbols::LocateExecutableObjectFile(), lldb_private::PlatformDarwin::LocateExecutableScriptingResources(), lldb_private::SymbolLocatorDefault::LocateExecutableSymbolFile(), LocateMacOSXFilesUsingDebugSymbols(), lldb_private::ProcessWindows::OnDebuggerConnected(), ObjectFileELF::ParseDependentModules(), DynamicLoaderMacOSXDYLD::ParseLoadCommands(), lldb_private::process_linux::NativeProcessLinux::PopulateMemoryRegionCache(), lldb_private::Property::Property(), DynamicLoaderHexagonDYLD::RefreshModules(), Resolve(), resolve_tilde(), lldb_private::RemoteAwarePlatform::ResolveExecutable(), lldb_private::HostInfoAndroid::ResolveLibraryPath(), lldb::SBFileSpec::ResolvePath(), lldb_private::Platform::ResolveRemotePath(), lldb::SBProcess::SaveCore(), lldb_private::trace_intel_pt::TraceIntelPTBundleSaver::SaveToDisk(), lldb_private::CommandInterpreter::SaveTranscript(), lldb::SBFileSpec::SBFileSpec(), CommandObjectLogEnable::CommandOptions::SetOptionValue(), CommandObjectLogDump::CommandOptions::SetOptionValue(), CommandObjectMemoryWrite::OptionGroupWriteMemory::SetOptionValue(), lldb_private::OptionValueFileSpec::SetValueFromString(), lldb_private::plugin::dwarf::SymbolFileDWARF::UpdateExternalModuleListIfNeeded(), and lldb_private::PlatformDarwinDevice::UpdateSDKDirectoryInfosIfNeeded().

◆ ResolveExecutableLocation()

bool FileSystem::ResolveExecutableLocation ( FileSpec file_spec)

◆ ResolveSymbolicLink()

Status FileSystem::ResolveSymbolicLink ( const FileSpec src,
FileSpec dst 
)

◆ SetHomeDirectory()

void FileSystem::SetHomeDirectory ( std::string  home_directory)

Definition at line 460 of file common/FileSystem.cpp.

References m_home_directory.

◆ Symlink()

Status FileSystem::Symlink ( const FileSpec src,
const FileSpec dst 
)

◆ Terminate()

void FileSystem::Terminate ( )
static

Definition at line 47 of file common/FileSystem.cpp.

References InstanceImpl(), and lldbassert.

Referenced by lldb_private::SystemInitializerCommon::Terminate().

Member Data Documentation

◆ DEV_NULL

const char * FileSystem::DEV_NULL = "/dev/null"
static

◆ m_fs

llvm::IntrusiveRefCntPtr<llvm::vfs::FileSystem> lldb_private::FileSystem::m_fs
private

Definition at line 209 of file FileSystem.h.

Referenced by EnumerateDirectory(), GetRealPath(), GetVirtualFileSystem(), and MakeAbsolute().

◆ m_home_directory

std::string lldb_private::FileSystem::m_home_directory
private

Definition at line 211 of file FileSystem.h.

Referenced by GetHomeDirectory(), and SetHomeDirectory().

◆ m_tilde_resolver

std::unique_ptr<TildeExpressionResolver> lldb_private::FileSystem::m_tilde_resolver
private

Definition at line 210 of file FileSystem.h.

Referenced by Resolve().

◆ PATH_CONVERSION_ERROR

const char * FileSystem::PATH_CONVERSION_ERROR
static
Initial value:
=
"Error converting path between UTF-8 and native encoding"

Definition at line 33 of file FileSystem.h.


The documentation for this class was generated from the following files: