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 
12 #include "lldb/Target/Platform.h"
13 
14 namespace lldb_private {
15 
16 /// A base class for platforms which automatically want to be able to forward
17 /// operations to a remote platform instance (such as PlatformRemoteGDBServer).
18 class RemoteAwarePlatform : public Platform {
19 public:
20  using Platform::Platform;
21 
22  bool GetModuleSpec(const FileSpec &module_file_spec, const ArchSpec &arch,
23  ModuleSpec &module_spec) override;
24 
25  lldb::user_id_t OpenFile(const FileSpec &file_spec, uint32_t flags,
26  uint32_t mode, Status &error) override;
27 
28  bool CloseFile(lldb::user_id_t fd, Status &error) override;
29 
30  uint64_t ReadFile(lldb::user_id_t fd, uint64_t offset, void *dst,
31  uint64_t dst_len, Status &error) override;
32 
33  uint64_t WriteFile(lldb::user_id_t fd, uint64_t offset, const void *src,
34  uint64_t src_len, Status &error) override;
35 
36  lldb::user_id_t GetFileSize(const FileSpec &file_spec) override;
37 
38  Status CreateSymlink(const FileSpec &src, const FileSpec &dst) override;
39 
40  bool GetFileExists(const FileSpec &file_spec) override;
41 
42  Status Unlink(const FileSpec &file_spec) override;
43 
45 
46  bool SetRemoteWorkingDirectory(const FileSpec &working_dir) override;
47 
48  Status MakeDirectory(const FileSpec &file_spec, uint32_t mode) override;
49 
50  Status GetFilePermissions(const FileSpec &file_spec,
51  uint32_t &file_permissions) override;
52 
53  Status SetFilePermissions(const FileSpec &file_spec,
54  uint32_t file_permissions) override;
55 
56  bool CalculateMD5(const FileSpec &file_spec, uint64_t &low,
57  uint64_t &high) override;
58 
59  Status GetFileWithUUID(const FileSpec &platform_file, const UUID *uuid,
60  FileSpec &local_file) override;
61 
62  bool GetRemoteOSVersion() override;
63  bool GetRemoteOSBuildString(std::string &s) override;
64  bool GetRemoteOSKernelDescription(std::string &s) override;
66 
67  Status RunShellCommand(const char *command, const FileSpec &working_dir,
68  int *status_ptr, int *signo_ptr,
69  std::string *command_output,
70  const Timeout<std::micro> &timeout) override;
71 
72  const char *GetHostname() override;
75 
76  bool IsConnected() const override;
77 
78  bool GetProcessInfo(lldb::pid_t pid, ProcessInstanceInfo &proc_info) override;
80  ProcessInstanceInfoList &process_infos) override;
81 
82  lldb::ProcessSP ConnectProcess(llvm::StringRef connect_url,
83  llvm::StringRef plugin_name,
84  Debugger &debugger, Target *target,
85  Status &error) override;
86 
87  Status LaunchProcess(ProcessLaunchInfo &launch_info) override;
88 
89  Status KillProcess(const lldb::pid_t pid) override;
90 
91 protected:
92  lldb::PlatformSP m_remote_platform_sp;
93 };
94 
95 } // namespace lldb_private
96 
97 #endif // LLDB_TARGET_REMOTEAWAREPLATFORM_H
A class to manage flag bits.
Definition: Debugger.h:82
Enumerations for broadcasting.
Definition: SBLaunchInfo.h:14
uint64_t WriteFile(lldb::user_id_t fd, uint64_t offset, const void *src, uint64_t src_len, Status &error) override
Status CreateSymlink(const FileSpec &src, const FileSpec &dst) override
bool GetRemoteOSKernelDescription(std::string &s) override
lldb::user_id_t GetFileSize(const FileSpec &file_spec) 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...
uint32_t FindProcesses(const ProcessInstanceInfoMatch &match_info, ProcessInstanceInfoList &process_infos) override
Attach to an existing process by process name.
Platform(bool is_host_platform)
Default Constructor.
Definition: Platform.cpp:379
A file utility class.
Definition: FileSpec.h:55
An architecture specification class.
Definition: ArchSpec.h:32
Status MakeDirectory(const FileSpec &file_spec, uint32_t mode) override
bool CloseFile(lldb::user_id_t fd, Status &error) override
bool CalculateMD5(const FileSpec &file_spec, uint64_t &low, uint64_t &high) override
bool GetProcessInfo(lldb::pid_t pid, ProcessInstanceInfo &proc_info) override
Status Unlink(const FileSpec &file_spec) override
uint64_t user_id_t
Definition: lldb-types.h:84
uint64_t ReadFile(lldb::user_id_t fd, uint64_t offset, void *dst, uint64_t dst_len, Status &error) override
bool GetRemoteOSBuildString(std::string &s) override
lldb::ProcessSP ConnectProcess(llvm::StringRef connect_url, llvm::StringRef plugin_name, Debugger &debugger, Target *target, Status &error) override
bool SetRemoteWorkingDirectory(const FileSpec &working_dir) override
A plug-in interface definition class for debug platform that includes many platform abilities such as...
Definition: Platform.h:67
lldb_private::Environment GetEnvironment() override
bool GetFileExists(const FileSpec &file_spec) override
Status GetFileWithUUID(const FileSpec &platform_file, const UUID *uuid, FileSpec &local_file) override
Locate a file for a platform.
An abstract interface for things that know how to map numeric user/group IDs into names...
Status KillProcess(const lldb::pid_t pid) override
Kill process on a platform.
UserIDResolver & GetUserIDResolver() override
bool GetModuleSpec(const FileSpec &module_file_spec, const ArchSpec &arch, ModuleSpec &module_spec) override
uint64_t pid_t
Definition: lldb-types.h:85
A base class for platforms which automatically want to be able to forward operations to a remote plat...
lldb::user_id_t OpenFile(const FileSpec &file_spec, uint32_t flags, uint32_t mode, Status &error) override
Status GetFilePermissions(const FileSpec &file_spec, uint32_t &file_permissions) override
Status RunShellCommand(const char *command, const FileSpec &working_dir, int *status_ptr, int *signo_ptr, std::string *command_output, const Timeout< std::micro > &timeout) override
An error handling class.
Definition: Status.h:44
Status SetFilePermissions(const FileSpec &file_spec, uint32_t file_permissions) override