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
19namespace lldb_private {
20namespace platform_android {
21
22class PlatformAndroid : public platform_linux::PlatformLinux {
23public:
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 void DebuggerInitialize(lldb_private::Debugger &debugger);
34
35 static llvm::StringRef GetPluginNameStatic(bool is_host) {
36 return is_host ? Platform::GetHostPlatformName() : "remote-android";
37 }
38
39 static llvm::StringRef GetPluginDescriptionStatic(bool is_host);
40
41 llvm::StringRef GetPluginName() override {
42 return GetPluginNameStatic(is_host: IsHost());
43 }
44
45 // lldb_private::Platform functions
46
47 Status ConnectRemote(Args &args) override;
48
49 Status GetFile(const FileSpec &source, const FileSpec &destination) override;
50
51 Status PutFile(const FileSpec &source, const FileSpec &destination,
52 uint32_t uid = UINT32_MAX, uint32_t gid = UINT32_MAX) override;
53
54 uint32_t GetSdkVersion();
55
56 bool GetRemoteOSVersion() override;
57
58 Status DisconnectRemote() override;
59
60 uint32_t GetDefaultMemoryCacheLineSize() override;
61
62protected:
63 const char *GetCacheHostname() override;
64
65 Status DownloadModuleSlice(const FileSpec &src_file_spec,
66 const uint64_t src_offset, const uint64_t src_size,
67 const FileSpec &dst_file_spec) override;
68
69 Status DownloadSymbolFile(const lldb::ModuleSP &module_sp,
70 const FileSpec &dst_file_spec) override;
71
72 llvm::StringRef
73 GetLibdlFunctionDeclarations(lldb_private::Process *process) override;
74
75 typedef std::unique_ptr<AdbClient> AdbClientUP;
76 virtual AdbClientUP GetAdbClient(Status &error);
77
78 virtual llvm::StringRef GetPropertyPackageName();
79
80 std::string GetRunAs();
81
82private:
83 AdbClient::SyncService *GetSyncService(Status &error);
84
85 std::unique_ptr<AdbClient::SyncService> m_adb_sync_svc;
86 std::string m_device_id;
87 uint32_t m_sdk_version;
88};
89
90} // namespace platform_android
91} // namespace lldb_private
92
93#endif // LLDB_SOURCE_PLUGINS_PLATFORM_ANDROID_PLATFORMANDROID_H
94

source code of lldb/source/Plugins/Platform/Android/PlatformAndroid.h