LLDB mainline
RemoteAwarePlatform.h
Go to the documentation of this file.
1//===-- RemoteAwarePlatform.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_TARGET_REMOTEAWAREPLATFORM_H
10#define LLDB_TARGET_REMOTEAWAREPLATFORM_H
11
13#include <optional>
14
15namespace lldb_private {
16
17/// A base class for platforms which automatically want to be able to forward
18/// operations to a remote platform instance (such as PlatformRemoteGDBServer).
20public:
22
23 virtual Status
24 ResolveExecutable(const ModuleSpec &module_spec,
25 lldb::ModuleSP &exe_module_sp,
26 const FileSpecList *module_search_paths_ptr) override;
27
28 bool GetModuleSpec(const FileSpec &module_file_spec, const ArchSpec &arch,
29 ModuleSpec &module_spec) override;
30
31 lldb::user_id_t OpenFile(const FileSpec &file_spec, File::OpenOptions flags,
32 uint32_t mode, Status &error) override;
33
34 bool CloseFile(lldb::user_id_t fd, Status &error) override;
35
36 uint64_t ReadFile(lldb::user_id_t fd, uint64_t offset, void *dst,
37 uint64_t dst_len, Status &error) override;
38
39 uint64_t WriteFile(lldb::user_id_t fd, uint64_t offset, const void *src,
40 uint64_t src_len, Status &error) override;
41
42 lldb::user_id_t GetFileSize(const FileSpec &file_spec) override;
43
44 Status CreateSymlink(const FileSpec &src, const FileSpec &dst) override;
45
46 bool GetFileExists(const FileSpec &file_spec) override;
47
48 Status Unlink(const FileSpec &file_spec) override;
49
51
52 bool SetRemoteWorkingDirectory(const FileSpec &working_dir) override;
53
54 Status MakeDirectory(const FileSpec &file_spec, uint32_t mode) override;
55
56 Status GetFilePermissions(const FileSpec &file_spec,
57 uint32_t &file_permissions) override;
58
59 Status SetFilePermissions(const FileSpec &file_spec,
60 uint32_t file_permissions) override;
61
62 llvm::ErrorOr<llvm::MD5::MD5Result>
63 CalculateMD5(const FileSpec &file_spec) override;
64
65 Status GetFileWithUUID(const FileSpec &platform_file, const UUID *uuid,
66 FileSpec &local_file) override;
67
68 bool GetRemoteOSVersion() override;
69 std::optional<std::string> GetRemoteOSBuildString() override;
70 std::optional<std::string> GetRemoteOSKernelDescription() override;
72
73 Status RunShellCommand(llvm::StringRef command, const FileSpec &working_dir,
74 int *status_ptr, int *signo_ptr,
75 std::string *command_output,
76 const Timeout<std::micro> &timeout) override;
77
78 Status RunShellCommand(llvm::StringRef interpreter, llvm::StringRef command,
79 const FileSpec &working_dir, int *status_ptr,
80 int *signo_ptr, std::string *command_output,
81 const Timeout<std::micro> &timeout) override;
82
83 const char *GetHostname() override;
86
87 bool IsConnected() const override;
88
89 bool GetProcessInfo(lldb::pid_t pid, ProcessInstanceInfo &proc_info) override;
90 uint32_t FindProcesses(const ProcessInstanceInfoMatch &match_info,
91 ProcessInstanceInfoList &process_infos) override;
92
93 lldb::ProcessSP ConnectProcess(llvm::StringRef connect_url,
94 llvm::StringRef plugin_name,
95 Debugger &debugger, Target *target,
96 Status &error) override;
97
98 Status LaunchProcess(ProcessLaunchInfo &launch_info) override;
99
100 Status KillProcess(const lldb::pid_t pid) override;
101
102 size_t ConnectToWaitingProcesses(Debugger &debugger,
103 Status &error) override;
104
105protected:
107};
108
109} // namespace lldb_private
110
111#endif // LLDB_TARGET_REMOTEAWAREPLATFORM_H
static llvm::raw_ostream & error(Stream &strm)
An architecture specification class.
Definition: ArchSpec.h:31
A class to manage flag bits.
Definition: Debugger.h:80
A file collection class.
Definition: FileSpecList.h:91
A file utility class.
Definition: FileSpec.h:56
A plug-in interface definition class for debug platform that includes many platform abilities such as...
Definition: Platform.h:76
Platform(bool is_host_platform)
Default Constructor.
Definition: Platform.cpp:234
A base class for platforms which automatically want to be able to forward operations to a remote plat...
size_t ConnectToWaitingProcesses(Debugger &debugger, Status &error) override
Connect to all processes waiting for a debugger to attach.
uint64_t WriteFile(lldb::user_id_t fd, uint64_t offset, const void *src, uint64_t src_len, Status &error) override
uint64_t ReadFile(lldb::user_id_t fd, uint64_t offset, void *dst, uint64_t dst_len, Status &error) override
bool CloseFile(lldb::user_id_t fd, Status &error) override
Status GetFileWithUUID(const FileSpec &platform_file, const UUID *uuid, FileSpec &local_file) override
Locate a file for a platform.
std::optional< std::string > GetRemoteOSBuildString() override
bool GetModuleSpec(const FileSpec &module_file_spec, const ArchSpec &arch, ModuleSpec &module_spec) override
llvm::ErrorOr< llvm::MD5::MD5Result > CalculateMD5(const FileSpec &file_spec) override
Status KillProcess(const lldb::pid_t pid) override
Kill process on a platform.
bool GetProcessInfo(lldb::pid_t pid, ProcessInstanceInfo &proc_info) override
bool GetFileExists(const FileSpec &file_spec) override
std::optional< std::string > GetRemoteOSKernelDescription() override
Status SetFilePermissions(const FileSpec &file_spec, uint32_t file_permissions) override
lldb::ProcessSP ConnectProcess(llvm::StringRef connect_url, llvm::StringRef plugin_name, Debugger &debugger, Target *target, Status &error) override
Status MakeDirectory(const FileSpec &file_spec, uint32_t mode) override
lldb_private::Environment GetEnvironment() override
lldb::user_id_t OpenFile(const FileSpec &file_spec, File::OpenOptions flags, uint32_t mode, Status &error) override
Status RunShellCommand(llvm::StringRef command, const FileSpec &working_dir, int *status_ptr, int *signo_ptr, std::string *command_output, const Timeout< std::micro > &timeout) override
Status LaunchProcess(ProcessLaunchInfo &launch_info) override
Launch a new process on a platform, not necessarily for debugging, it could be just for running the p...
virtual Status ResolveExecutable(const ModuleSpec &module_spec, lldb::ModuleSP &exe_module_sp, const FileSpecList *module_search_paths_ptr) override
Set the target's executable based off of the existing architecture information in target given a path...
Status GetFilePermissions(const FileSpec &file_spec, uint32_t &file_permissions) override
lldb::user_id_t GetFileSize(const FileSpec &file_spec) override
bool SetRemoteWorkingDirectory(const FileSpec &working_dir) override
Status Unlink(const FileSpec &file_spec) override
Status CreateSymlink(const FileSpec &src, const FileSpec &dst) override
UserIDResolver & GetUserIDResolver() override
uint32_t FindProcesses(const ProcessInstanceInfoMatch &match_info, ProcessInstanceInfoList &process_infos) override
Attach to an existing process by process name.
An error handling class.
Definition: Status.h:115
An abstract interface for things that know how to map numeric user/group IDs into names.
A class that represents a running process on the host machine.
std::vector< ProcessInstanceInfo > ProcessInstanceInfoList
Definition: Host.h:32
std::shared_ptr< lldb_private::Platform > PlatformSP
Definition: lldb-forward.h:388
std::shared_ptr< lldb_private::Process > ProcessSP
Definition: lldb-forward.h:389
uint64_t pid_t
Definition: lldb-types.h:83
uint64_t user_id_t
Definition: lldb-types.h:82
std::shared_ptr< lldb_private::Module > ModuleSP
Definition: lldb-forward.h:373