summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lldb/include/lldb/Utility/FileSpec.h8
-rw-r--r--lldb/source/API/SBDebugger.cpp2
-rw-r--r--lldb/source/API/SBFileSpec.cpp2
-rw-r--r--lldb/source/Commands/CommandObjectMemory.cpp2
-rw-r--r--lldb/source/Commands/CommandObjectPlatform.cpp2
-rw-r--r--lldb/source/Commands/CommandObjectTarget.cpp18
-rw-r--r--lldb/source/Core/Debugger.cpp6
-rw-r--r--lldb/source/Core/DynamicLoader.cpp2
-rw-r--r--lldb/source/Core/Module.cpp5
-rw-r--r--lldb/source/Core/ModuleList.cpp8
-rw-r--r--lldb/source/Core/PluginManager.cpp6
-rw-r--r--lldb/source/Core/SourceManager.cpp4
-rw-r--r--lldb/source/Host/common/HostInfoBase.cpp2
-rw-r--r--lldb/source/Host/common/Symbols.cpp34
-rw-r--r--lldb/source/Host/macosx/Symbols.cpp17
-rw-r--r--lldb/source/Host/macosx/objcxx/Host.mm6
-rw-r--r--lldb/source/Interpreter/CommandInterpreter.cpp8
-rw-r--r--lldb/source/Interpreter/OptionValuePathMappings.cpp3
-rw-r--r--lldb/source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.cpp2
-rw-r--r--lldb/source/Plugins/DynamicLoader/Hexagon-DYLD/DynamicLoaderHexagonDYLD.cpp2
-rw-r--r--lldb/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp4
-rw-r--r--lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp23
-rw-r--r--lldb/source/Plugins/OperatingSystem/Python/OperatingSystemPython.cpp3
-rw-r--r--lldb/source/Plugins/Platform/MacOSX/PlatformAppleTVSimulator.cpp6
-rw-r--r--lldb/source/Plugins/Platform/MacOSX/PlatformAppleWatchSimulator.cpp6
-rw-r--r--lldb/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp32
-rw-r--r--lldb/source/Plugins/Platform/MacOSX/PlatformDarwinKernel.cpp6
-rw-r--r--lldb/source/Plugins/Platform/MacOSX/PlatformMacOSX.cpp8
-rw-r--r--lldb/source/Plugins/Platform/MacOSX/PlatformRemoteDarwinDevice.cpp23
-rw-r--r--lldb/source/Plugins/Platform/MacOSX/PlatformiOSSimulator.cpp6
-rw-r--r--lldb/source/Plugins/Platform/POSIX/PlatformPOSIX.cpp10
-rw-r--r--lldb/source/Plugins/Platform/Windows/PlatformWindows.cpp8
-rw-r--r--lldb/source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.cpp2
-rw-r--r--lldb/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.cpp5
-rw-r--r--lldb/source/Plugins/Process/elf-core/ProcessElfCore.cpp2
-rw-r--r--lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp6
-rw-r--r--lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp2
-rw-r--r--lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp4
-rw-r--r--lldb/source/Plugins/Process/mach-core/ProcessMachCore.cpp2
-rw-r--r--lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp2
-rw-r--r--lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp4
-rw-r--r--lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp2
-rw-r--r--lldb/source/Plugins/SymbolVendor/MacOSX/SymbolVendorMacOSX.cpp2
-rw-r--r--lldb/source/Symbol/ObjectFile.cpp4
-rw-r--r--lldb/source/Target/ModuleCache.cpp6
-rw-r--r--lldb/source/Target/PathMappingList.cpp5
-rw-r--r--lldb/source/Target/Platform.cpp4
-rw-r--r--lldb/source/Target/Process.cpp2
-rw-r--r--lldb/source/Target/TargetList.cpp4
-rw-r--r--lldb/source/Utility/FileSpec.cpp5
-rw-r--r--lldb/source/Utility/StructuredData.cpp5
-rw-r--r--lldb/unittests/Target/ModuleCacheTest.cpp7
52 files changed, 178 insertions, 171 deletions
diff --git a/lldb/include/lldb/Utility/FileSpec.h b/lldb/include/lldb/Utility/FileSpec.h
index 53c5b4ba35a..206753582f5 100644
--- a/lldb/include/lldb/Utility/FileSpec.h
+++ b/lldb/include/lldb/Utility/FileSpec.h
@@ -273,14 +273,6 @@ public:
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
/// the file path when you set the file.
diff --git a/lldb/source/API/SBDebugger.cpp b/lldb/source/API/SBDebugger.cpp
index 99afa3652ed..ad6147d261f 100644
--- a/lldb/source/API/SBDebugger.cpp
+++ b/lldb/source/API/SBDebugger.cpp
@@ -90,7 +90,7 @@ static llvm::sys::DynamicLibrary LoadPlugin(const lldb::DebuggerSP &debugger_sp,
"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");
diff --git a/lldb/source/API/SBFileSpec.cpp b/lldb/source/API/SBFileSpec.cpp
index 027528c46ca..067db0d6255 100644
--- a/lldb/source/API/SBFileSpec.cpp
+++ b/lldb/source/API/SBFileSpec.cpp
@@ -51,7 +51,7 @@ bool SBFileSpec::IsValid() const { return m_opaque_ap->operator bool(); }
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",
diff --git a/lldb/source/Commands/CommandObjectMemory.cpp b/lldb/source/Commands/CommandObjectMemory.cpp
index 9630658c262..5fbc6221dfb 100644
--- a/lldb/source/Commands/CommandObjectMemory.cpp
+++ b/lldb/source/Commands/CommandObjectMemory.cpp
@@ -1210,7 +1210,7 @@ public:
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());
diff --git a/lldb/source/Commands/CommandObjectPlatform.cpp b/lldb/source/Commands/CommandObjectPlatform.cpp
index c8fe3fe9693..b800174106b 100644
--- a/lldb/source/Commands/CommandObjectPlatform.cpp
+++ b/lldb/source/Commands/CommandObjectPlatform.cpp
@@ -1818,7 +1818,7 @@ public:
// 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;
diff --git a/lldb/source/Commands/CommandObjectTarget.cpp b/lldb/source/Commands/CommandObjectTarget.cpp
index 524df3a303d..de9526d94d4 100644
--- a/lldb/source/Commands/CommandObjectTarget.cpp
+++ b/lldb/source/Commands/CommandObjectTarget.cpp
@@ -274,7 +274,7 @@ protected:
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 @@ protected:
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 @@ protected:
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 @@ protected:
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 @@ protected:
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 @@ protected:
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 @@ protected:
module_spec.GetArchitecture() = target->GetArchitecture();
}
success |= module_spec.GetUUID().IsValid() ||
- module_spec.GetFileSpec().Exists();
+ FileSystem::Instance().Exists(module_spec.GetFileSpec());
}
}
@@ -4362,7 +4363,8 @@ protected:
}
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))
diff --git a/lldb/source/Core/Debugger.cpp b/lldb/source/Core/Debugger.cpp
index a0fc729487e..5b88246017a 100644
--- a/lldb/source/Core/Debugger.cpp
+++ b/lldb/source/Core/Debugger.cpp
@@ -656,7 +656,8 @@ void Debugger::InstanceInitialize() {
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 @@ void Debugger::InstanceInitialize() {
}
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);
diff --git a/lldb/source/Core/DynamicLoader.cpp b/lldb/source/Core/DynamicLoader.cpp
index 576ec1eaedd..f1bc6ddbea4 100644
--- a/lldb/source/Core/DynamicLoader.cpp
+++ b/lldb/source/Core/DynamicLoader.cpp
@@ -81,7 +81,7 @@ ModuleSP DynamicLoader::GetTargetExecutable() {
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>(module_spec);
diff --git a/lldb/source/Core/Module.cpp b/lldb/source/Core/Module.cpp
index 710b251a7e8..914e34e3612 100644
--- a/lldb/source/Core/Module.cpp
+++ b/lldb/source/Core/Module.cpp
@@ -1418,7 +1418,7 @@ void Module::PreloadSymbols() {
}
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 @@ bool Module::LoadScriptingResourceInTarget(Target *target, Status &error,
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(
diff --git a/lldb/source/Core/ModuleList.cpp b/lldb/source/Core/ModuleList.cpp
index 2737c0c6cb7..01d5da7cb3b 100644
--- a/lldb/source/Core/ModuleList.cpp
+++ b/lldb/source/Core/ModuleList.cpp
@@ -864,7 +864,7 @@ Status ModuleList::GetSharedModule(const ModuleSpec &module_spec,
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 @@ Status ModuleList::GetSharedModule(const ModuleSpec &module_spec,
// 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();
diff --git a/lldb/source/Core/PluginManager.cpp b/lldb/source/Core/PluginManager.cpp
index 6c4056687fb..f0a81117293 100644
--- a/lldb/source/Core/PluginManager.cpp
+++ b/lldb/source/Core/PluginManager.cpp
@@ -163,7 +163,8 @@ void PluginManager::Initialize() {
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 @@ void PluginManager::Initialize() {
}
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);
diff --git a/lldb/source/Core/SourceManager.cpp b/lldb/source/Core/SourceManager.cpp
index 05e1cc1376f..58c414b4346 100644
--- a/lldb/source/Core/SourceManager.cpp
+++ b/lldb/source/Core/SourceManager.cpp
@@ -92,7 +92,7 @@ SourceManager::FileSP SourceManager::GetFile(const FileSpec &file_spec) {
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>(file_spec, target_sp.get());
else
@@ -427,7 +427,7 @@ void SourceManager::File::CommonInitializer(const FileSpec &file_spec,
}
}
// 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
diff --git a/lldb/source/Host/common/HostInfoBase.cpp b/lldb/source/Host/common/HostInfoBase.cpp
index 42454afef5f..07058d3879d 100644
--- a/lldb/source/Host/common/HostInfoBase.cpp
+++ b/lldb/source/Host/common/HostInfoBase.cpp
@@ -42,7 +42,7 @@ namespace {
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.
diff --git a/lldb/source/Host/common/Symbols.cpp b/lldb/source/Host/common/Symbols.cpp
index 61c76d25f65..bfa3ea39d76 100644
--- a/lldb/source/Host/common/Symbols.cpp
+++ b/lldb/source/Host/common/Symbols.cpp
@@ -85,17 +85,16 @@ static bool LookForDsymNextToExecutablePath(const ModuleSpec &mod_spec,
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 @@ static bool LookForDsymNextToExecutablePath(const ModuleSpec &mod_spec,
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 @@ static bool LookForDsymNextToExecutablePath(const ModuleSpec &mod_spec,
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 @@ ModuleSpec Symbols::LocateExecutableObjectFile(const ModuleSpec &module_spec) {
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 @@ FileSpec Symbols::LocateExecutableSymbolFile(const ModuleSpec &module_spec) {
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);
diff --git a/lldb/source/Host/macosx/Symbols.cpp b/lldb/source/Host/macosx/Symbols.cpp
index c39756f9005..7193a7ebc56 100644
--- a/lldb/source/Host/macosx/Symbols.cpp
+++ b/lldb/source/Host/macosx/Symbols.cpp
@@ -147,7 +147,7 @@ int LocateMacOSXFilesUsingDebugSymbols(const ModuleSpec &module_spec,
}
++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 @@ bool Symbols::DownloadObjectAndSymbolFile(ModuleSpec &module_spec,
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 @@ bool Symbols::DownloadObjectAndSymbolFile(ModuleSpec &module_spec,
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 @@ bool Symbols::DownloadObjectAndSymbolFile(ModuleSpec &module_spec,
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 @@ bool Symbols::DownloadObjectAndSymbolFile(ModuleSpec &module_spec,
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)
diff --git a/lldb/source/Host/macosx/objcxx/Host.mm b/lldb/source/Host/macosx/objcxx/Host.mm
index c113a17f20f..0e39a58602b 100644
--- a/lldb/source/Host/macosx/objcxx/Host.mm
+++ b/lldb/source/Host/macosx/objcxx/Host.mm
@@ -226,7 +226,7 @@ LaunchInNewTerminalWithAppleScript(const char *exe_path,
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 @@ Status Host::ShellExpandArguments(ProcessLaunchInfo &launch_info) {
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 @@ Status Host::ShellExpandArguments(ProcessLaunchInfo &launch_info) {
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(
diff --git a/lldb/source/Interpreter/CommandInterpreter.cpp b/lldb/source/Interpreter/CommandInterpreter.cpp
index 0d6a7b78b58..8f38517f629 100644
--- a/lldb/source/Interpreter/CommandInterpreter.cpp
+++ b/lldb/source/Interpreter/CommandInterpreter.cpp
@@ -2093,7 +2093,7 @@ void CommandInterpreter::SourceInitFile(bool in_cwd,
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 @@ void CommandInterpreter::SourceInitFile(bool in_cwd,
"%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 @@ void CommandInterpreter::SourceInitFile(bool in_cwd,
// 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 @@ enum {
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();
diff --git a/lldb/source/Interpreter/OptionValuePathMappings.cpp b/lldb/source/Interpreter/OptionValuePathMappings.cpp
index 8390a8cf5ab..baed0a226a9 100644
--- a/lldb/source/Interpreter/OptionValuePathMappings.cpp
+++ b/lldb/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 @@ using namespace lldb_private;
namespace {
static bool VerifyPathExists(const char *path) {
if (path && path[0])
- return FileSpec(path, false).Exists();
+ return FileSystem::Instance().Exists(path);
else
return false;
}
diff --git a/lldb/source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.cpp b/lldb/source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.cpp
index 5542dbe7dae..65bc051e03c 100644
--- a/lldb/source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.cpp
+++ b/lldb/source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.cpp
@@ -784,7 +784,7 @@ bool DynamicLoaderDarwinKernel::KextImageInfo::LoadImageUsingMemoryModule(
// 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() &&
diff --git a/lldb/source/Plugins/DynamicLoader/Hexagon-DYLD/DynamicLoaderHexagonDYLD.cpp b/lldb/source/Plugins/DynamicLoader/Hexagon-DYLD/DynamicLoaderHexagonDYLD.cpp
index e6d3477ed7e..648c16941b5 100644
--- a/lldb/source/Plugins/DynamicLoader/Hexagon-DYLD/DynamicLoaderHexagonDYLD.cpp
+++ b/lldb/source/Plugins/DynamicLoader/Hexagon-DYLD/DynamicLoaderHexagonDYLD.cpp
@@ -179,7 +179,7 @@ ModuleSP DynamicLoaderHexagonDYLD::GetTargetExecutable() {
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
diff --git a/lldb/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp b/lldb/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp
index 363745f0707..8302a45166b 100644
--- a/lldb/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp
+++ b/lldb/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp
@@ -2530,7 +2530,7 @@ bool RenderScriptRuntime::LoadAllocation(Stream &strm, const uint32_t alloc_id,
// 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 @@ public:
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());
diff --git a/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp b/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
index e2939f4f10e..b15094e0769 100644
--- a/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
+++ b/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
@@ -2636,7 +2636,7 @@ size_t ObjectFileMachO::ParseSymtab() {
// 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 @@ size_t ObjectFileMachO::ParseSymtab() {
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 @@ size_t ObjectFileMachO::ParseSymtab() {
// 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 @@ size_t ObjectFileMachO::ParseSymtab() {
// 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 @@ size_t ObjectFileMachO::ParseSymtab() {
// 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 @@ uint32_t ObjectFileMachO::GetDependentModules(FileSpecList &files) {
// 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 @@ uint32_t ObjectFileMachO::GetDependentModules(FileSpecList &files) {
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++;
}
}
diff --git a/lldb/source/Plugins/OperatingSystem/Python/OperatingSystemPython.cpp b/lldb/source/Plugins/OperatingSystem/Python/OperatingSystemPython.cpp
index 0134aed8165..fc1431047c9 100644
--- a/lldb/source/Plugins/OperatingSystem/Python/OperatingSystemPython.cpp
+++ b/lldb/source/Plugins/OperatingSystem/Python/OperatingSystemPython.cpp
@@ -53,7 +53,8 @@ OperatingSystem *OperatingSystemPython::CreateInstance(Process *process,
// 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<OperatingSystemPython> os_ap(
new OperatingSystemPython(process, python_os_plugin_spec));
if (os_ap.get() && os_ap->IsValid())
diff --git a/lldb/source/Plugins/Platform/MacOSX/PlatformAppleTVSimulator.cpp b/lldb/source/Plugins/Platform/MacOSX/PlatformAppleTVSimulator.cpp
index 72cac263032..f447e14d29e 100644
--- a/lldb/source/Plugins/Platform/MacOSX/PlatformAppleTVSimulator.cpp
+++ b/lldb/source/Plugins/Platform/MacOSX/PlatformAppleTVSimulator.cpp
@@ -190,7 +190,7 @@ Status PlatformAppleTVSimulator::ResolveExecutable(
// 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 @@ Status PlatformAppleTVSimulator::GetSymbolFile(const FileSpec &platform_file,
// 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(
diff --git a/lldb/source/Plugins/Platform/MacOSX/PlatformAppleWatchSimulator.cpp b/lldb/source/Plugins/Platform/MacOSX/PlatformAppleWatchSimulator.cpp
index 71dc807474b..9f8aea1e32f 100644
--- a/lldb/source/Plugins/Platform/MacOSX/PlatformAppleWatchSimulator.cpp
+++ b/lldb/source/Plugins/Platform/MacOSX/PlatformAppleWatchSimulator.cpp
@@ -190,7 +190,7 @@ Status PlatformAppleWatchSimulator::ResolveExecutable(
// 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 @@ Status PlatformAppleWatchSimulator::GetSymbolFile(const FileSpec &platform_file,
// 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(
diff --git a/lldb/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp b/lldb/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp
index 9c4e89d0bed..1038eef57bc 100644
--- a/lldb/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp
+++ b/lldb/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp
@@ -88,7 +88,7 @@ FileSpecList PlatformDarwin::LocateExecutableScriptingResources(
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 @@ FileSpecList PlatformDarwin::LocateExecutableScriptingResources(
// 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 @@ FileSpecList PlatformDarwin::LocateExecutableScriptingResources(
}
}
- if (script_fspec.Exists()) {
+ if (FileSystem::Instance().Exists(script_fspec)) {
file_list.Append(script_fspec);
break;
}
@@ -270,7 +270,7 @@ lldb_private::Status PlatformDarwin::GetSharedModuleWithLocalCache(
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 @@ lldb_private::Status PlatformDarwin::GetSharedModuleWithLocalCache(
}
// 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 @@ lldb_private::Status PlatformDarwin::GetSharedModuleWithLocalCache(
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 @@ Status PlatformDarwin::GetSharedModule(
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 @@ const char *PlatformDarwin::GetDeveloperDirectory() {
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 @@ const char *PlatformDarwin::GetDeveloperDirectory() {
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 const char *const sdk_strings[] = {
};
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 @@ static FileSpec CheckPathForXcode(const FileSpec &fspec) {
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 @@ FileSpec PlatformDarwin::GetSDKDirectoryForModules(SDKType sdk_type) {
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 @@ lldb_private::FileSpec PlatformDarwin::LocateExecutable(const char *basename) {
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 @@ lldb_private::FileSpec PlatformDarwin::LocateExecutable(const char *basename) {
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 @@ PlatformDarwin::FindBundleBinaryInExecSearchPaths (const ModuleSpec &module_spec
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(
diff --git a/lldb/source/Plugins/Platform/MacOSX/PlatformDarwinKernel.cpp b/lldb/source/Plugins/Platform/MacOSX/PlatformDarwinKernel.cpp
index 681e510ed25..3a049765624 100644
--- a/lldb/source/Plugins/Platform/MacOSX/PlatformDarwinKernel.cpp
+++ b/lldb/source/Plugins/Platform/MacOSX/PlatformDarwinKernel.cpp
@@ -719,7 +719,7 @@ Status PlatformDarwinKernel::GetSharedModule(
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 @@ Status PlatformDarwinKernel::GetSharedModule(
// 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 @@ Status PlatformDarwinKernel::ExamineKextForMatchingUUID(
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()) {
diff --git a/lldb/source/Plugins/Platform/MacOSX/PlatformMacOSX.cpp b/lldb/source/Plugins/Platform/MacOSX/PlatformMacOSX.cpp
index 99f603b01f4..f2f95af340e 100644
--- a/lldb/source/Plugins/Platform/MacOSX/PlatformMacOSX.cpp
+++ b/lldb/source/Plugins/Platform/MacOSX/PlatformMacOSX.cpp
@@ -219,13 +219,13 @@ ConstString PlatformMacOSX::GetSDKDirectory(lldb_private::Target &target) {
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 @@ PlatformMacOSX::GetFileWithUUID(const lldb_private::FileSpec &platform_file,
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 @@ PlatformMacOSX::GetFileWithUUID(const lldb_private::FileSpec &platform_file,
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
diff --git a/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteDarwinDevice.cpp b/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteDarwinDevice.cpp
index 88a181b0f1e..2dd0a2566a1 100644
--- a/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteDarwinDevice.cpp
+++ b/lldb/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 @@ Status PlatformRemoteDarwinDevice::ResolveExecutable(
// 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 @@ bool PlatformRemoteDarwinDevice::UpdateSDKDirectoryInfosIfNeeded() {
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 @@ bool PlatformRemoteDarwinDevice::UpdateSDKDirectoryInfosIfNeeded() {
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 @@ bool PlatformRemoteDarwinDevice::UpdateSDKDirectoryInfosIfNeeded() {
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 @@ bool PlatformRemoteDarwinDevice::GetFileInSDK(const char *platform_file_path,
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 @@ Status PlatformRemoteDarwinDevice::GetSymbolFile(const FileSpec &platform_file,
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 @@ Status PlatformRemoteDarwinDevice::GetSymbolFile(const FileSpec &platform_file,
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 @@ Status PlatformRemoteDarwinDevice::GetSymbolFile(const FileSpec &platform_file,
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 @@ Status PlatformRemoteDarwinDevice::GetSymbolFile(const FileSpec &platform_file,
}
}
local_file = platform_file;
- if (local_file.Exists())
+ if (FileSystem::Instance().Exists(local_file))
return error;
error.SetErrorStringWithFormat(
diff --git a/lldb/source/Plugins/Platform/MacOSX/PlatformiOSSimulator.cpp b/lldb/source/Plugins/Platform/MacOSX/PlatformiOSSimulator.cpp
index af90f29efb0..212edded0df 100644
--- a/lldb/source/Plugins/Platform/MacOSX/PlatformiOSSimulator.cpp
+++ b/lldb/source/Plugins/Platform/MacOSX/PlatformiOSSimulator.cpp
@@ -196,7 +196,7 @@ Status PlatformiOSSimulator::ResolveExecutable(
// 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 @@ Status PlatformiOSSimulator::GetSymbolFile(const FileSpec &platform_file,
// 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(
diff --git a/lldb/source/Plugins/Platform/POSIX/PlatformPOSIX.cpp b/lldb/source/Plugins/Platform/POSIX/PlatformPOSIX.cpp
index 996bd2671da..78761f53d4f 100644
--- a/lldb/source/Plugins/Platform/POSIX/PlatformPOSIX.cpp
+++ b/lldb/source/Plugins/Platform/POSIX/PlatformPOSIX.cpp
@@ -128,20 +128,20 @@ PlatformPOSIX::ResolveExecutable(const ModuleSpec &module_spec,
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().ResolveExecutableLocation(
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 @@ PlatformPOSIX::ResolveExecutable(const ModuleSpec &module_spec,
// 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 @@ Status PlatformPOSIX::CreateSymlink(const FileSpec &src, const FileSpec &dst) {
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
diff --git a/lldb/source/Plugins/Platform/Windows/PlatformWindows.cpp b/lldb/source/Plugins/Platform/Windows/PlatformWindows.cpp
index a4e590e2053..9eb24ba180c 100644
--- a/lldb/source/Plugins/Platform/Windows/PlatformWindows.cpp
+++ b/lldb/source/Plugins/Platform/Windows/PlatformWindows.cpp
@@ -192,17 +192,17 @@ Status PlatformWindows::ResolveExecutable(
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().ResolveExecutableLocation(
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 @@ Status PlatformWindows::ResolveExecutable(
} 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 "
diff --git a/lldb/source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.cpp b/lldb/source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.cpp
index 1a9dc924b5b..eec5b419324 100644
--- a/lldb/source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.cpp
+++ b/lldb/source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.cpp
@@ -107,7 +107,7 @@ Status PlatformRemoteGDBServer::ResolveExecutable(
// 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()) {
diff --git a/lldb/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.cpp b/lldb/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.cpp
index 2f174932f7a..a8914593afa 100644
--- a/lldb/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.cpp
+++ b/lldb/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.cpp
@@ -300,7 +300,8 @@ Status ProcessKDP::DoConnectRemote(Stream *strm, llvm::StringRef remote_url) {
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 @@ Status ProcessKDP::DoConnectRemote(Stream *strm, llvm::StringRef remote_url) {
!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
diff --git a/lldb/source/Plugins/Process/elf-core/ProcessElfCore.cpp b/lldb/source/Plugins/Process/elf-core/ProcessElfCore.cpp
index 0dfc4f16eb0..0f0febaa842 100644
--- a/lldb/source/Plugins/Process/elf-core/ProcessElfCore.cpp
+++ b/lldb/source/Plugins/Process/elf-core/ProcessElfCore.cpp
@@ -81,7 +81,7 @@ lldb::ProcessSP ProcessElfCore::CreateInstance(lldb::TargetSP target_sp,
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));
diff --git a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp
index c335b600286..c4f0a673b3a 100644
--- a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp
+++ b/lldb/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 @@ Status GDBRemoteCommunication::StartDebugserverProcess(
__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(
diff --git a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp
index 618f980f3dd..0585663a5e5 100644
--- a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp
+++ b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp
@@ -3220,7 +3220,7 @@ GDBRemoteCommunicationServerLLGS::FindModuleFile(const std::string &module_path,
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;
}
}
diff --git a/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp b/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
index 05f269a416b..0f484a62f97 100644
--- a/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
+++ b/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
@@ -233,7 +233,7 @@ bool ProcessGDBRemote::CanDebug(lldb::TargetSP target_sp,
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 @@ void ProcessGDBRemote::BuildDynamicRegisterInfo(bool force) {
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();
diff --git a/lldb/source/Plugins/Process/mach-core/ProcessMachCore.cpp b/lldb/source/Plugins/Process/mach-core/ProcessMachCore.cpp
index 60a7077a61d..6234c5c5bd7 100644
--- a/lldb/source/Plugins/Process/mach-core/ProcessMachCore.cpp
+++ b/lldb/source/Plugins/Process/mach-core/ProcessMachCore.cpp
@@ -90,7 +90,7 @@ bool ProcessMachCore::CanDebug(lldb::TargetSP target_sp,
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 -
diff --git a/lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp b/lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp
index 7fb9f50d939..621db71458f 100644
--- a/lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp
+++ b/lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp
@@ -2017,7 +2017,7 @@ ScriptInterpreterPython::ScriptedBreakpointResolverSearchDepth(
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();
}
diff --git a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
index 2a2448c3b8f..1a852fcd220 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
+++ b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
@@ -1640,7 +1640,7 @@ SymbolFileDWARF::GetDwoSymbolFileForCompileUnit(
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 @@ SymbolFileDWARFDwp *SymbolFileDWARF::GetDwpSymbolFile() {
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);
}
diff --git a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp
index b376f9017c3..150a6f76c11 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp
+++ b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp
@@ -423,7 +423,7 @@ Module *SymbolFileDWARFDebugMap::GetModuleByCompUnitInfo(
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(
diff --git a/lldb/source/Plugins/SymbolVendor/MacOSX/SymbolVendorMacOSX.cpp b/lldb/source/Plugins/SymbolVendor/MacOSX/SymbolVendorMacOSX.cpp
index 36d7e1eafc1..a257edf3818 100644
--- a/lldb/source/Plugins/SymbolVendor/MacOSX/SymbolVendorMacOSX.cpp
+++ b/lldb/source/Plugins/SymbolVendor/MacOSX/SymbolVendorMacOSX.cpp
@@ -174,7 +174,7 @@ SymbolVendorMacOSX::CreateInstance(const lldb::ModuleSP &module_sp,
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;
diff --git a/lldb/source/Symbol/ObjectFile.cpp b/lldb/source/Symbol/ObjectFile.cpp
index a5cd36d6e65..846ac779369 100644
--- a/lldb/source/Symbol/ObjectFile.cpp
+++ b/lldb/source/Symbol/ObjectFile.cpp
@@ -47,7 +47,7 @@ ObjectFile::FindPlugin(const lldb::ModuleSP &module_sp, const FileSpec *file,
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 @@ bool ObjectFile::SplitArchivePathWithObject(const char *path_with_object,
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;
}
diff --git a/lldb/source/Target/ModuleCache.cpp b/lldb/source/Target/ModuleCache.cpp
index 4f4683290aa..b084c3aa0a1 100644
--- a/lldb/source/Target/ModuleCache.cpp
+++ b/lldb/source/Target/ModuleCache.cpp
@@ -133,7 +133,7 @@ Status CreateHostSysRootModuleLink(const FileSpec &root_dir_spec,
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 @@ Status ModuleCache::Get(const FileSpec &root_dir_spec, const char *hostname,
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 @@ Status ModuleCache::Get(const FileSpec &root_dir_spec, const char *hostname,
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(
diff --git a/lldb/source/Target/PathMappingList.cpp b/lldb/source/Target/PathMappingList.cpp
index 778728eebb0..2b9ebf305c1 100644
--- a/lldb/source/Target/PathMappingList.cpp
+++ b/lldb/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 @@ bool PathMappingList::FindFile(const FileSpec &orig_spec,
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;
}
}
diff --git a/lldb/source/Target/Platform.cpp b/lldb/source/Target/Platform.cpp
index ff1cbce5209..4360d82ddd1 100644
--- a/lldb/source/Target/Platform.cpp
+++ b/lldb/source/Target/Platform.cpp
@@ -890,7 +890,7 @@ Platform::ResolveExecutable(const ModuleSpec &module_spec,
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 @@ Platform::ResolveExecutable(const ModuleSpec &module_spec,
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");
diff --git a/lldb/source/Target/Process.cpp b/lldb/source/Target/Process.cpp
index 93b9e3f0b73..9ba10118b4c 100644
--- a/lldb/source/Target/Process.cpp
+++ b/lldb/source/Target/Process.cpp
@@ -2734,7 +2734,7 @@ Status Process::Launch(ProcessLaunchInfo &launch_info) {
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
diff --git a/lldb/source/Target/TargetList.cpp b/lldb/source/Target/TargetList.cpp
index 34b1c7f398c..380ce0012d1 100644
--- a/lldb/source/Target/TargetList.cpp
+++ b/lldb/source/Target/TargetList.cpp
@@ -347,7 +347,7 @@ Status TargetList::CreateTargetInternal(Debugger &debugger,
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 @@ Status TargetList::CreateTargetInternal(Debugger &debugger,
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;
}
}
diff --git a/lldb/source/Utility/FileSpec.cpp b/lldb/source/Utility/FileSpec.cpp
index c0dfea36ee3..8554f9cff06 100644
--- a/lldb/source/Utility/FileSpec.cpp
+++ b/lldb/source/Utility/FileSpec.cpp
@@ -453,11 +453,6 @@ void FileSpec::Dump(Stream *s) const {
}
}
-//------------------------------------------------------------------
-// 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
diff --git a/lldb/source/Utility/StructuredData.cpp b/lldb/source/Utility/StructuredData.cpp
index 55f003f245b..91e3941496d 100644
--- a/lldb/source/Utility/StructuredData.cpp
+++ b/lldb/source/Utility/StructuredData.cpp
@@ -33,11 +33,6 @@ static StructuredData::ObjectSP ParseJSONArray(JSONParser &json_parser);
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) {
diff --git a/lldb/unittests/Target/ModuleCacheTest.cpp b/lldb/unittests/Target/ModuleCacheTest.cpp
index 5d2d8a732c6..f1a5a916933 100644
--- a/lldb/unittests/Target/ModuleCacheTest.cpp
+++ b/lldb/unittests/Target/ModuleCacheTest.cpp
@@ -82,12 +82,13 @@ void ModuleCacheTest::TearDownTestCase() {
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));
}
OpenPOWER on IntegriCloud