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 LLDB_SOURCE_PLUGINS_PLATFORM_ANDROID_PLATFORMANDROID_H
10 #define LLDB_SOURCE_PLUGINS_PLATFORM_ANDROID_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   static void Initialize();
27 
28   static void Terminate();
29 
30   // lldb_private::PluginInterface functions
31   static lldb::PlatformSP CreateInstance(bool force, const ArchSpec *arch);
32 
33   static ConstString GetPluginNameStatic(bool is_host);
34 
35   static const char *GetPluginDescriptionStatic(bool is_host);
36 
37   ConstString GetPluginName() override;
38 
39   // lldb_private::Platform functions
40 
41   Status ConnectRemote(Args &args) override;
42 
43   Status GetFile(const FileSpec &source, const FileSpec &destination) override;
44 
45   Status PutFile(const FileSpec &source, const FileSpec &destination,
46                  uint32_t uid = UINT32_MAX, uint32_t gid = UINT32_MAX) override;
47 
48   uint32_t GetSdkVersion();
49 
50   bool GetRemoteOSVersion() override;
51 
52   Status DisconnectRemote() override;
53 
54   uint32_t GetDefaultMemoryCacheLineSize() override;
55 
56 protected:
57   const char *GetCacheHostname() override;
58 
59   Status DownloadModuleSlice(const FileSpec &src_file_spec,
60                              const uint64_t src_offset, const uint64_t src_size,
61                              const FileSpec &dst_file_spec) override;
62 
63   Status DownloadSymbolFile(const lldb::ModuleSP &module_sp,
64                             const FileSpec &dst_file_spec) override;
65 
66   llvm::StringRef
67   GetLibdlFunctionDeclarations(lldb_private::Process *process) override;
68 
69 private:
70   AdbClient::SyncService *GetSyncService(Status &error);
71 
72   std::unique_ptr<AdbClient::SyncService> m_adb_sync_svc;
73   std::string m_device_id;
74   uint32_t m_sdk_version;
75 };
76 
77 } // namespace platofor_android
78 } // namespace lldb_private
79 
80 #endif // LLDB_SOURCE_PLUGINS_PLATFORM_ANDROID_PLATFORMANDROID_H
81