diff options
Diffstat (limited to 'lldb/source/Plugins')
9 files changed, 39 insertions, 41 deletions
diff --git a/lldb/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp b/lldb/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp index 02854d541d5..77f6fd9f896 100644 --- a/lldb/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp +++ b/lldb/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp @@ -23,6 +23,7 @@ #include "lldb/Core/ModuleSpec.h" #include "lldb/Core/Timer.h" #include "lldb/Host/Host.h" +#include "lldb/Host/FileSystem.h" #include "lldb/Host/Symbols.h" #include "lldb/Symbol/ObjectFile.h" #include "lldb/Symbol/SymbolFile.h" @@ -287,7 +288,7 @@ static lldb_private::Error MakeCacheFolderForFile (const FileSpec& module_cache_spec) { FileSpec module_cache_folder = module_cache_spec.CopyByRemovingLastPathComponent(); - return Host::MakeDirectory(module_cache_folder.GetPath().c_str(), eFilePermissionsDirectoryDefault); + return FileSystem::MakeDirectory(module_cache_folder.GetPath().c_str(), eFilePermissionsDirectoryDefault); } static lldb_private::Error @@ -366,7 +367,7 @@ PlatformDarwin::GetSharedModuleWithLocalCache (const lldb_private::ModuleSpec &m // when going over the *slow* GDB remote transfer mechanism we first check // the hashes of the files - and only do the actual transfer if they differ uint64_t high_local,high_remote,low_local,low_remote; - Host::CalculateMD5 (module_cache_spec, low_local, high_local); + FileSystem::CalculateMD5(module_cache_spec, low_local, high_local); m_remote_platform_sp->CalculateMD5(module_spec.GetFileSpec(), low_remote, high_remote); if (low_local != low_remote || high_local != high_remote) { diff --git a/lldb/source/Plugins/Platform/MacOSX/PlatformMacOSX.cpp b/lldb/source/Plugins/Platform/MacOSX/PlatformMacOSX.cpp index e740e6b8074..c56415de009 100644 --- a/lldb/source/Plugins/Platform/MacOSX/PlatformMacOSX.cpp +++ b/lldb/source/Plugins/Platform/MacOSX/PlatformMacOSX.cpp @@ -25,6 +25,7 @@ #include "lldb/Core/PluginManager.h" #include "lldb/Core/StreamString.h" #include "lldb/Host/FileSpec.h" +#include "lldb/Host/FileSystem.h" #include "lldb/Host/Host.h" #include "lldb/Symbol/ObjectFile.h" #include "lldb/Target/Process.h" @@ -284,7 +285,8 @@ PlatformMacOSX::GetFileWithUUID (const lldb_private::FileSpec &platform_file, // bring in the remote module file FileSpec module_cache_folder = module_cache_spec.CopyByRemovingLastPathComponent(); // try to make the local directory first - Error err = Host::MakeDirectory(module_cache_folder.GetPath().c_str(), eFilePermissionsDirectoryDefault); + Error err = + FileSystem::MakeDirectory(module_cache_folder.GetPath().c_str(), eFilePermissionsDirectoryDefault); if (err.Fail()) return err; err = GetFile(platform_file, module_cache_spec); diff --git a/lldb/source/Plugins/Platform/POSIX/PlatformPOSIX.cpp b/lldb/source/Plugins/Platform/POSIX/PlatformPOSIX.cpp index b52ec159c91..cc4c693e1b4 100644 --- a/lldb/source/Plugins/Platform/POSIX/PlatformPOSIX.cpp +++ b/lldb/source/Plugins/Platform/POSIX/PlatformPOSIX.cpp @@ -18,7 +18,9 @@ #include "lldb/Core/Log.h" #include "lldb/Core/StreamString.h" #include "lldb/Host/File.h" +#include "lldb/Host/FileCache.h" #include "lldb/Host/FileSpec.h" +#include "lldb/Host/FileSystem.h" #include "lldb/Host/Host.h" #include "lldb/Target/ProcessLaunchInfo.h" @@ -121,7 +123,7 @@ PlatformPOSIX::OpenFile (const FileSpec& file_spec, Error &error) { if (IsHost()) - return Host::OpenFile(file_spec, flags, mode, error); + return FileCache::GetInstance().OpenFile(file_spec, flags, mode, error); else if (m_remote_platform_sp) return m_remote_platform_sp->OpenFile(file_spec, flags, mode, error); else @@ -132,7 +134,7 @@ bool PlatformPOSIX::CloseFile (lldb::user_id_t fd, Error &error) { if (IsHost()) - return Host::CloseFile(fd, error); + return FileCache::GetInstance().CloseFile(fd, error); else if (m_remote_platform_sp) return m_remote_platform_sp->CloseFile(fd, error); else @@ -147,7 +149,7 @@ PlatformPOSIX::ReadFile (lldb::user_id_t fd, Error &error) { if (IsHost()) - return Host::ReadFile(fd, offset, dst, dst_len, error); + return FileCache::GetInstance().ReadFile(fd, offset, dst, dst_len, error); else if (m_remote_platform_sp) return m_remote_platform_sp->ReadFile(fd, offset, dst, dst_len, error); else @@ -162,7 +164,7 @@ PlatformPOSIX::WriteFile (lldb::user_id_t fd, Error &error) { if (IsHost()) - return Host::WriteFile(fd, offset, src, src_len, error); + return FileCache::GetInstance().WriteFile(fd, offset, src, src_len, error); else if (m_remote_platform_sp) return m_remote_platform_sp->WriteFile(fd, offset, src, src_len, error); else @@ -350,7 +352,7 @@ lldb::user_id_t PlatformPOSIX::GetFileSize (const FileSpec& file_spec) { if (IsHost()) - return Host::GetFileSize(file_spec); + return FileSystem::GetFileSize(file_spec); else if (m_remote_platform_sp) return m_remote_platform_sp->GetFileSize(file_spec); else @@ -361,7 +363,7 @@ Error PlatformPOSIX::CreateSymlink(const char *src, const char *dst) { if (IsHost()) - return Host::Symlink(src, dst); + return FileSystem::Symlink(src, dst); else if (m_remote_platform_sp) return m_remote_platform_sp->CreateSymlink(src, dst); else @@ -383,7 +385,7 @@ Error PlatformPOSIX::Unlink (const char *path) { if (IsHost()) - return Host::Unlink (path); + return FileSystem::Unlink(path); else if (m_remote_platform_sp) return m_remote_platform_sp->Unlink(path); else @@ -480,10 +482,9 @@ PlatformPOSIX::GetFile (const lldb_private::FileSpec& source /* remote file path if (permissions == 0) permissions = lldb::eFilePermissionsFileDefault; - user_id_t fd_dst = Host::OpenFile(destination, - File::eOpenOptionCanCreate | File::eOpenOptionWrite | File::eOpenOptionTruncate, - permissions, - error); + user_id_t fd_dst = FileCache::GetInstance().OpenFile( + destination, File::eOpenOptionCanCreate | File::eOpenOptionWrite | File::eOpenOptionTruncate, permissions, + error); if (fd_dst == UINT64_MAX) { @@ -507,15 +508,11 @@ PlatformPOSIX::GetFile (const lldb_private::FileSpec& source /* remote file path break; if (n_read == 0) break; - if (Host::WriteFile(fd_dst, - offset, - buffer_sp->GetBytes(), - n_read, - error) != n_read) + if (FileCache::GetInstance().WriteFile(fd_dst, offset, buffer_sp->GetBytes(), n_read, error) != n_read) { if (!error.Fail()) error.SetErrorString("unable to write to destination file"); - break; + break; } offset += n_read; } @@ -524,7 +521,7 @@ PlatformPOSIX::GetFile (const lldb_private::FileSpec& source /* remote file path if (fd_src != UINT64_MAX) CloseFile(fd_src, error); // And close the dst file descriptot. - if (fd_dst != UINT64_MAX && !Host::CloseFile(fd_dst, error)) + if (fd_dst != UINT64_MAX && !FileCache::GetInstance().CloseFile(fd_dst, error)) { if (!error.Fail()) error.SetErrorString("unable to close destination file"); diff --git a/lldb/source/Plugins/Process/Linux/NativeProcessLinux.cpp b/lldb/source/Plugins/Process/Linux/NativeProcessLinux.cpp index 5824ebd1684..6a7e6b89289 100644 --- a/lldb/source/Plugins/Process/Linux/NativeProcessLinux.cpp +++ b/lldb/source/Plugins/Process/Linux/NativeProcessLinux.cpp @@ -126,14 +126,14 @@ namespace } const char * - GetFilePath (const lldb_private::FileAction *file_action, const char *default_path) + GetFilePath(const lldb_private::FileAction *file_action, const char *default_path) { const char *pts_name = "/dev/pts/"; const char *path = NULL; if (file_action) { - if (file_action->GetAction () == FileAction::eFileActionOpen) + if (file_action->GetAction() == FileAction::eFileActionOpen) { path = file_action->GetPath (); // By default the stdio paths passed in will be pseudo-terminal diff --git a/lldb/source/Plugins/Process/POSIX/ProcessPOSIX.cpp b/lldb/source/Plugins/Process/POSIX/ProcessPOSIX.cpp index a4cb0875ce2..2ce61e94d85 100644 --- a/lldb/source/Plugins/Process/POSIX/ProcessPOSIX.cpp +++ b/lldb/source/Plugins/Process/POSIX/ProcessPOSIX.cpp @@ -176,16 +176,14 @@ ProcessPOSIX::WillLaunch(Module* module) } const char * -ProcessPOSIX::GetFilePath( - const lldb_private::FileAction *file_action, - const char *default_path) +ProcessPOSIX::GetFilePath(const lldb_private::FileAction *file_action, const char *default_path) { const char *pts_name = "/dev/pts/"; const char *path = NULL; if (file_action) { - if (file_action->GetAction () == FileAction::eFileActionOpen) + if (file_action->GetAction() == FileAction::eFileActionOpen) { path = file_action->GetPath(); // By default the stdio paths passed in will be pseudo-terminal diff --git a/lldb/source/Plugins/Process/POSIX/ProcessPOSIX.h b/lldb/source/Plugins/Process/POSIX/ProcessPOSIX.h index 7f3756f9508..a429b3c8264 100644 --- a/lldb/source/Plugins/Process/POSIX/ProcessPOSIX.h +++ b/lldb/source/Plugins/Process/POSIX/ProcessPOSIX.h @@ -157,9 +157,7 @@ public: lldb_private::UnixSignals & GetUnixSignals(); - const char * - GetFilePath(const lldb_private::FileAction *file_action, - const char *default_path); + const char *GetFilePath(const lldb_private::FileAction *file_action, const char *default_path); /// Stops all threads in the process. /// The \p stop_tid parameter indicates the thread which initiated the stop. diff --git a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp index 30bd762ba7c..bd378ce95dd 100644 --- a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp +++ b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp @@ -22,6 +22,7 @@ #include "lldb/Core/StreamFile.h" #include "lldb/Core/StreamString.h" #include "lldb/Host/FileSpec.h" +#include "lldb/Host/FileSystem.h" #include "lldb/Host/Host.h" #include "lldb/Host/Socket.h" #include "lldb/Host/TimeValue.h" @@ -843,7 +844,7 @@ GDBRemoteCommunication::StartDebugserverProcess (const char *hostname, out_port = Args::StringToUInt32(port_cstr, 0); name_pipe_file.Close(); } - Host::Unlink(named_pipe_path); + FileSystem::Unlink(named_pipe_path); } else if (listen) { diff --git a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServer.cpp b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServer.cpp index d56be34b4d3..aab665961dc 100644 --- a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServer.cpp +++ b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServer.cpp @@ -31,6 +31,7 @@ #include "lldb/Host/Debug.h" #include "lldb/Host/Endian.h" #include "lldb/Host/File.h" +#include "lldb/Host/FileSystem.h" #include "lldb/Host/Host.h" #include "lldb/Host/TimeValue.h" #include "lldb/Target/FileAction.h" @@ -2498,7 +2499,7 @@ GDBRemoteCommunicationServer::Handle_qPlatform_mkdir (StringExtractorGDBRemote & { std::string path; packet.GetHexByteString(path); - Error error = Host::MakeDirectory(path.c_str(),mode); + Error error = FileSystem::MakeDirectory(path.c_str(), mode); if (error.Success()) return SendPacketNoLock ("OK", 2); else @@ -2517,7 +2518,7 @@ GDBRemoteCommunicationServer::Handle_qPlatform_chmod (StringExtractorGDBRemote & { std::string path; packet.GetHexByteString(path); - Error error = Host::SetFilePermissions (path.c_str(), mode); + Error error = FileSystem::SetFilePermissions(path.c_str(), mode); if (error.Success()) return SendPacketNoLock ("OK", 2); else @@ -2667,7 +2668,7 @@ GDBRemoteCommunicationServer::Handle_vFile_Size (StringExtractorGDBRemote &packe packet.GetHexByteString(path); if (!path.empty()) { - lldb::user_id_t retcode = Host::GetFileSize(FileSpec(path.c_str(), false)); + lldb::user_id_t retcode = FileSystem::GetFileSize(FileSpec(path.c_str(), false)); StreamString response; response.PutChar('F'); response.PutHex64(retcode); @@ -2708,7 +2709,7 @@ GDBRemoteCommunicationServer::Handle_vFile_Exists (StringExtractorGDBRemote &pac packet.GetHexByteString(path); if (!path.empty()) { - bool retcode = Host::GetFileExists(FileSpec(path.c_str(), false)); + bool retcode = FileSystem::GetFileExists(FileSpec(path.c_str(), false)); StreamString response; response.PutChar('F'); response.PutChar(','); @@ -2729,7 +2730,7 @@ GDBRemoteCommunicationServer::Handle_vFile_symlink (StringExtractorGDBRemote &pa packet.GetHexByteStringTerminatedBy(dst, ','); packet.GetChar(); // Skip ',' char packet.GetHexByteString(src); - Error error = Host::Symlink(src.c_str(), dst.c_str()); + Error error = FileSystem::Symlink(src.c_str(), dst.c_str()); StreamString response; response.Printf("F%u,%u", error.GetError(), error.GetError()); return SendPacketNoLock(response.GetData(), response.GetSize()); @@ -2741,7 +2742,7 @@ GDBRemoteCommunicationServer::Handle_vFile_unlink (StringExtractorGDBRemote &pac packet.SetFilePos(::strlen("vFile:unlink:")); std::string path; packet.GetHexByteString(path); - Error error = Host::Unlink(path.c_str()); + Error error = FileSystem::Unlink(path.c_str()); StreamString response; response.Printf("F%u,%u", error.GetError(), error.GetError()); return SendPacketNoLock(response.GetData(), response.GetSize()); @@ -2893,7 +2894,7 @@ GDBRemoteCommunicationServer::Handle_vFile_MD5 (StringExtractorGDBRemote &packet { uint64_t a,b; StreamGDBRemote response; - if (Host::CalculateMD5(FileSpec(path.c_str(),false),a,b) == false) + if (FileSystem::CalculateMD5(FileSpec(path.c_str(), false), a, b) == false) { response.PutCString("F,"); response.PutCString("x"); diff --git a/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp b/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp index 0cb2e144d86..b50f071e980 100644 --- a/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp +++ b/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp @@ -762,19 +762,19 @@ ProcessGDBRemote::DoLaunch (Module *exe_module, ProcessLaunchInfo &launch_info) file_action = launch_info.GetFileActionForFD (STDIN_FILENO); if (file_action) { - if (file_action->GetAction () == FileAction::eFileActionOpen) + if (file_action->GetAction() == FileAction::eFileActionOpen) stdin_path = file_action->GetPath(); } file_action = launch_info.GetFileActionForFD (STDOUT_FILENO); if (file_action) { - if (file_action->GetAction () == FileAction::eFileActionOpen) + if (file_action->GetAction() == FileAction::eFileActionOpen) stdout_path = file_action->GetPath(); } file_action = launch_info.GetFileActionForFD (STDERR_FILENO); if (file_action) { - if (file_action->GetAction () == FileAction::eFileActionOpen) + if (file_action->GetAction() == FileAction::eFileActionOpen) stderr_path = file_action->GetPath(); } |