LLDB  mainline
SBPlatform.h
Go to the documentation of this file.
1 //===-- SBPlatform.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_API_SBPLATFORM_H
10 #define LLDB_API_SBPLATFORM_H
11 
12 #include "lldb/API/SBDefines.h"
13 
14 #include <functional>
15 
18 
19 namespace lldb {
20 
21 class SBLaunchInfo;
22 
24 public:
25  SBPlatformConnectOptions(const char *url);
26 
28 
30 
32 
33  const char *GetURL();
34 
35  void SetURL(const char *url);
36 
37  bool GetRsyncEnabled();
38 
39  void EnableRsync(const char *options, const char *remote_path_prefix,
40  bool omit_remote_hostname);
41 
42  void DisableRsync();
43 
44  const char *GetLocalCacheDirectory();
45 
46  void SetLocalCacheDirectory(const char *path);
47 
48 protected:
50 };
51 
53 public:
54  SBPlatformShellCommand(const char *shell, const char *shell_command);
55  SBPlatformShellCommand(const char *shell_command);
56 
58 
59  SBPlatformShellCommand &operator=(const SBPlatformShellCommand &rhs);
60 
62 
63  void Clear();
64 
65  const char *GetShell();
66 
67  void SetShell(const char *shell);
68 
69  const char *GetCommand();
70 
71  void SetCommand(const char *shell_command);
72 
73  const char *GetWorkingDirectory();
74 
75  void SetWorkingDirectory(const char *path);
76 
77  uint32_t GetTimeoutSeconds();
78 
79  void SetTimeoutSeconds(uint32_t sec);
80 
81  int GetSignal();
82 
83  int GetStatus();
84 
85  const char *GetOutput();
86 
87 protected:
88  friend class SBPlatform;
89 
91 };
92 
94 public:
95  SBPlatform();
96 
97  SBPlatform(const char *platform_name);
98 
99  SBPlatform(const SBPlatform &rhs);
100 
101  SBPlatform &operator=(const SBPlatform &rhs);
102 
103  ~SBPlatform();
104 
105  static SBPlatform GetHostPlatform();
106 
107  explicit operator bool() const;
108 
109  bool IsValid() const;
110 
111  void Clear();
112 
113  const char *GetWorkingDirectory();
114 
115  bool SetWorkingDirectory(const char *path);
116 
117  const char *GetName();
118 
119  SBError ConnectRemote(SBPlatformConnectOptions &connect_options);
120 
121  void DisconnectRemote();
122 
123  bool IsConnected();
124 
125  // The following functions will work if the platform is connected
126  const char *GetTriple();
127 
128  const char *GetHostname();
129 
130  const char *GetOSBuild();
131 
132  const char *GetOSDescription();
133 
134  uint32_t GetOSMajorVersion();
135 
136  uint32_t GetOSMinorVersion();
137 
138  uint32_t GetOSUpdateVersion();
139 
140  SBError Put(SBFileSpec &src, SBFileSpec &dst);
141 
142  SBError Get(SBFileSpec &src, SBFileSpec &dst);
143 
144  SBError Install(SBFileSpec &src, SBFileSpec &dst);
145 
146  SBError Run(SBPlatformShellCommand &shell_command);
147 
148  SBError Launch(SBLaunchInfo &launch_info);
149 
150  SBError Kill(const lldb::pid_t pid);
151 
152  SBError
153  MakeDirectory(const char *path,
154  uint32_t file_permissions = eFilePermissionsDirectoryDefault);
155 
156  uint32_t GetFilePermissions(const char *path);
157 
158  SBError SetFilePermissions(const char *path, uint32_t file_permissions);
159 
160  SBUnixSignals GetUnixSignals() const;
161 
162  /// Return the environment variables of the remote platform connection
163  /// process.
164  ///
165  /// \return
166  /// An lldb::SBEnvironment object which is a copy of the platform's
167  /// environment.
168  SBEnvironment GetEnvironment();
169 
170 protected:
171  friend class SBDebugger;
172  friend class SBTarget;
173 
174  lldb::PlatformSP GetSP() const;
175 
176  void SetSP(const lldb::PlatformSP &platform_sp);
177 
178  SBError ExecuteConnected(
179  const std::function<lldb_private::Status(const lldb::PlatformSP &)>
180  &func);
181 
182  lldb::PlatformSP m_opaque_sp;
183 };
184 
185 } // namespace lldb
186 
187 #endif // LLDB_API_SBPLATFORM_H
lldb::SBLaunchInfo
Definition: SBLaunchInfo.h:23
SBDefines.h
lldb::SBError
Definition: SBError.h:20
PlatformConnectOptions
Definition: SBPlatform.cpp:32
LLDB_API
#define LLDB_API
Definition: lldb-defines.h:23
lldb::SBPlatform::m_opaque_sp
lldb::PlatformSP m_opaque_sp
Definition: SBPlatform.h:182
lldb::SBTarget
Definition: SBTarget.h:29
lldb::SBPlatformConnectOptions::m_opaque_ptr
PlatformConnectOptions * m_opaque_ptr
Definition: SBPlatform.h:49
lldb::SBDebugger
Definition: SBDebugger.h:34
GetName
static llvm::StringRef GetName(XcodeSDK::Type type)
Definition: XcodeSDK.cpp:21
lldb::SBPlatformConnectOptions
Definition: SBPlatform.h:23
lldb::SBEnvironment
Definition: SBEnvironment.h:16
lldb::SBLaunchInfo
class LLDB_API SBLaunchInfo
Definition: SBDefines.h:54
lldb_private::Status
Definition: Status.h:44
PlatformShellCommand
Definition: SBPlatform.cpp:52
uint32_t
lldb::pid_t
uint64_t pid_t
Definition: lldb-types.h:85
lldb::SBPlatformShellCommand::m_opaque_ptr
PlatformShellCommand * m_opaque_ptr
Definition: SBPlatform.h:90
lldb::SBFileSpec
Definition: SBFileSpec.h:16
lldb::SBPlatformShellCommand
Definition: SBPlatform.h:52
lldb::SBPlatform
Definition: SBPlatform.h:93
lldb
Definition: SBAddress.h:15
lldb::SBUnixSignals
Definition: SBUnixSignals.h:17