1 //===-- PlatformAndroid.h ---------------------------------------*- C++ -*-===//
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
7 //===----------------------------------------------------------------------===//
9 #ifndef LLDB_SOURCE_PLUGINS_PLATFORM_ANDROID_PLATFORMANDROID_H
10 #define LLDB_SOURCE_PLUGINS_PLATFORM_ANDROID_PLATFORMANDROID_H
15 #include "Plugins/Platform/Linux/PlatformLinux.h"
17 #include "AdbClient.h"
19 namespace lldb_private
{
20 namespace platform_android
{
22 class PlatformAndroid
: public platform_linux::PlatformLinux
{
24 PlatformAndroid(bool is_host
);
26 static void Initialize();
28 static void Terminate();
30 // lldb_private::PluginInterface functions
31 static lldb::PlatformSP
CreateInstance(bool force
, const ArchSpec
*arch
);
33 static void DebuggerInitialize(lldb_private::Debugger
&debugger
);
35 static llvm::StringRef
GetPluginNameStatic(bool is_host
) {
36 return is_host
? Platform::GetHostPlatformName() : "remote-android";
39 static llvm::StringRef
GetPluginDescriptionStatic(bool is_host
);
41 llvm::StringRef
GetPluginName() override
{
42 return GetPluginNameStatic(IsHost());
45 // lldb_private::Platform functions
47 Status
ConnectRemote(Args
&args
) override
;
49 Status
GetFile(const FileSpec
&source
, const FileSpec
&destination
) override
;
51 Status
PutFile(const FileSpec
&source
, const FileSpec
&destination
,
52 uint32_t uid
= UINT32_MAX
, uint32_t gid
= UINT32_MAX
) override
;
54 uint32_t GetSdkVersion();
56 bool GetRemoteOSVersion() override
;
58 Status
DisconnectRemote() override
;
60 uint32_t GetDefaultMemoryCacheLineSize() override
;
63 const char *GetCacheHostname() override
;
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
;
69 Status
DownloadSymbolFile(const lldb::ModuleSP
&module_sp
,
70 const FileSpec
&dst_file_spec
) override
;
73 GetLibdlFunctionDeclarations(lldb_private::Process
*process
) override
;
75 typedef std::unique_ptr
<AdbClient
> AdbClientUP
;
76 virtual AdbClientUP
GetAdbClient(Status
&error
);
78 virtual llvm::StringRef
GetPropertyPackageName();
80 std::string
GetRunAs();
83 AdbClient::SyncService
*GetSyncService(Status
&error
);
85 std::unique_ptr
<AdbClient::SyncService
> m_adb_sync_svc
;
86 std::string m_device_id
;
87 uint32_t m_sdk_version
;
90 } // namespace platform_android
91 } // namespace lldb_private
93 #endif // LLDB_SOURCE_PLUGINS_PLATFORM_ANDROID_PLATFORMANDROID_H