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
19namespace lldb {
20
21class SBLaunchInfo;
22
24public:
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
48protected:
50};
51
53public:
54 SBPlatformShellCommand(const char *shell, const char *shell_command);
55 SBPlatformShellCommand(const char *shell_command);
56
58
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
87protected:
88 friend class SBPlatform;
89
91};
92
94public:
95 SBPlatform();
96
97 SBPlatform(const char *platform_name);
98
99 SBPlatform(const SBPlatform &rhs);
100
101 SBPlatform &operator=(const SBPlatform &rhs);
102
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 void SetSDKRoot(const char *sysroot);
141
142 SBError Put(SBFileSpec &src, SBFileSpec &dst);
143
144 SBError Get(SBFileSpec &src, SBFileSpec &dst);
145
146 SBError Install(SBFileSpec &src, SBFileSpec &dst);
147
148 SBError Run(SBPlatformShellCommand &shell_command);
149
150 SBError Launch(SBLaunchInfo &launch_info);
151
152 SBError Kill(const lldb::pid_t pid);
153
154 SBError
155 MakeDirectory(const char *path,
156 uint32_t file_permissions = eFilePermissionsDirectoryDefault);
157
158 uint32_t GetFilePermissions(const char *path);
159
160 SBError SetFilePermissions(const char *path, uint32_t file_permissions);
161
162 SBUnixSignals GetUnixSignals() const;
163
164 /// Return the environment variables of the remote platform connection
165 /// process.
166 ///
167 /// \return
168 /// An lldb::SBEnvironment object which is a copy of the platform's
169 /// environment.
170 SBEnvironment GetEnvironment();
171
172protected:
173 friend class SBDebugger;
174 friend class SBTarget;
175
176 lldb::PlatformSP GetSP() const;
177
178 void SetSP(const lldb::PlatformSP &platform_sp);
179
180 SBError ExecuteConnected(
181 const std::function<lldb_private::Status(const lldb::PlatformSP &)>
182 &func);
183
184 lldb::PlatformSP m_opaque_sp;
185};
186
187} // namespace lldb
188
189#endif // LLDB_API_SBPLATFORM_H
#define LLDB_API
Definition: SBDefines.h:26
static llvm::StringRef GetName(XcodeSDK::Type type)
Definition: XcodeSDK.cpp:21
PlatformConnectOptions * m_opaque_ptr
Definition: SBPlatform.h:49
PlatformShellCommand * m_opaque_ptr
Definition: SBPlatform.h:90
lldb::PlatformSP m_opaque_sp
Definition: SBPlatform.h:184
An error handling class.
Definition: Status.h:44
Definition: SBAddress.h:15
uint64_t pid_t
Definition: lldb-types.h:85
class LLDB_API SBLaunchInfo
Definition: SBDefines.h:66