1 //===-- PlatformAndroid.h ---------------------------------------*- C++ -*-===// 2 // 3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 4 // See https://llvm.org/LICENSE.txt for license information. 5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 6 // 7 //===----------------------------------------------------------------------===// 8 9 #ifndef liblldb_PlatformAndroid_h_ 10 #define liblldb_PlatformAndroid_h_ 11 12 #include <memory> 13 #include <string> 14 15 #include "Plugins/Platform/Linux/PlatformLinux.h" 16 17 #include "AdbClient.h" 18 19 namespace lldb_private { 20 namespace platform_android { 21 22 class PlatformAndroid : public platform_linux::PlatformLinux { 23 public: 24 PlatformAndroid(bool is_host); 25 26 ~PlatformAndroid() override; 27 28 static void Initialize(); 29 30 static void Terminate(); 31 32 // lldb_private::PluginInterface functions 33 static lldb::PlatformSP CreateInstance(bool force, const ArchSpec *arch); 34 35 static ConstString GetPluginNameStatic(bool is_host); 36 37 static const char *GetPluginDescriptionStatic(bool is_host); 38 39 ConstString GetPluginName() override; 40 41 uint32_t GetPluginVersion() override { return 1; } 42 43 // lldb_private::Platform functions 44 45 Status ConnectRemote(Args &args) override; 46 47 Status GetFile(const FileSpec &source, const FileSpec &destination) override; 48 49 Status PutFile(const FileSpec &source, const FileSpec &destination, 50 uint32_t uid = UINT32_MAX, uint32_t gid = UINT32_MAX) override; 51 52 uint32_t GetSdkVersion(); 53 54 bool GetRemoteOSVersion() override; 55 56 Status DisconnectRemote() override; 57 58 uint32_t GetDefaultMemoryCacheLineSize() override; 59 60 protected: 61 const char *GetCacheHostname() override; 62 63 Status DownloadModuleSlice(const FileSpec &src_file_spec, 64 const uint64_t src_offset, const uint64_t src_size, 65 const FileSpec &dst_file_spec) override; 66 67 Status DownloadSymbolFile(const lldb::ModuleSP &module_sp, 68 const FileSpec &dst_file_spec) override; 69 70 llvm::StringRef 71 GetLibdlFunctionDeclarations(lldb_private::Process *process) override; 72 73 private: 74 AdbClient::SyncService *GetSyncService(Status &error); 75 76 std::unique_ptr<AdbClient::SyncService> m_adb_sync_svc; 77 std::string m_device_id; 78 uint32_t m_sdk_version; 79 80 DISALLOW_COPY_AND_ASSIGN(PlatformAndroid); 81 }; 82 83 } // namespace platofor_android 84 } // namespace lldb_private 85 86 #endif // liblldb_PlatformAndroid_h_ 87