Move FileSystem functions out of Host and into their own classes.
More specifically, this change can be summarized as follows:
1) Makes an lldbHostPosix library which contains code common to
all posix platforms.
2) Creates Host/FileSystem.h which defines a common FileSystem
interface.
3) Implements FileSystem.h in Host/windows and Host/posix.
4) Creates Host/FileCache.h, implemented in Host/common, which
defines a class useful for storing handles to open files needed
by the debugger.
Differential Revision: http://reviews.llvm.org/D4889
llvm-svn: 215775
diff --git a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServer.cpp b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServer.cpp
index d56be34..aab6659 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 @@
{
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 @@
{
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 @@
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 @@
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 @@
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 @@
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 @@
{
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");