LLDB  mainline
PlatformAndroid.h
Go to the documentation of this file.
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 
16 
17 #include "AdbClient.h"
18 
19 namespace lldb_private {
20 namespace platform_android {
21 
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 llvm::StringRef GetPluginNameStatic(bool is_host) {
34  return is_host ? Platform::GetHostPlatformName() : "remote-android";
35  }
36 
37  static llvm::StringRef GetPluginDescriptionStatic(bool is_host);
38 
39  llvm::StringRef GetPluginName() override {
40  return GetPluginNameStatic(IsHost());
41  }
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 
53 
54  bool GetRemoteOSVersion() override;
55 
56  Status DisconnectRemote() override;
57 
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
72 
73 private:
75 
76  std::unique_ptr<AdbClient::SyncService> m_adb_sync_svc;
79 };
80 
81 } // namespace platofor_android
82 } // namespace lldb_private
83 
84 #endif // LLDB_SOURCE_PLUGINS_PLATFORM_ANDROID_PLATFORMANDROID_H
lldb_private::platform_android::PlatformAndroid::Terminate
static void Terminate()
Definition: PlatformAndroid.cpp:50
lldb_private::ArchSpec
Definition: ArchSpec.h:33
lldb_private::platform_android::PlatformAndroid::GetDefaultMemoryCacheLineSize
uint32_t GetDefaultMemoryCacheLineSize() override
Allow the platform to set preferred memory cache line size.
Definition: PlatformAndroid.cpp:250
lldb_private::platform_android::PlatformAndroid::PlatformAndroid
PlatformAndroid(bool is_host)
Definition: PlatformAndroid.cpp:129
lldb_private::platform_android::PlatformAndroid::ConnectRemote
Status ConnectRemote(Args &args) override
Definition: PlatformAndroid.cpp:138
lldb_private::platform_android::PlatformAndroid::GetPluginName
llvm::StringRef GetPluginName() override
Definition: PlatformAndroid.h:39
lldb_private::platform_android::PlatformAndroid::GetLibdlFunctionDeclarations
llvm::StringRef GetLibdlFunctionDeclarations(lldb_private::Process *process) override
Definition: PlatformAndroid.cpp:343
lldb_private::Process
Definition: Process.h:341
lldb_private::platform_android::PlatformAndroid::DownloadModuleSlice
Status DownloadModuleSlice(const FileSpec &src_file_spec, const uint64_t src_offset, const uint64_t src_size, const FileSpec &dst_file_spec) override
Definition: PlatformAndroid.cpp:231
lldb_private::platform_android::PlatformAndroid::CreateInstance
static lldb::PlatformSP CreateInstance(bool force, const ArchSpec *arch)
Definition: PlatformAndroid.cpp:60
lldb_private::platform_android::PlatformAndroid::GetPluginNameStatic
static llvm::StringRef GetPluginNameStatic(bool is_host)
Definition: PlatformAndroid.h:33
AdbClient.h
lldb_private::Args
Definition: Args.h:33
lldb_private::platform_android::PlatformAndroid::GetCacheHostname
const char * GetCacheHostname() override
Definition: PlatformAndroid.cpp:229
lldb_private::platform_android::PlatformAndroid::Initialize
static void Initialize()
Definition: PlatformAndroid.cpp:34
lldb_private::platform_android::PlatformAndroid::GetSdkVersion
uint32_t GetSdkVersion()
Definition: PlatformAndroid.cpp:254
lldb_private::FileSpec
Definition: FileSpec.h:56
error
static llvm::raw_ostream & error(Stream &strm)
Definition: CommandReturnObject.cpp:17
lldb_private::platform_android::PlatformAndroid::GetSyncService
AdbClient::SyncService * GetSyncService(Status &error)
Definition: PlatformAndroid.cpp:368
lldb_private::platform_android::PlatformAndroid::PutFile
Status PutFile(const FileSpec &source, const FileSpec &destination, uint32_t uid=UINT32_MAX, uint32_t gid=UINT32_MAX) override
Definition: PlatformAndroid.cpp:210
lldb_private::platform_android::PlatformAndroid::DownloadSymbolFile
Status DownloadSymbolFile(const lldb::ModuleSP &module_sp, const FileSpec &dst_file_spec) override
Definition: PlatformAndroid.cpp:279
lldb_private::platform_linux::PlatformLinux
Definition: PlatformLinux.h:17
string
string(SUBSTRING ${p} 10 -1 pStripped) if($
Definition: Plugins/CMakeLists.txt:40
PlatformLinux.h
lldb_private::platform_android::PlatformAndroid
Definition: PlatformAndroid.h:22
lldb_private::platform_android::PlatformAndroid::m_adb_sync_svc
std::unique_ptr< AdbClient::SyncService > m_adb_sync_svc
Definition: PlatformAndroid.h:76
lldb_private::Status
Definition: Status.h:44
uint32_t
lldb_private::platform_android::AdbClient::SyncService
Definition: AdbClient.h:35
lldb_private::platform_android::PlatformAndroid::GetRemoteOSVersion
bool GetRemoteOSVersion() override
Definition: PlatformAndroid.cpp:337
UINT32_MAX
#define UINT32_MAX
Definition: lldb-defines.h:31
lldb_private::platform_android::PlatformAndroid::m_sdk_version
uint32_t m_sdk_version
Definition: PlatformAndroid.h:78
lldb_private::platform_android::PlatformAndroid::m_device_id
std::string m_device_id
Definition: PlatformAndroid.h:77
lldb_private
A class that represents a running process on the host machine.
Definition: SBCommandInterpreterRunOptions.h:16
lldb_private::platform_android::PlatformAndroid::DisconnectRemote
Status DisconnectRemote() override
Definition: PlatformAndroid.cpp:241
lldb_private::platform_android::PlatformAndroid::GetFile
Status GetFile(const FileSpec &source, const FileSpec &destination) override
Definition: PlatformAndroid.cpp:168
lldb_private::Platform::IsHost
bool IsHost() const
Definition: Platform.h:423
lldb_private::Platform::GetHostPlatformName
static const char * GetHostPlatformName()
Definition: Platform.cpp:60
lldb_private::platform_android::PlatformAndroid::GetPluginDescriptionStatic
static llvm::StringRef GetPluginDescriptionStatic(bool is_host)
Definition: PlatformAndroid.cpp:132