PlatformPOSIX.h revision 263367
1//===-- PlatformPOSIX.h -----------------------------------------*- C++ -*-===// 2// 3// The LLVM Compiler Infrastructure 4// 5// This file is distributed under the University of Illinois Open Source 6// License. See LICENSE.TXT for details. 7// 8//===----------------------------------------------------------------------===// 9 10#ifndef liblldb_PlatformPOSIX_h_ 11#define liblldb_PlatformPOSIX_h_ 12 13// C Includes 14// C++ Includes 15 16#include <memory> 17 18// Other libraries and framework includes 19// Project includes 20#include "lldb/Interpreter/Options.h" 21#include "lldb/Target/Platform.h" 22 23class PlatformPOSIX : public lldb_private::Platform 24{ 25public: 26 PlatformPOSIX (bool is_host); 27 28 virtual 29 ~PlatformPOSIX(); 30 31 //------------------------------------------------------------ 32 // lldb_private::Platform functions 33 //------------------------------------------------------------ 34 virtual lldb_private::OptionGroupOptions* 35 GetConnectionOptions (lldb_private::CommandInterpreter& interpreter); 36 37 virtual lldb_private::Error 38 PutFile (const lldb_private::FileSpec& source, 39 const lldb_private::FileSpec& destination, 40 uint32_t uid = UINT32_MAX, 41 uint32_t gid = UINT32_MAX); 42 43 virtual lldb::user_id_t 44 OpenFile (const lldb_private::FileSpec& file_spec, 45 uint32_t flags, 46 uint32_t mode, 47 lldb_private::Error &error); 48 49 virtual bool 50 CloseFile (lldb::user_id_t fd, 51 lldb_private::Error &error); 52 53 virtual uint64_t 54 ReadFile (lldb::user_id_t fd, 55 uint64_t offset, 56 void *dst, 57 uint64_t dst_len, 58 lldb_private::Error &error); 59 60 virtual uint64_t 61 WriteFile (lldb::user_id_t fd, 62 uint64_t offset, 63 const void* src, 64 uint64_t src_len, 65 lldb_private::Error &error); 66 67 virtual lldb::user_id_t 68 GetFileSize (const lldb_private::FileSpec& file_spec); 69 70 virtual lldb_private::Error 71 CreateSymlink(const char *src, const char *dst); 72 73 virtual lldb_private::Error 74 GetFile (const lldb_private::FileSpec& source, 75 const lldb_private::FileSpec& destination); 76 77 virtual lldb_private::ConstString 78 GetRemoteWorkingDirectory(); 79 80 virtual bool 81 SetRemoteWorkingDirectory(const lldb_private::ConstString &path); 82 83 virtual lldb_private::Error 84 RunShellCommand (const char *command, // Shouldn't be NULL 85 const char *working_dir, // Pass NULL to use the current working directory 86 int *status_ptr, // Pass NULL if you don't want the process exit status 87 int *signo_ptr, // Pass NULL if you don't want the signal that caused the process to exit 88 std::string *command_output, // Pass NULL if you don't want the command output 89 uint32_t timeout_sec); // Timeout in seconds to wait for shell program to finish 90 91 virtual lldb_private::Error 92 MakeDirectory (const char *path, uint32_t mode); 93 94 virtual lldb_private::Error 95 GetFilePermissions (const char *path, uint32_t &file_permissions); 96 97 virtual lldb_private::Error 98 SetFilePermissions (const char *path, uint32_t file_permissions); 99 100 virtual bool 101 GetFileExists (const lldb_private::FileSpec& file_spec); 102 103 virtual lldb_private::Error 104 Unlink (const char *path); 105 106 virtual std::string 107 GetPlatformSpecificConnectionInformation(); 108 109 virtual bool 110 CalculateMD5 (const lldb_private::FileSpec& file_spec, 111 uint64_t &low, 112 uint64_t &high); 113 114protected: 115 std::auto_ptr<lldb_private::OptionGroupOptions> m_options; 116 117 lldb::PlatformSP m_remote_platform_sp; // Allow multiple ways to connect to a remote POSIX-compliant OS 118 119private: 120 DISALLOW_COPY_AND_ASSIGN (PlatformPOSIX); 121 122}; 123 124#endif // liblldb_PlatformPOSIX_h_ 125