aboutsummaryrefslogtreecommitdiffstats
path: root/include/lldb/Target/RemoteAwarePlatform.h
blob: 55d5ff673f1d66c19b00048c8d9230eff7c8bbe8 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
//===-- RemoteAwarePlatform.h -----------------------------------*- C++ -*-===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//

#ifndef LLDB_TARGET_REMOTEAWAREPLATFORM_H
#define LLDB_TARGET_REMOTEAWAREPLATFORM_H

#include "lldb/Target/Platform.h"

namespace lldb_private {

/// A base class for platforms which automatically want to be able to forward
/// operations to a remote platform instance (such as PlatformRemoteGDBServer).
class RemoteAwarePlatform : public Platform {
public:
  using Platform::Platform;

  bool GetModuleSpec(const FileSpec &module_file_spec, const ArchSpec &arch,
                     ModuleSpec &module_spec) override;

  lldb::user_id_t OpenFile(const FileSpec &file_spec, File::OpenOptions flags,
                           uint32_t mode, Status &error) override;

  bool CloseFile(lldb::user_id_t fd, Status &error) override;

  uint64_t ReadFile(lldb::user_id_t fd, uint64_t offset, void *dst,
                    uint64_t dst_len, Status &error) override;

  uint64_t WriteFile(lldb::user_id_t fd, uint64_t offset, const void *src,
                     uint64_t src_len, Status &error) override;

  lldb::user_id_t GetFileSize(const FileSpec &file_spec) override;

  Status CreateSymlink(const FileSpec &src, const FileSpec &dst) override;

  bool GetFileExists(const FileSpec &file_spec) override;

  Status Unlink(const FileSpec &file_spec) override;

  FileSpec GetRemoteWorkingDirectory() override;

  bool SetRemoteWorkingDirectory(const FileSpec &working_dir) override;

  Status MakeDirectory(const FileSpec &file_spec, uint32_t mode) override;

  Status GetFilePermissions(const FileSpec &file_spec,
                            uint32_t &file_permissions) override;

  Status SetFilePermissions(const FileSpec &file_spec,
                            uint32_t file_permissions) override;

  bool CalculateMD5(const FileSpec &file_spec, uint64_t &low,
                    uint64_t &high) override;

  Status GetFileWithUUID(const FileSpec &platform_file, const UUID *uuid,
                         FileSpec &local_file) override;

  bool GetRemoteOSVersion() override;
  bool GetRemoteOSBuildString(std::string &s) override;
  bool GetRemoteOSKernelDescription(std::string &s) override;
  ArchSpec GetRemoteSystemArchitecture() 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;

  const char *GetHostname() override;
  UserIDResolver &GetUserIDResolver() override;
  lldb_private::Environment GetEnvironment() override;

  bool IsConnected() const override;

  bool GetProcessInfo(lldb::pid_t pid, ProcessInstanceInfo &proc_info) override;
  uint32_t FindProcesses(const ProcessInstanceInfoMatch &match_info,
                         ProcessInstanceInfoList &process_infos) override;

  lldb::ProcessSP ConnectProcess(llvm::StringRef connect_url,
                                 llvm::StringRef plugin_name,
                                 Debugger &debugger, Target *target,
                                 Status &error) override;

  Status LaunchProcess(ProcessLaunchInfo &launch_info) override;

  Status KillProcess(const lldb::pid_t pid) override;

protected:
  lldb::PlatformSP m_remote_platform_sp;
};

} // namespace lldb_private

#endif // LLDB_TARGET_REMOTEAWAREPLATFORM_H