97 lines · c
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-exception6//7//===----------------------------------------------------------------------===//8 9#ifndef LLDB_SOURCE_PLUGINS_PLATFORM_ANDROID_PLATFORMANDROID_H10#define LLDB_SOURCE_PLUGINS_PLATFORM_ANDROID_PLATFORMANDROID_H11 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 functions31 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(IsHost());43 }44 45 // lldb_private::Platform functions46 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 62 uint32_t FindProcesses(const ProcessInstanceInfoMatch &match_info,63 ProcessInstanceInfoList &process_infos) override;64 65protected:66 const char *GetCacheHostname() override;67 68 Status DownloadModuleSlice(const FileSpec &src_file_spec,69 const uint64_t src_offset, const uint64_t src_size,70 const FileSpec &dst_file_spec) override;71 72 Status DownloadSymbolFile(const lldb::ModuleSP &module_sp,73 const FileSpec &dst_file_spec) override;74 75 llvm::StringRef76 GetLibdlFunctionDeclarations(lldb_private::Process *process) override;77 78 typedef std::unique_ptr<AdbClient> AdbClientUP;79 virtual AdbClientUP GetAdbClient(Status &error);80 81 std::string GetRunAs();82 83public:84 virtual llvm::StringRef GetPropertyPackageName();85 86protected:87 virtual std::unique_ptr<AdbSyncService> GetSyncService(Status &error);88 89 std::string m_device_id;90 uint32_t m_sdk_version;91};92 93} // namespace platform_android94} // namespace lldb_private95 96#endif // LLDB_SOURCE_PLUGINS_PLATFORM_ANDROID_PLATFORMANDROID_H97