Index: include/lldb/Utility/FileSpec.h =================================================================== --- include/lldb/Utility/FileSpec.h +++ include/lldb/Utility/FileSpec.h @@ -272,14 +272,6 @@ //------------------------------------------------------------------ void Dump(Stream *s) const; - //------------------------------------------------------------------ - /// Existence test. - /// - /// @return - /// \b true if the file exists on disk, \b false otherwise. - //------------------------------------------------------------------ - bool Exists() const; - //------------------------------------------------------------------ /// Canonicalize this file path (basically running the static /// FileSpec::Resolve method on it). Useful if you asked us not to resolve Index: source/API/SBDebugger.cpp =================================================================== --- source/API/SBDebugger.cpp +++ source/API/SBDebugger.cpp @@ -90,7 +90,7 @@ "lldb::PluginInitialize(lldb::SBDebugger)"); } } else { - if (spec.Exists()) + if (FileSystem::Instance().Exists(spec)) error.SetErrorString("this file does not represent a loadable dylib"); else error.SetErrorString("no such file"); Index: source/API/SBFileSpec.cpp =================================================================== --- source/API/SBFileSpec.cpp +++ source/API/SBFileSpec.cpp @@ -51,7 +51,7 @@ bool SBFileSpec::Exists() const { Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_API)); - bool result = m_opaque_ap->Exists(); + bool result = FileSystem::Instance().Exists(*m_opaque_ap); if (log) log->Printf("SBFileSpec(%p)::Exists () => %s", Index: source/Commands/CommandObjectMemory.cpp =================================================================== --- source/Commands/CommandObjectMemory.cpp +++ source/Commands/CommandObjectMemory.cpp @@ -1210,7 +1210,7 @@ switch (short_option) { case 'i': m_infile.SetFile(option_value, true, FileSpec::Style::native); - if (!m_infile.Exists()) { + if (!FileSystem::Instance().Exists(m_infile)) { m_infile.Clear(); error.SetErrorStringWithFormat("input file does not exist: '%s'", option_value.str().c_str()); Index: source/Commands/CommandObjectPlatform.cpp =================================================================== --- source/Commands/CommandObjectPlatform.cpp +++ source/Commands/CommandObjectPlatform.cpp @@ -1818,7 +1818,7 @@ // TODO: move the bulk of this code over to the platform itself FileSpec src(args.GetArgumentAtIndex(0), true); FileSpec dst(args.GetArgumentAtIndex(1), false); - if (!src.Exists()) { + if (!FileSystem::Instance().Exists(src)) { result.AppendError("source location does not exist or is not accessible"); result.SetStatus(eReturnStatusFailed); return false; Index: source/Commands/CommandObjectTarget.cpp =================================================================== --- source/Commands/CommandObjectTarget.cpp +++ source/Commands/CommandObjectTarget.cpp @@ -274,7 +274,7 @@ FileSpec remote_file(m_remote_file.GetOptionValue().GetCurrentValue()); if (core_file) { - if (!core_file.Exists()) { + if (!FileSystem::Instance().Exists(core_file)) { result.AppendErrorWithFormat("core file '%s' doesn't exist", core_file.GetPath().c_str()); result.SetStatus(eReturnStatusFailed); @@ -291,7 +291,7 @@ if (argc == 1 || core_file || remote_file) { FileSpec symfile(m_symbol_file.GetOptionValue().GetCurrentValue()); if (symfile) { - if (symfile.Exists()) { + if (FileSystem::Instance().Exists(symfile)) { if (!FileSystem::Instance().Readable(symfile)) { result.AppendErrorWithFormat("symbol file '%s' is not readable", symfile.GetPath().c_str()); @@ -336,7 +336,7 @@ if (remote_file) { if (platform_sp) { // I have a remote file.. two possible cases - if (file_spec && file_spec.Exists()) { + if (file_spec && FileSystem::Instance().Exists(file_spec)) { // if the remote file does not exist, push it there if (!platform_sp->GetFileExists(remote_file)) { Status err = platform_sp->PutFile(file_spec, remote_file); @@ -404,7 +404,7 @@ if (core_file) { char core_path[PATH_MAX]; core_file.GetPath(core_path, sizeof(core_path)); - if (core_file.Exists()) { + if (FileSystem::Instance().Exists(core_file)) { if (!FileSystem::Instance().Readable(core_file)) { result.AppendMessageWithFormat( "Core file '%s' is not readable.\n", core_path); @@ -2533,7 +2533,7 @@ continue; FileSpec file_spec(entry.ref, true); - if (file_spec.Exists()) { + if (FileSystem::Instance().Exists(file_spec)) { ModuleSpec module_spec(file_spec); if (m_uuid_option_group.GetOptionValue().OptionWasSet()) module_spec.GetUUID() = @@ -4255,7 +4255,8 @@ ModuleSP frame_module_sp( frame->GetSymbolContext(eSymbolContextModule).module_sp); if (frame_module_sp) { - if (frame_module_sp->GetPlatformFileSpec().Exists()) { + if (FileSystem::Instance().Exists( + frame_module_sp->GetPlatformFileSpec())) { module_spec.GetArchitecture() = frame_module_sp->GetArchitecture(); module_spec.GetFileSpec() = @@ -4302,7 +4303,7 @@ module_spec.GetArchitecture() = target->GetArchitecture(); } success |= module_spec.GetUUID().IsValid() || - module_spec.GetFileSpec().Exists(); + FileSystem::Instance().Exists(module_spec.GetFileSpec()); } } @@ -4362,7 +4363,8 @@ } ArchSpec arch; - bool symfile_exists = module_spec.GetSymbolFileSpec().Exists(); + bool symfile_exists = + FileSystem::Instance().Exists(module_spec.GetSymbolFileSpec()); if (symfile_exists) { if (!AddModuleSymbols(target, module_spec, flush, result)) Index: source/Core/Debugger.cpp =================================================================== --- source/Core/Debugger.cpp +++ source/Core/Debugger.cpp @@ -656,7 +656,8 @@ const bool find_other = true; char dir_path[PATH_MAX]; if (FileSpec dir_spec = HostInfo::GetSystemPluginDir()) { - if (dir_spec.Exists() && dir_spec.GetPath(dir_path, sizeof(dir_path))) { + if (FileSystem::Instance().Exists(dir_spec) && + dir_spec.GetPath(dir_path, sizeof(dir_path))) { FileSystem::Instance().EnumerateDirectory(dir_path, find_directories, find_files, find_other, LoadPluginCallback, this); @@ -664,7 +665,8 @@ } if (FileSpec dir_spec = HostInfo::GetUserPluginDir()) { - if (dir_spec.Exists() && dir_spec.GetPath(dir_path, sizeof(dir_path))) { + if (FileSystem::Instance().Exists(dir_spec) && + dir_spec.GetPath(dir_path, sizeof(dir_path))) { FileSystem::Instance().EnumerateDirectory(dir_path, find_directories, find_files, find_other, LoadPluginCallback, this); Index: source/Core/DynamicLoader.cpp =================================================================== --- source/Core/DynamicLoader.cpp +++ source/Core/DynamicLoader.cpp @@ -81,7 +81,7 @@ ModuleSP executable = target.GetExecutableModule(); if (executable) { - if (executable->GetFileSpec().Exists()) { + if (FileSystem::Instance().Exists(executable->GetFileSpec())) { ModuleSpec module_spec(executable->GetFileSpec(), executable->GetArchitecture()); auto module_sp = std::make_shared(module_spec); Index: source/Core/Module.cpp =================================================================== --- source/Core/Module.cpp +++ source/Core/Module.cpp @@ -1418,7 +1418,7 @@ } void Module::SetSymbolFileFileSpec(const FileSpec &file) { - if (!file.Exists()) + if (!FileSystem::Instance().Exists(file)) return; if (m_symfile_ap) { // Remove any sections in the unified section list that come from the @@ -1537,7 +1537,8 @@ if (script_interpreter) { for (uint32_t i = 0; i < num_specs; ++i) { FileSpec scripting_fspec(file_specs.GetFileSpecAtIndex(i)); - if (scripting_fspec && scripting_fspec.Exists()) { + if (scripting_fspec && + FileSystem::Instance().Exists(scripting_fspec)) { if (should_load == eLoadScriptFromSymFileWarn) { if (feedback_stream) feedback_stream->Printf( Index: source/Core/ModuleList.cpp =================================================================== --- source/Core/ModuleList.cpp +++ source/Core/ModuleList.cpp @@ -864,7 +864,7 @@ continue; search_path_spec.AppendPathComponent( module_spec.GetFileSpec().GetFilename().AsCString()); - if (!search_path_spec.Exists()) + if (!FileSystem::Instance().Exists(search_path_spec)) continue; auto resolved_module_spec(module_spec); @@ -905,13 +905,15 @@ // Don't look for the file if it appears to be the same one we already // checked for above... if (located_binary_modulespec.GetFileSpec() != module_file_spec) { - if (!located_binary_modulespec.GetFileSpec().Exists()) { + if (!FileSystem::Instance().Exists( + located_binary_modulespec.GetFileSpec())) { located_binary_modulespec.GetFileSpec().GetPath(path, sizeof(path)); if (path[0] == '\0') module_file_spec.GetPath(path, sizeof(path)); // How can this check ever be true? This branch it is false, and we // haven't modified file_spec. - if (located_binary_modulespec.GetFileSpec().Exists()) { + if (FileSystem::Instance().Exists( + located_binary_modulespec.GetFileSpec())) { std::string uuid_str; if (uuid_ptr && uuid_ptr->IsValid()) uuid_str = uuid_ptr->GetAsString(); Index: source/Core/PluginManager.cpp =================================================================== --- source/Core/PluginManager.cpp +++ source/Core/PluginManager.cpp @@ -163,7 +163,8 @@ const bool find_other = true; char dir_path[PATH_MAX]; if (FileSpec dir_spec = HostInfo::GetSystemPluginDir()) { - if (dir_spec.Exists() && dir_spec.GetPath(dir_path, sizeof(dir_path))) { + if (FileSystem::Instance().Exists(dir_spec) && + dir_spec.GetPath(dir_path, sizeof(dir_path))) { FileSystem::Instance().EnumerateDirectory(dir_path, find_directories, find_files, find_other, LoadPluginCallback, nullptr); @@ -171,7 +172,8 @@ } if (FileSpec dir_spec = HostInfo::GetUserPluginDir()) { - if (dir_spec.Exists() && dir_spec.GetPath(dir_path, sizeof(dir_path))) { + if (FileSystem::Instance().Exists(dir_spec) && + dir_spec.GetPath(dir_path, sizeof(dir_path))) { FileSystem::Instance().EnumerateDirectory(dir_path, find_directories, find_files, find_other, LoadPluginCallback, nullptr); Index: source/Core/SourceManager.cpp =================================================================== --- source/Core/SourceManager.cpp +++ source/Core/SourceManager.cpp @@ -92,7 +92,7 @@ file_sp->UpdateIfNeeded(); // If file_sp is no good or it points to a non-existent file, reset it. - if (!file_sp || !file_sp->GetFileSpec().Exists()) { + if (!file_sp || !FileSystem::Instance().Exists(file_sp->GetFileSpec())) { if (target_sp) file_sp = std::make_shared(file_spec, target_sp.get()); else @@ -427,7 +427,7 @@ } } // Try remapping if m_file_spec does not correspond to an existing file. - if (!m_file_spec.Exists()) { + if (!FileSystem::Instance().Exists(m_file_spec)) { FileSpec new_file_spec; // Check target specific source remappings first, then fall back to // modules objects can have individual path remappings that were Index: source/Host/common/HostInfoBase.cpp =================================================================== --- source/Host/common/HostInfoBase.cpp +++ source/Host/common/HostInfoBase.cpp @@ -42,7 +42,7 @@ struct HostInfoBaseFields { ~HostInfoBaseFields() { - if (m_lldb_process_tmp_dir.Exists()) { + if (FileSystem::Instance().Exists(m_lldb_process_tmp_dir)) { // Remove the LLDB temporary directory if we have one. Set "recurse" to // true to all files that were created for the LLDB process can be // cleaned up. Index: source/Host/common/Symbols.cpp =================================================================== --- source/Host/common/Symbols.cpp +++ source/Host/common/Symbols.cpp @@ -85,17 +85,16 @@ dsym_directory.AppendPathComponent("Contents"); dsym_directory.AppendPathComponent("Resources"); dsym_directory.AppendPathComponent("DWARF"); - - if (dsym_directory.Exists()) { + + if (FileSystem::Instance().Exists(dsym_directory)) { // See if the binary name exists in the dSYM DWARF // subdir. dsym_fspec = dsym_directory; dsym_fspec.AppendPathComponent(filename.AsCString()); - if (dsym_fspec.Exists() - && FileAtPathContainsArchAndUUID(dsym_fspec, - mod_spec.GetArchitecturePtr(), - mod_spec.GetUUIDPtr())) { + if (FileSystem::Instance().Exists(dsym_fspec) && + FileAtPathContainsArchAndUUID(dsym_fspec, mod_spec.GetArchitecturePtr(), + mod_spec.GetUUIDPtr())) { return true; } @@ -109,15 +108,15 @@ binary_name.erase(last_dot); dsym_fspec = dsym_directory; dsym_fspec.AppendPathComponent(binary_name); - if (dsym_fspec.Exists() - && FileAtPathContainsArchAndUUID(dsym_fspec, - mod_spec.GetArchitecturePtr(), - mod_spec.GetUUIDPtr())) { + if (FileSystem::Instance().Exists(dsym_fspec) && + FileAtPathContainsArchAndUUID(dsym_fspec, + mod_spec.GetArchitecturePtr(), + mod_spec.GetUUIDPtr())) { return true; } } - } - + } + // See if we have a .dSYM.yaa next to this executable path. FileSpec dsym_yaa_fspec = exec_fspec; dsym_yaa_fspec.RemoveLastPathComponent(); @@ -125,10 +124,10 @@ dsym_yaa_filename += ".dSYM.yaa"; dsym_yaa_fspec.AppendPathComponent(dsym_yaa_filename); - if (dsym_yaa_fspec.Exists()) { + if (FileSystem::Instance().Exists(dsym_yaa_fspec)) { ModuleSpec mutable_mod_spec = mod_spec; - if (Symbols::DownloadObjectAndSymbolFile (mutable_mod_spec, true) - && mutable_mod_spec.GetSymbolFileSpec().Exists()) { + if (Symbols::DownloadObjectAndSymbolFile(mutable_mod_spec, true) && + FileSystem::Instance().Exists(mutable_mod_spec.GetSymbolFileSpec())) { dsym_fspec = mutable_mod_spec.GetSymbolFileSpec(); return true; } @@ -250,7 +249,8 @@ FileSpec Symbols::LocateExecutableSymbolFile(const ModuleSpec &module_spec) { FileSpec symbol_file_spec = module_spec.GetSymbolFileSpec(); - if (symbol_file_spec.IsAbsolute() && symbol_file_spec.Exists()) + if (symbol_file_spec.IsAbsolute() && + FileSystem::Instance().Exists(symbol_file_spec)) return symbol_file_spec; const char *symbol_filename = symbol_file_spec.GetFilename().AsCString(); @@ -321,7 +321,7 @@ module_file_spec.GetPath())) continue; - if (file_spec.Exists()) { + if (FileSystem::Instance().Exists(file_spec)) { lldb_private::ModuleSpecList specs; const size_t num_specs = ObjectFile::GetModuleSpecifications(file_spec, 0, 0, specs); Index: source/Host/macosx/Symbols.cpp =================================================================== --- source/Host/macosx/Symbols.cpp +++ source/Host/macosx/Symbols.cpp @@ -147,7 +147,7 @@ } ++items_found; FileSpec exec_filespec(path, path[0] == '~'); - if (exec_filespec.Exists()) { + if (FileSystem::Instance().Exists(exec_filespec)) { success = true; return_module_spec.GetFileSpec() = exec_filespec; } @@ -494,7 +494,8 @@ return false; } - if (uuid_ptr || (file_spec_ptr && file_spec_ptr->Exists())) { + if (uuid_ptr || + (file_spec_ptr && FileSystem::Instance().Exists(*file_spec_ptr))) { static bool g_located_dsym_for_uuid_exe = false; static bool g_dsym_for_uuid_exe_exists = false; static char g_dsym_for_uuid_exe_path[PATH_MAX]; @@ -506,13 +507,15 @@ if (dsym_for_uuid_exe_path_cstr) { dsym_for_uuid_exe_spec.SetFile(dsym_for_uuid_exe_path_cstr, true, FileSpec::Style::native); - g_dsym_for_uuid_exe_exists = dsym_for_uuid_exe_spec.Exists(); + g_dsym_for_uuid_exe_exists = + FileSystem::Instance().Exists(dsym_for_uuid_exe_spec); } if (!g_dsym_for_uuid_exe_exists) { dsym_for_uuid_exe_spec.SetFile("/usr/local/bin/dsymForUUID", false, FileSpec::Style::native); - g_dsym_for_uuid_exe_exists = dsym_for_uuid_exe_spec.Exists(); + g_dsym_for_uuid_exe_exists = + FileSystem::Instance().Exists(dsym_for_uuid_exe_spec); if (!g_dsym_for_uuid_exe_exists) { long bufsize; if ((bufsize = sysconf(_SC_GETPW_R_SIZE_MAX)) != -1) { @@ -527,7 +530,8 @@ dsymforuuid_path += "/bin/dsymForUUID"; dsym_for_uuid_exe_spec.SetFile(dsymforuuid_path.c_str(), false, FileSpec::Style::native); - g_dsym_for_uuid_exe_exists = dsym_for_uuid_exe_spec.Exists(); + g_dsym_for_uuid_exe_exists = + FileSystem::Instance().Exists(dsym_for_uuid_exe_spec); } } } @@ -535,7 +539,8 @@ if (!g_dsym_for_uuid_exe_exists && g_dbgshell_command != NULL) { dsym_for_uuid_exe_spec.SetFile(g_dbgshell_command, true, FileSpec::Style::native); - g_dsym_for_uuid_exe_exists = dsym_for_uuid_exe_spec.Exists(); + g_dsym_for_uuid_exe_exists = + FileSystem::Instance().Exists(dsym_for_uuid_exe_spec); } if (g_dsym_for_uuid_exe_exists) Index: source/Host/macosx/objcxx/Host.mm =================================================================== --- source/Host/macosx/objcxx/Host.mm +++ source/Host/macosx/objcxx/Host.mm @@ -226,7 +226,7 @@ darwin_debug_file_spec.GetFilename().SetCString("darwin-debug"); - if (!darwin_debug_file_spec.Exists()) { + if (!FileSystem::Instance().Exists(darwin_debug_file_spec)) { error.SetErrorStringWithFormat( "the 'darwin-debug' executable doesn't exists at '%s'", darwin_debug_file_spec.GetPath().c_str()); @@ -1338,7 +1338,7 @@ return error; } expand_tool_spec.AppendPathComponent("lldb-argdumper"); - if (!expand_tool_spec.Exists()) { + if (!FileSystem::Instance().Exists(expand_tool_spec)) { error.SetErrorStringWithFormat( "could not find the lldb-argdumper tool: %s", expand_tool_spec.GetPath().c_str()); @@ -1355,7 +1355,7 @@ int status; std::string output; FileSpec cwd(launch_info.GetWorkingDirectory()); - if (!cwd.Exists()) { + if (!FileSystem::Instance().Exists(cwd)) { char *wd = getcwd(nullptr, 0); if (wd == nullptr) { error.SetErrorStringWithFormat( Index: source/Interpreter/CommandInterpreter.cpp =================================================================== --- source/Interpreter/CommandInterpreter.cpp +++ source/Interpreter/CommandInterpreter.cpp @@ -2093,7 +2093,7 @@ FileSpec homedir_dot_lldb(home_dir_path.c_str(), false); homedir_dot_lldb.AppendPathComponent(".lldbinit"); homedir_dot_lldb.ResolvePath(); - if (dot_lldb.Exists() && + if (FileSystem::Instance().Exists(dot_lldb) && dot_lldb.GetDirectory() != homedir_dot_lldb.GetDirectory()) { result.AppendErrorWithFormat( "There is a .lldbinit file in the current directory which is not " @@ -2137,7 +2137,7 @@ "%s-%s", init_file_path.c_str(), program_name); init_file.SetFile(program_init_file_name, true, FileSpec::Style::native); - if (!init_file.Exists()) + if (!FileSystem::Instance().Exists(init_file)) init_file.Clear(); } } @@ -2150,7 +2150,7 @@ // actual broadcasting of the commands back to any appropriate listener (see // CommandObjectSource::Execute for more details). - if (init_file.Exists()) { + if (FileSystem::Instance().Exists(init_file)) { const bool saved_batch = SetBatchCommandMode(true); CommandInterpreterRunOptions options; options.SetSilent(true); @@ -2351,7 +2351,7 @@ void CommandInterpreter::HandleCommandsFromFile( FileSpec &cmd_file, ExecutionContext *context, CommandInterpreterRunOptions &options, CommandReturnObject &result) { - if (cmd_file.Exists()) { + if (FileSystem::Instance().Exists(cmd_file)) { StreamFileSP input_file_sp(new StreamFile()); std::string cmd_file_path = cmd_file.GetPath(); Index: source/Interpreter/OptionValuePathMappings.cpp =================================================================== --- source/Interpreter/OptionValuePathMappings.cpp +++ source/Interpreter/OptionValuePathMappings.cpp @@ -13,6 +13,7 @@ // C++ Includes // Other libraries and framework includes // Project includes +#include "lldb/Host/FileSystem.h" #include "lldb/Host/StringConvert.h" #include "lldb/Utility/Args.h" #include "lldb/Utility/FileSpec.h" @@ -23,7 +24,7 @@ namespace { static bool VerifyPathExists(const char *path) { if (path && path[0]) - return FileSpec(path, false).Exists(); + return FileSystem::Instance().Exists(path); else return false; } Index: source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.cpp =================================================================== --- source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.cpp +++ source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.cpp @@ -784,7 +784,7 @@ // to do anything useful. This will force a clal to if (IsKernel()) { if (Symbols::DownloadObjectAndSymbolFile(module_spec, true)) { - if (module_spec.GetFileSpec().Exists()) { + if (FileSystem::Instance().Exists(module_spec.GetFileSpec())) { m_module_sp.reset(new Module(module_spec.GetFileSpec(), target.GetArchitecture())); if (m_module_sp.get() && Index: source/Plugins/DynamicLoader/Hexagon-DYLD/DynamicLoaderHexagonDYLD.cpp =================================================================== --- source/Plugins/DynamicLoader/Hexagon-DYLD/DynamicLoaderHexagonDYLD.cpp +++ source/Plugins/DynamicLoader/Hexagon-DYLD/DynamicLoaderHexagonDYLD.cpp @@ -179,7 +179,7 @@ return executable; // The target executable file does not exits - if (!executable->GetFileSpec().Exists()) + if (!FileSystem::Instance().Exists(executable->GetFileSpec())) return executable; // Prep module for loading Index: source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp =================================================================== --- source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp +++ source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp @@ -2530,7 +2530,7 @@ // Check we can read from file FileSpec file(path, true); - if (!file.Exists()) { + if (!FileSystem::Instance().Exists(file)) { strm.Printf("Error: File %s does not exist", path); strm.EOL(); return false; @@ -4652,7 +4652,7 @@ switch (short_option) { case 'f': m_outfile.SetFile(option_arg, true, FileSpec::Style::native); - if (m_outfile.Exists()) { + if (FileSystem::Instance().Exists(m_outfile)) { m_outfile.Clear(); err.SetErrorStringWithFormat("file already exists: '%s'", option_arg.str().c_str()); Index: source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp =================================================================== --- source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp +++ source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp @@ -2636,7 +2636,7 @@ // shared cache UUID in the development or non-development shared caches // on disk. if (process_shared_cache_uuid.IsValid()) { - if (dsc_development_filespec.Exists()) { + if (FileSystem::Instance().Exists(dsc_development_filespec)) { UUID dsc_development_uuid = GetSharedCacheUUID( dsc_development_filespec, byte_order, addr_byte_size); if (dsc_development_uuid.IsValid() && @@ -2645,7 +2645,8 @@ dsc_uuid = dsc_development_uuid; } } - if (!dsc_uuid.IsValid() && dsc_nondevelopment_filespec.Exists()) { + if (!dsc_uuid.IsValid() && + FileSystem::Instance().Exists(dsc_nondevelopment_filespec)) { UUID dsc_nondevelopment_uuid = GetSharedCacheUUID( dsc_nondevelopment_filespec, byte_order, addr_byte_size); if (dsc_nondevelopment_uuid.IsValid() && @@ -2658,8 +2659,8 @@ // Failing a UUID match, prefer the development dyld_shared cache if both // are present. - if (!dsc_filespec.Exists()) { - if (dsc_development_filespec.Exists()) { + if (!FileSystem::Instance().Exists(dsc_filespec)) { + if (FileSystem::Instance().Exists(dsc_development_filespec)) { dsc_filespec = dsc_development_filespec; } else { dsc_filespec = dsc_nondevelopment_filespec; @@ -3067,11 +3068,11 @@ // file so you end up with a path that looks // like "/tmp/src//tmp/src/" FileSpec so_dir(so_path, false); - if (!so_dir.Exists()) { + if (!FileSystem::Instance().Exists(so_dir)) { so_dir.SetFile( &full_so_path[double_slash_pos + 1], false); - if (so_dir.Exists()) { + if (FileSystem::Instance().Exists(so_dir)) { // Trim off the incorrect path full_so_path.erase(0, double_slash_pos + 1); @@ -4017,10 +4018,10 @@ // directory for the source file so you end up with a path // that looks like "/tmp/src//tmp/src/" FileSpec so_dir(so_path, false); - if (!so_dir.Exists()) { + if (!FileSystem::Instance().Exists(so_dir)) { so_dir.SetFile(&full_so_path[double_slash_pos + 1], false, FileSpec::Style::native); - if (so_dir.Exists()) { + if (FileSystem::Instance().Exists(so_dir)) { // Trim off the incorrect path full_so_path.erase(0, double_slash_pos + 1); } @@ -5152,7 +5153,8 @@ // It is OK to resolve this path because we must find a file on disk // for us to accept it anyway if it is rpath relative. FileSpec file_spec(path, true); - if (file_spec.Exists() && files.AppendIfUnique(file_spec)) { + if (FileSystem::Instance().Exists(file_spec) && + files.AppendIfUnique(file_spec)) { count++; break; } @@ -5169,7 +5171,8 @@ for (const auto &at_exec_relative_path : at_exec_relative_paths) { FileSpec file_spec = exec_dir.CopyByAppendingPathComponent(at_exec_relative_path); - if (file_spec.Exists() && files.AppendIfUnique(file_spec)) + if (FileSystem::Instance().Exists(file_spec) && + files.AppendIfUnique(file_spec)) count++; } } Index: source/Plugins/OperatingSystem/Python/OperatingSystemPython.cpp =================================================================== --- source/Plugins/OperatingSystem/Python/OperatingSystemPython.cpp +++ source/Plugins/OperatingSystem/Python/OperatingSystemPython.cpp @@ -53,7 +53,8 @@ // Python OperatingSystem plug-ins must be requested by name, so force must // be true FileSpec python_os_plugin_spec(process->GetPythonOSPluginPath()); - if (python_os_plugin_spec && python_os_plugin_spec.Exists()) { + if (python_os_plugin_spec && + FileSystem::Instance().Exists(python_os_plugin_spec)) { std::unique_ptr os_ap( new OperatingSystemPython(process, python_os_plugin_spec)); if (os_ap.get() && os_ap->IsValid()) Index: source/Plugins/Platform/MacOSX/PlatformAppleTVSimulator.cpp =================================================================== --- source/Plugins/Platform/MacOSX/PlatformAppleTVSimulator.cpp +++ source/Plugins/Platform/MacOSX/PlatformAppleTVSimulator.cpp @@ -190,7 +190,7 @@ // ourselves Host::ResolveExecutableInBundle(resolved_module_spec.GetFileSpec()); - if (resolved_module_spec.GetFileSpec().Exists()) { + if (FileSystem::Instance().Exists(resolved_module_spec.GetFileSpec())) { if (resolved_module_spec.GetArchitecture().IsValid()) { error = ModuleList::GetSharedModule(resolved_module_spec, exe_module_sp, NULL, NULL, NULL); @@ -317,12 +317,12 @@ // First try in the SDK and see if the file is in there local_file.SetFile(resolved_path, true, FileSpec::Style::native); - if (local_file.Exists()) + if (FileSystem::Instance().Exists(local_file)) return error; // Else fall back to the actual path itself local_file.SetFile(platform_file_path, true, FileSpec::Style::native); - if (local_file.Exists()) + if (FileSystem::Instance().Exists(local_file)) return error; } error.SetErrorStringWithFormat( Index: source/Plugins/Platform/MacOSX/PlatformAppleWatchSimulator.cpp =================================================================== --- source/Plugins/Platform/MacOSX/PlatformAppleWatchSimulator.cpp +++ source/Plugins/Platform/MacOSX/PlatformAppleWatchSimulator.cpp @@ -190,7 +190,7 @@ // ourselves Host::ResolveExecutableInBundle(resolved_module_spec.GetFileSpec()); - if (resolved_module_spec.GetFileSpec().Exists()) { + if (FileSystem::Instance().Exists(resolved_module_spec.GetFileSpec())) { if (resolved_module_spec.GetArchitecture().IsValid()) { error = ModuleList::GetSharedModule(resolved_module_spec, exe_module_sp, NULL, NULL, NULL); @@ -317,12 +317,12 @@ // First try in the SDK and see if the file is in there local_file.SetFile(resolved_path, true, FileSpec::Style::native); - if (local_file.Exists()) + if (FileSystem::Instance().Exists(local_file)) return error; // Else fall back to the actual path itself local_file.SetFile(platform_file_path, true, FileSpec::Style::native); - if (local_file.Exists()) + if (FileSystem::Instance().Exists(local_file)) return error; } error.SetErrorStringWithFormat( Index: source/Plugins/Platform/MacOSX/PlatformDarwin.cpp =================================================================== --- source/Plugins/Platform/MacOSX/PlatformDarwin.cpp +++ source/Plugins/Platform/MacOSX/PlatformDarwin.cpp @@ -88,7 +88,7 @@ ObjectFile *objfile = symfile->GetObjectFile(); if (objfile) { FileSpec symfile_spec(objfile->GetFileSpec()); - if (symfile_spec && symfile_spec.Exists()) { + if (symfile_spec && FileSystem::Instance().Exists(symfile_spec)) { while (module_spec.GetFilename()) { std::string module_basename( module_spec.GetFilename().GetCString()); @@ -139,11 +139,11 @@ // that the file as-is shall not be loaded if (feedback_stream) { if (module_basename != original_module_basename && - orig_script_fspec.Exists()) { + FileSystem::Instance().Exists(orig_script_fspec)) { const char *reason_for_complaint = was_keyword ? "conflicts with a keyword" : "contains reserved characters"; - if (script_fspec.Exists()) + if (FileSystem::Instance().Exists(script_fspec)) feedback_stream->Printf( "warning: the symbol file '%s' contains a debug " "script. However, its name" @@ -167,7 +167,7 @@ } } - if (script_fspec.Exists()) { + if (FileSystem::Instance().Exists(script_fspec)) { file_list.Append(script_fspec); break; } @@ -270,7 +270,7 @@ err = BringInRemoteFile(this, module_spec, module_cache_spec); if (err.Fail()) return err; - if (module_cache_spec.Exists()) { + if (FileSystem::Instance().Exists(module_cache_spec)) { Log *log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_PLATFORM)); if (log) log->Printf("[%s] module %s/%s was rsynced and is now there", @@ -286,7 +286,7 @@ } // try to find the module in the cache - if (module_cache_spec.Exists()) { + if (FileSystem::Instance().Exists(module_cache_spec)) { // get the local and remote MD5 and compare if (m_remote_platform_sp) { // when going over the *slow* GDB remote transfer mechanism we first @@ -337,7 +337,7 @@ Status err = BringInRemoteFile(this, module_spec, module_cache_spec); if (err.Fail()) return err; - if (module_cache_spec.Exists()) { + if (FileSystem::Instance().Exists(module_cache_spec)) { Log *log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_PLATFORM)); if (log) log->Printf("[%s] module %s/%s is now cached and fine", @@ -413,7 +413,7 @@ sizeof(new_path) - search_path_len, "/%s", platform_path + bundle_directory_len); FileSpec new_file_spec(new_path, false); - if (new_file_spec.Exists()) { + if (FileSystem::Instance().Exists(new_file_spec)) { ModuleSpec new_module_spec(module_spec); new_module_spec.GetFileSpec() = new_file_spec; Status new_error(Platform::GetSharedModule( @@ -1184,7 +1184,7 @@ if (!developer_dir_path_valid) { FileSpec xcode_select_cmd("/usr/bin/xcode-select", false); - if (xcode_select_cmd.Exists()) { + if (FileSystem::Instance().Exists(xcode_select_cmd)) { int exit_status = -1; int signo = -1; std::string command_output; @@ -1217,7 +1217,7 @@ if (developer_dir_path_valid) { temp_file_spec.SetFile(developer_dir_path, false, FileSpec::Style::native); - if (temp_file_spec.Exists()) { + if (FileSystem::Instance().Exists(temp_file_spec)) { m_developer_directory.assign(developer_dir_path); return m_developer_directory.c_str(); } @@ -1300,7 +1300,7 @@ }; static FileSpec CheckPathForXcode(const FileSpec &fspec) { - if (fspec.Exists()) { + if (FileSystem::Instance().Exists(fspec)) { const char substr[] = ".app/Contents"; std::string path_to_shlib = fspec.GetPath(); @@ -1313,7 +1313,7 @@ xcode_binary_path.AppendPathComponent("MacOS"); xcode_binary_path.AppendPathComponent("Xcode"); - if (xcode_binary_path.Exists()) { + if (FileSystem::Instance().Exists(xcode_binary_path)) { return ret; } } @@ -1497,7 +1497,7 @@ version.getMinor().getValueOr(0)); native_sdk_spec.AppendPathComponent(native_sdk_name.GetString()); - if (native_sdk_spec.Exists()) { + if (FileSystem::Instance().Exists(native_sdk_spec)) { return native_sdk_spec; } } @@ -1659,7 +1659,7 @@ xcode_lldb_resources.AppendPathComponent("SharedFrameworks"); xcode_lldb_resources.AppendPathComponent("LLDB.framework"); xcode_lldb_resources.AppendPathComponent("Resources"); - if (xcode_lldb_resources.Exists()) { + if (FileSystem::Instance().Exists(xcode_lldb_resources)) { FileSpec dir; dir.GetDirectory().SetCString(xcode_lldb_resources.GetPath().c_str()); g_executable_dirs.push_back(dir); @@ -1673,7 +1673,7 @@ FileSpec executable_file; executable_file.GetDirectory() = executable_dir.GetDirectory(); executable_file.GetFilename().SetCString(basename); - if (executable_file.Exists()) + if (FileSystem::Instance().Exists(executable_file)) return executable_file; } @@ -1757,7 +1757,7 @@ path_to_try.AppendPathComponent(path_parts[k]); } - if (path_to_try.Exists()) { + if (FileSystem::Instance().Exists(path_to_try)) { ModuleSpec new_module_spec(module_spec); new_module_spec.GetFileSpec() = path_to_try; Status new_error(Platform::GetSharedModule( Index: source/Plugins/Platform/MacOSX/PlatformDarwinKernel.cpp =================================================================== --- source/Plugins/Platform/MacOSX/PlatformDarwinKernel.cpp +++ source/Plugins/Platform/MacOSX/PlatformDarwinKernel.cpp @@ -719,7 +719,7 @@ module_spec.GetUUID().IsValid()) { // First try all kernel binaries that have a dSYM next to them for (auto possible_kernel : m_kernel_binaries_with_dsyms) { - if (possible_kernel.Exists()) { + if (FileSystem::Instance().Exists(possible_kernel)) { ModuleSpec kern_spec(possible_kernel); kern_spec.GetUUID() = module_spec.GetUUID(); ModuleSP module_sp(new Module(kern_spec)); @@ -755,7 +755,7 @@ // Next try all kernel binaries that don't have a dSYM for (auto possible_kernel : m_kernel_binaries_without_dsyms) { - if (possible_kernel.Exists()) { + if (FileSystem::Instance().Exists(possible_kernel)) { ModuleSpec kern_spec(possible_kernel); kern_spec.GetUUID() = module_spec.GetUUID(); ModuleSP module_sp(new Module(kern_spec)); @@ -806,7 +806,7 @@ const ArchSpec &arch, ModuleSP &exe_module_sp) { for (const auto &exe_file : SearchForExecutablesRecursively(kext_bundle_path.GetPath())) { - if (exe_file.Exists()) { + if (FileSystem::Instance().Exists(exe_file)) { ModuleSpec exe_spec(exe_file); exe_spec.GetUUID() = uuid; if (!uuid.IsValid()) { Index: source/Plugins/Platform/MacOSX/PlatformMacOSX.cpp =================================================================== --- source/Plugins/Platform/MacOSX/PlatformMacOSX.cpp +++ source/Plugins/Platform/MacOSX/PlatformMacOSX.cpp @@ -219,13 +219,13 @@ xcode_contents_path.c_str(), versions[0], versions[1]); fspec.SetFile(sdk_path.GetString(), false, FileSpec::Style::native); - if (fspec.Exists()) + if (FileSystem::Instance().Exists(fspec)) return ConstString(sdk_path.GetString()); } if (!default_xcode_sdk.empty()) { fspec.SetFile(default_xcode_sdk, false, FileSpec::Style::native); - if (fspec.Exists()) + if (FileSystem::Instance().Exists(fspec)) return ConstString(default_xcode_sdk); } } @@ -269,7 +269,7 @@ std::string module_path(platform_file.GetPath()); cache_path.append(module_path); FileSpec module_cache_spec(cache_path, false); - if (module_cache_spec.Exists()) { + if (FileSystem::Instance().Exists(module_cache_spec)) { local_file = module_cache_spec; return Status(); } @@ -284,7 +284,7 @@ err = GetFile(platform_file, module_cache_spec); if (err.Fail()) return err; - if (module_cache_spec.Exists()) { + if (FileSystem::Instance().Exists(module_cache_spec)) { local_file = module_cache_spec; return Status(); } else Index: source/Plugins/Platform/MacOSX/PlatformRemoteDarwinDevice.cpp =================================================================== --- source/Plugins/Platform/MacOSX/PlatformRemoteDarwinDevice.cpp +++ source/Plugins/Platform/MacOSX/PlatformRemoteDarwinDevice.cpp @@ -18,6 +18,7 @@ #include "lldb/Core/ModuleList.h" #include "lldb/Core/ModuleSpec.h" #include "lldb/Core/PluginManager.h" +#include "lldb/Host/FileSystem.h" #include "lldb/Host/Host.h" #include "lldb/Target/Process.h" #include "lldb/Target/Target.h" @@ -85,7 +86,7 @@ // ourselves Host::ResolveExecutableInBundle(resolved_module_spec.GetFileSpec()); - if (resolved_module_spec.GetFileSpec().Exists()) { + if (FileSystem::Instance().Exists(resolved_module_spec.GetFileSpec())) { if (resolved_module_spec.GetArchitecture().IsValid() || resolved_module_spec.GetUUID().IsValid()) { error = ModuleList::GetSharedModule(resolved_module_spec, exe_module_sp, @@ -188,7 +189,7 @@ for (const auto &sdk_directory_info : builtin_sdk_directory_infos) { sdk_symbols_symlink_fspec = sdk_directory_info.directory; sdk_symbols_symlink_fspec.AppendPathComponent("Symbols"); - if (sdk_symbols_symlink_fspec.Exists()) { + if (FileSystem::Instance().Exists(sdk_symbols_symlink_fspec)) { m_sdk_directory_infos.push_back(sdk_directory_info); if (log) { log->Printf("PlatformRemoteDarwinDevice::UpdateSDKDirectoryInfosIfNeeded " @@ -207,12 +208,12 @@ std::string local_sdk_cache_str = "~/Library/Developer/Xcode/"; local_sdk_cache_str += dirname; FileSpec local_sdk_cache(local_sdk_cache_str.c_str(), true); - if (local_sdk_cache.Exists()) { - if (log) { + if (FileSystem::Instance().Exists(local_sdk_cache)) { + if (log) { log->Printf("PlatformRemoteDarwinDevice::UpdateSDKDirectoryInfosIfNeeded " "searching %s for additional SDKs", local_sdk_cache.GetPath().c_str()); - } + } char path[PATH_MAX]; if (local_sdk_cache.GetPath(path, sizeof(path))) { FileSystem::Instance().EnumerateDirectory( @@ -244,7 +245,7 @@ for (const auto &sdk_directory_info : env_var_sdk_directory_infos) { sdk_symbols_symlink_fspec = sdk_directory_info.directory; sdk_symbols_symlink_fspec.AppendPathComponent("Symbols"); - if (sdk_symbols_symlink_fspec.Exists()) { + if (FileSystem::Instance().Exists(sdk_symbols_symlink_fspec)) { m_sdk_directory_infos.push_back(sdk_directory_info); if (log) { log->Printf("PlatformRemoteDarwinDevice::UpdateSDKDirectoryInfosIfNeeded " @@ -424,7 +425,7 @@ local_file.AppendPathComponent(paths_to_try[i]); local_file.AppendPathComponent(platform_file_path); local_file.ResolvePath(); - if (local_file.Exists()) { + if (FileSystem::Instance().Exists(local_file)) { if (log) log->Printf("Found a copy of %s in the SDK dir %s/%s", platform_file_path, sdkroot_path.c_str(), @@ -453,7 +454,7 @@ platform_file_path); local_file.SetFile(resolved_path, true, FileSpec::Style::native); - if (local_file.Exists()) { + if (FileSystem::Instance().Exists(local_file)) { if (log) { log->Printf("Found a copy of %s in the DeviceSupport dir %s", platform_file_path, os_version_dir); @@ -465,7 +466,7 @@ os_version_dir, platform_file_path); local_file.SetFile(resolved_path, true, FileSpec::Style::native); - if (local_file.Exists()) { + if (FileSystem::Instance().Exists(local_file)) { if (log) { log->Printf( "Found a copy of %s in the DeviceSupport dir %s/Symbols.Internal", @@ -477,7 +478,7 @@ os_version_dir, platform_file_path); local_file.SetFile(resolved_path, true, FileSpec::Style::native); - if (local_file.Exists()) { + if (FileSystem::Instance().Exists(local_file)) { if (log) { log->Printf("Found a copy of %s in the DeviceSupport dir %s/Symbols", platform_file_path, os_version_dir); @@ -486,7 +487,7 @@ } } local_file = platform_file; - if (local_file.Exists()) + if (FileSystem::Instance().Exists(local_file)) return error; error.SetErrorStringWithFormat( Index: source/Plugins/Platform/MacOSX/PlatformiOSSimulator.cpp =================================================================== --- source/Plugins/Platform/MacOSX/PlatformiOSSimulator.cpp +++ source/Plugins/Platform/MacOSX/PlatformiOSSimulator.cpp @@ -196,7 +196,7 @@ // ourselves Host::ResolveExecutableInBundle(resolved_module_spec.GetFileSpec()); - if (resolved_module_spec.GetFileSpec().Exists()) { + if (FileSystem::Instance().Exists(resolved_module_spec.GetFileSpec())) { if (resolved_module_spec.GetArchitecture().IsValid()) { error = ModuleList::GetSharedModule(resolved_module_spec, exe_module_sp, NULL, NULL, NULL); @@ -322,12 +322,12 @@ // First try in the SDK and see if the file is in there local_file.SetFile(resolved_path, true, FileSpec::Style::native); - if (local_file.Exists()) + if (FileSystem::Instance().Exists(local_file)) return error; // Else fall back to the actual path itself local_file.SetFile(platform_file_path, true, FileSpec::Style::native); - if (local_file.Exists()) + if (FileSystem::Instance().Exists(local_file)) return error; } error.SetErrorStringWithFormat( Index: source/Plugins/Platform/POSIX/PlatformPOSIX.cpp =================================================================== --- source/Plugins/Platform/POSIX/PlatformPOSIX.cpp +++ source/Plugins/Platform/POSIX/PlatformPOSIX.cpp @@ -128,20 +128,20 @@ if (IsHost()) { // If we have "ls" as the exe_file, resolve the executable location based // on the current path variables - if (!resolved_module_spec.GetFileSpec().Exists()) { + if (!FileSystem::Instance().Exists(resolved_module_spec.GetFileSpec())) { resolved_module_spec.GetFileSpec().GetPath(exe_path, sizeof(exe_path)); resolved_module_spec.GetFileSpec().SetFile(exe_path, true, FileSpec::Style::native); } - if (!resolved_module_spec.GetFileSpec().Exists()) + if (!FileSystem::Instance().Exists(resolved_module_spec.GetFileSpec())) FileSystem::Instance().ResolveFileLocation( resolved_module_spec.GetFileSpec()); // Resolve any executable within a bundle on MacOSX Host::ResolveExecutableInBundle(resolved_module_spec.GetFileSpec()); - if (resolved_module_spec.GetFileSpec().Exists()) + if (FileSystem::Instance().Exists(resolved_module_spec.GetFileSpec())) error.Clear(); else { const uint32_t permissions = FileSystem::Instance().GetPermissions( @@ -167,7 +167,7 @@ // Resolve any executable within a bundle on MacOSX Host::ResolveExecutableInBundle(resolved_module_spec.GetFileSpec()); - if (resolved_module_spec.GetFileSpec().Exists()) + if (FileSystem::Instance().Exists(resolved_module_spec.GetFileSpec())) error.Clear(); else error.SetErrorStringWithFormat("the platform is not currently " @@ -466,7 +466,7 @@ bool PlatformPOSIX::GetFileExists(const FileSpec &file_spec) { if (IsHost()) - return file_spec.Exists(); + return FileSystem::Instance().Exists(file_spec); else if (m_remote_platform_sp) return m_remote_platform_sp->GetFileExists(file_spec); else Index: source/Plugins/Platform/Windows/PlatformWindows.cpp =================================================================== --- source/Plugins/Platform/Windows/PlatformWindows.cpp +++ source/Plugins/Platform/Windows/PlatformWindows.cpp @@ -192,17 +192,17 @@ if (IsHost()) { // if we cant resolve the executable loation based on the current path // variables - if (!resolved_module_spec.GetFileSpec().Exists()) { + if (!FileSystem::Instance().Exists(resolved_module_spec.GetFileSpec())) { resolved_module_spec.GetFileSpec().GetPath(exe_path, sizeof(exe_path)); resolved_module_spec.GetFileSpec().SetFile(exe_path, true, FileSpec::Style::native); } - if (!resolved_module_spec.GetFileSpec().Exists()) + if (!FileSystem::Instance().Exists(resolved_module_spec.GetFileSpec())) FileSystem::Instance().ResolveFileLocation( resolved_module_spec.GetFileSpec()); - if (resolved_module_spec.GetFileSpec().Exists()) + if (FileSystem::Instance().Exists(resolved_module_spec.GetFileSpec())) error.Clear(); else { ms.GetFileSpec().GetPath(exe_path, sizeof(exe_path)); @@ -216,7 +216,7 @@ } else { // We may connect to a process and use the provided executable (Don't use // local $PATH). - if (resolved_module_spec.GetFileSpec().Exists()) + if (FileSystem::Instance().Exists(resolved_module_spec.GetFileSpec())) error.Clear(); else error.SetErrorStringWithFormat("the platform is not currently " Index: source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.cpp =================================================================== --- source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.cpp +++ source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.cpp @@ -107,7 +107,7 @@ // Resolve any executable within an apk on Android? // Host::ResolveExecutableInBundle (resolved_module_spec.GetFileSpec()); - if (resolved_module_spec.GetFileSpec().Exists() || + if (FileSystem::Instance().Exists(resolved_module_spec.GetFileSpec()) || module_spec.GetUUID().IsValid()) { if (resolved_module_spec.GetArchitecture().IsValid() || resolved_module_spec.GetUUID().IsValid()) { Index: source/Plugins/Process/MacOSX-Kernel/ProcessKDP.cpp =================================================================== --- source/Plugins/Process/MacOSX-Kernel/ProcessKDP.cpp +++ source/Plugins/Process/MacOSX-Kernel/ProcessKDP.cpp @@ -300,7 +300,8 @@ if (module_spec.GetSymbolFileSpec()) { ModuleSpec executable_module_spec = Symbols::LocateExecutableObjectFile(module_spec); - if (executable_module_spec.GetFileSpec().Exists()) { + if (FileSystem::Instance().Exists( + executable_module_spec.GetFileSpec())) { module_spec.GetFileSpec() = executable_module_spec.GetFileSpec(); } @@ -309,7 +310,7 @@ !module_spec.GetSymbolFileSpec()) Symbols::DownloadObjectAndSymbolFile(module_spec, true); - if (module_spec.GetFileSpec().Exists()) { + if (FileSystem::Instance().Exists(module_spec.GetFileSpec())) { ModuleSP module_sp(new Module(module_spec)); if (module_sp.get() && module_sp->GetObjectFile()) { // Get the current target executable Index: source/Plugins/Process/elf-core/ProcessElfCore.cpp =================================================================== --- source/Plugins/Process/elf-core/ProcessElfCore.cpp +++ source/Plugins/Process/elf-core/ProcessElfCore.cpp @@ -81,7 +81,7 @@ bool ProcessElfCore::CanDebug(lldb::TargetSP target_sp, bool plugin_specified_by_name) { // For now we are just making sure the file exists for a given module - if (!m_core_module_sp && m_core_file.Exists()) { + if (!m_core_module_sp && FileSystem::Instance().Exists(m_core_file)) { ModuleSpec core_module_spec(m_core_file, target_sp->GetArchitecture()); Status error(ModuleList::GetSharedModule(core_module_spec, m_core_module_sp, NULL, NULL, NULL)); Index: source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp =================================================================== --- source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp +++ source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp @@ -18,6 +18,7 @@ // Other libraries and framework includes #include "lldb/Core/StreamFile.h" #include "lldb/Host/ConnectionFileDescriptor.h" +#include "lldb/Host/FileSystem.h" #include "lldb/Host/Host.h" #include "lldb/Host/HostInfo.h" #include "lldb/Host/Pipe.h" @@ -1005,13 +1006,14 @@ __FUNCTION__, env_debugserver_path); } else debugserver_file_spec = g_debugserver_file_spec; - bool debugserver_exists = debugserver_file_spec.Exists(); + bool debugserver_exists = + FileSystem::Instance().Exists(debugserver_file_spec); if (!debugserver_exists) { // The debugserver binary is in the LLDB.framework/Resources directory. debugserver_file_spec = HostInfo::GetSupportExeDir(); if (debugserver_file_spec) { debugserver_file_spec.AppendPathComponent(DEBUGSERVER_BASENAME); - debugserver_exists = debugserver_file_spec.Exists(); + debugserver_exists = FileSystem::Instance().Exists(debugserver_file_spec); if (debugserver_exists) { if (log) log->Printf( Index: source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp =================================================================== --- source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp +++ source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp @@ -3220,7 +3220,7 @@ if (m_debugged_process_up ->GetLoadedModuleFileSpec(module_path.c_str(), file_spec) .Success()) { - if (file_spec.Exists()) + if (FileSystem::Instance().Exists(file_spec)) return file_spec; } } Index: source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp =================================================================== --- source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp +++ source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp @@ -233,7 +233,7 @@ case ObjectFile::eTypeUnknown: break; } - return exe_module->GetFileSpec().Exists(); + return FileSystem::Instance().Exists(exe_module->GetFileSpec()); } // However, if there is no executable module, we return true since we might // be preparing to attach. @@ -439,7 +439,7 @@ FileSpec target_definition_fspec = GetGlobalPluginProperties()->GetTargetDefinitionFile(); - if (!target_definition_fspec.Exists()) { + if (!FileSystem::Instance().Exists(target_definition_fspec)) { // If the filename doesn't exist, it may be a ~ not having been expanded - // try to resolve it. target_definition_fspec.ResolvePath(); Index: source/Plugins/Process/mach-core/ProcessMachCore.cpp =================================================================== --- source/Plugins/Process/mach-core/ProcessMachCore.cpp +++ source/Plugins/Process/mach-core/ProcessMachCore.cpp @@ -90,7 +90,7 @@ return true; // For now we are just making sure the file exists for a given module - if (!m_core_module_sp && m_core_file.Exists()) { + if (!m_core_module_sp && FileSystem::Instance().Exists(m_core_file)) { // Don't add the Target's architecture to the ModuleSpec - we may be // working with a core file that doesn't have the correct cpusubtype in the // header but we should still try to use it - Index: source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp =================================================================== --- source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp +++ source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp @@ -1956,7 +1956,7 @@ StructuredData::ObjectSP ScriptInterpreterPython::LoadPluginModule(const FileSpec &file_spec, lldb_private::Status &error) { - if (!file_spec.Exists()) { + if (!FileSystem::Instance().Exists(file_spec)) { error.SetErrorString("no such file"); return StructuredData::ObjectSP(); } Index: source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp =================================================================== --- source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp +++ source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp @@ -1640,7 +1640,7 @@ dwo_file.AppendPathComponent(dwo_name); } - if (!dwo_file.Exists()) + if (!FileSystem::Instance().Exists(dwo_file)) return nullptr; const lldb::offset_t file_offset = 0; @@ -3879,7 +3879,7 @@ module_spec.GetSymbolFileSpec() = FileSpec(m_obj_file->GetFileSpec().GetPath() + ".dwp", false); FileSpec dwp_filespec = Symbols::LocateExecutableSymbolFile(module_spec); - if (dwp_filespec.Exists()) { + if (FileSystem::Instance().Exists(dwp_filespec)) { m_dwp_symfile = SymbolFileDWARFDwp::Create(GetObjectFile()->GetModule(), dwp_filespec); } Index: source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp =================================================================== --- source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp +++ source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp @@ -423,7 +423,7 @@ const char *oso_path = comp_unit_info->oso_path.GetCString(); FileSpec oso_file(oso_path, false); ConstString oso_object; - if (oso_file.Exists()) { + if (FileSystem::Instance().Exists(oso_file)) { auto oso_mod_time = FileSystem::Instance().GetModificationTime(oso_file); if (oso_mod_time != comp_unit_info->oso_mod_time) { obj_file->GetModule()->ReportError( Index: source/Plugins/SymbolVendor/MacOSX/SymbolVendorMacOSX.cpp =================================================================== --- source/Plugins/SymbolVendor/MacOSX/SymbolVendorMacOSX.cpp +++ source/Plugins/SymbolVendor/MacOSX/SymbolVendorMacOSX.cpp @@ -174,7 +174,7 @@ snprintf(dsym_uuid_plist_path, sizeof(dsym_uuid_plist_path), "%s%s.plist", dsym_path, uuid_str.c_str()); FileSpec dsym_uuid_plist_spec(dsym_uuid_plist_path, false); - if (dsym_uuid_plist_spec.Exists()) { + if (FileSystem::Instance().Exists(dsym_uuid_plist_spec)) { ApplePropertyList plist(dsym_uuid_plist_path); if (plist) { std::string DBGBuildSourcePath; Index: source/Symbol/ObjectFile.cpp =================================================================== --- source/Symbol/ObjectFile.cpp +++ source/Symbol/ObjectFile.cpp @@ -47,7 +47,7 @@ FileSpec archive_file; ObjectContainerCreateInstance create_object_container_callback; - const bool file_exists = file->Exists(); + const bool file_exists = FileSystem::Instance().Exists(*file); if (!data_sp) { // We have an object name which most likely means we have a .o file in // a static archive (.a file). Try and see if we have a cached archive @@ -584,7 +584,7 @@ regex_match.GetMatchAtIndex(path_with_object, 2, obj)) { archive_file.SetFile(path, false, FileSpec::Style::native); archive_object.SetCString(obj.c_str()); - if (must_exist && !archive_file.Exists()) + if (must_exist && !FileSystem::Instance().Exists(archive_file)) return false; return true; } Index: source/Target/ModuleCache.cpp =================================================================== --- source/Target/ModuleCache.cpp +++ source/Target/ModuleCache.cpp @@ -133,7 +133,7 @@ const auto sysroot_module_path_spec = JoinPath(JoinPath(root_dir_spec, hostname), platform_module_spec.GetPath().c_str()); - if (sysroot_module_path_spec.Exists()) { + if (FileSystem::Instance().Exists(sysroot_module_path_spec)) { if (!delete_existing) return Status(); @@ -225,7 +225,7 @@ const auto module_file_path = JoinPath( module_spec_dir, module_spec.GetFileSpec().GetFilename().AsCString()); - if (!module_file_path.Exists()) + if (!FileSystem::Instance().Exists(module_file_path)) return Status("Module %s not found", module_file_path.GetPath().c_str()); if (FileSystem::Instance().GetByteSize(module_file_path) != module_spec.GetObjectSize()) @@ -253,7 +253,7 @@ return error; FileSpec symfile_spec = GetSymbolFileSpec(cached_module_sp->GetFileSpec()); - if (symfile_spec.Exists()) + if (FileSystem::Instance().Exists(symfile_spec)) cached_module_sp->SetSymbolFileFileSpec(symfile_spec); m_loaded_modules.insert( Index: source/Target/PathMappingList.cpp =================================================================== --- source/Target/PathMappingList.cpp +++ source/Target/PathMappingList.cpp @@ -14,12 +14,13 @@ // Other libraries and framework includes // Project includes -#include "lldb/lldb-private-enumerations.h" +#include "lldb/Host/FileSystem.h" #include "lldb/Host/PosixApi.h" #include "lldb/Target/PathMappingList.h" #include "lldb/Utility/FileSpec.h" #include "lldb/Utility/Status.h" #include "lldb/Utility/Stream.h" +#include "lldb/lldb-private-enumerations.h" using namespace lldb; using namespace lldb_private; @@ -219,7 +220,7 @@ new_spec.SetFile(pos->second.GetCString(), false, FileSpec::Style::native); new_spec.AppendPathComponent(orig_path + prefix_len); - if (new_spec.Exists()) + if (FileSystem::Instance().Exists(new_spec)) return true; } } Index: source/Target/Platform.cpp =================================================================== --- source/Target/Platform.cpp +++ source/Target/Platform.cpp @@ -890,7 +890,7 @@ lldb::ModuleSP &exe_module_sp, const FileSpecList *module_search_paths_ptr) { Status error; - if (module_spec.GetFileSpec().Exists()) { + if (FileSystem::Instance().Exists(module_spec.GetFileSpec())) { if (module_spec.GetArchitecture().IsValid()) { error = ModuleList::GetSharedModule(module_spec, exe_module_sp, module_search_paths_ptr, nullptr, @@ -921,7 +921,7 @@ Status Platform::ResolveSymbolFile(Target &target, const ModuleSpec &sym_spec, FileSpec &sym_file) { Status error; - if (sym_spec.GetSymbolFileSpec().Exists()) + if (FileSystem::Instance().Exists(sym_spec.GetSymbolFileSpec())) sym_file = sym_spec.GetSymbolFileSpec(); else error.SetErrorString("unable to resolve symbol file"); Index: source/Target/Process.cpp =================================================================== --- source/Target/Process.cpp +++ source/Target/Process.cpp @@ -2734,7 +2734,7 @@ sizeof(local_exec_file_path)); exe_module->GetPlatformFileSpec().GetPath(platform_exec_file_path, sizeof(platform_exec_file_path)); - if (exe_module->GetFileSpec().Exists()) { + if (FileSystem::Instance().Exists(exe_module->GetFileSpec())) { // Install anything that might need to be installed prior to launching. // For host systems, this will do nothing, but if we are connected to a // remote platform it will install any needed binaries Index: source/Target/TargetList.cpp =================================================================== --- source/Target/TargetList.cpp +++ source/Target/TargetList.cpp @@ -347,7 +347,7 @@ arch = specified_arch; FileSpec file(user_exe_path, false); - if (!file.Exists() && user_exe_path.startswith("~")) { + if (!FileSystem::Instance().Exists(file) && user_exe_path.startswith("~")) { // we want to expand the tilde but we don't want to resolve any symbolic // links so we can't use the FileSpec constructor's resolve flag llvm::SmallString<64> unglobbed_path; @@ -372,7 +372,7 @@ if (! llvm::sys::fs::current_path(cwd)) { FileSpec cwd_file(cwd.c_str(), false); cwd_file.AppendPathComponent(file); - if (cwd_file.Exists()) + if (FileSystem::Instance().Exists(cwd_file)) file = cwd_file; } } Index: source/Utility/FileSpec.cpp =================================================================== --- source/Utility/FileSpec.cpp +++ source/Utility/FileSpec.cpp @@ -453,11 +453,6 @@ } } -//------------------------------------------------------------------ -// Returns true if the file exists. -//------------------------------------------------------------------ -bool FileSpec::Exists() const { return llvm::sys::fs::exists(GetPath()); } - bool FileSpec::ResolvePath() { if (m_is_resolved) return true; // We have already resolved this path Index: source/Utility/StructuredData.cpp =================================================================== --- source/Utility/StructuredData.cpp +++ source/Utility/StructuredData.cpp @@ -33,11 +33,6 @@ StructuredData::ObjectSP StructuredData::ParseJSONFromFile(const FileSpec &input_spec, Status &error) { StructuredData::ObjectSP return_sp; - if (!input_spec.Exists()) { - error.SetErrorStringWithFormatv("input file {0} does not exist.", - input_spec); - return return_sp; - } auto buffer_or_error = llvm::MemoryBuffer::getFile(input_spec.GetPath()); if (!buffer_or_error) { Index: unittests/Target/ModuleCacheTest.cpp =================================================================== --- unittests/Target/ModuleCacheTest.cpp +++ unittests/Target/ModuleCacheTest.cpp @@ -79,12 +79,13 @@ static void VerifyDiskState(const FileSpec &cache_dir, const char *hostname) { FileSpec uuid_view = GetUuidView(cache_dir); - EXPECT_TRUE(uuid_view.Exists()) << "uuid_view is: " << uuid_view.GetCString(); + EXPECT_TRUE(FileSystem::Instance().Exists(uuid_view)) + << "uuid_view is: " << uuid_view.GetCString(); EXPECT_EQ(module_size, FileSystem::Instance().GetByteSize(uuid_view)); FileSpec sysroot_view = GetSysrootView(cache_dir, hostname); - EXPECT_TRUE(sysroot_view.Exists()) << "sysroot_view is: " - << sysroot_view.GetCString(); + EXPECT_TRUE(FileSystem::Instance().Exists(sysroot_view)) + << "sysroot_view is: " << sysroot_view.GetCString(); EXPECT_EQ(module_size, FileSystem::Instance().GetByteSize(sysroot_view)); }