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