1 //===-- PlatformAndroid.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_PlatformAndroid_h_ 11 #define liblldb_PlatformAndroid_h_ 12 13 // C Includes 14 // C++ Includes 15 #include <memory> 16 #include <string> 17 18 // Other libraries and framework includes 19 // Project includes 20 #include "Plugins/Platform/Linux/PlatformLinux.h" 21 22 #include "AdbClient.h" 23 24 namespace lldb_private { 25 namespace platform_android { 26 27 class PlatformAndroid : public platform_linux::PlatformLinux { 28 public: 29 PlatformAndroid(bool is_host); 30 31 ~PlatformAndroid() override; 32 33 static void Initialize(); 34 35 static void Terminate(); 36 37 //------------------------------------------------------------ 38 // lldb_private::PluginInterface functions 39 //------------------------------------------------------------ 40 static lldb::PlatformSP CreateInstance(bool force, const ArchSpec *arch); 41 42 static ConstString GetPluginNameStatic(bool is_host); 43 44 static const char *GetPluginDescriptionStatic(bool is_host); 45 46 ConstString GetPluginName() override; 47 48 uint32_t GetPluginVersion() override { return 1; } 49 50 //------------------------------------------------------------ 51 // lldb_private::Platform functions 52 //------------------------------------------------------------ 53 54 Error ConnectRemote(Args &args) override; 55 56 Error GetFile(const FileSpec &source, const FileSpec &destination) override; 57 58 Error PutFile(const FileSpec &source, const FileSpec &destination, 59 uint32_t uid = UINT32_MAX, uint32_t gid = UINT32_MAX) override; 60 61 uint32_t GetSdkVersion(); 62 63 bool GetRemoteOSVersion() override; 64 65 Error DisconnectRemote() override; 66 67 uint32_t GetDefaultMemoryCacheLineSize() override; 68 69 protected: 70 const char *GetCacheHostname() override; 71 72 Error DownloadModuleSlice(const FileSpec &src_file_spec, 73 const uint64_t src_offset, const uint64_t src_size, 74 const FileSpec &dst_file_spec) override; 75 76 Error DownloadSymbolFile(const lldb::ModuleSP &module_sp, 77 const FileSpec &dst_file_spec) override; 78 79 const char *GetLibdlFunctionDeclarations() const override; 80 81 private: 82 AdbClient::SyncService *GetSyncService(Error &error); 83 84 std::unique_ptr<AdbClient::SyncService> m_adb_sync_svc; 85 std::string m_device_id; 86 uint32_t m_sdk_version; 87 88 DISALLOW_COPY_AND_ASSIGN(PlatformAndroid); 89 }; 90 91 } // namespace platofor_android 92 } // namespace lldb_private 93 94 #endif // liblldb_PlatformAndroid_h_ 95