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