1 //===-- SWIG Interface for SBPlatform ---------------------------*- 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 namespace lldb {
10 
11 
12 %feature("docstring",
13 "Describes how :py:class:`SBPlatform.ConnectRemote` connects to a remote platform."
14 ) SBPlatformConnectOptions;
15 class SBPlatformConnectOptions
16 {
17 public:
18     SBPlatformConnectOptions (const char *url);
19 
20     SBPlatformConnectOptions (const SBPlatformConnectOptions &rhs);
21 
22     ~SBPlatformConnectOptions ();
23 
24     const char *
25     GetURL();
26 
27     void
28     SetURL(const char *url);
29 
30     bool
31     GetRsyncEnabled();
32 
33     void
34     EnableRsync (const char *options,
35                  const char *remote_path_prefix,
36                  bool omit_remote_hostname);
37 
38     void
39     DisableRsync ();
40 
41     const char *
42     GetLocalCacheDirectory();
43 
44     void
45     SetLocalCacheDirectory(const char *path);
46 };
47 
48 %feature("docstring",
49 "Represents a shell command that can be run by :py:class:`SBPlatform.Run`."
50 ) SBPlatformShellCommand;
51 class SBPlatformShellCommand
52 {
53 public:
54     SBPlatformShellCommand (const char *shell, const char *shell_command);
55     SBPlatformShellCommand (const char *shell_command);
56 
57     SBPlatformShellCommand (const SBPlatformShellCommand &rhs);
58 
59     ~SBPlatformShellCommand();
60 
61     void
62     Clear();
63 
64     const char *
65     GetShell();
66 
67     void
68     SetShell(const char *shell_interpreter);
69 
70     const char *
71     GetCommand();
72 
73     void
74     SetCommand(const char *shell_command);
75 
76     const char *
77     GetWorkingDirectory ();
78 
79     void
80     SetWorkingDirectory (const char *path);
81 
82     uint32_t
83     GetTimeoutSeconds ();
84 
85     void
86     SetTimeoutSeconds (uint32_t sec);
87 
88     int
89     GetSignal ();
90 
91     int
92     GetStatus ();
93 
94     const char *
95     GetOutput ();
96 };
97 
98 %feature("docstring",
99 "A class that represents a platform that can represent the current host or a remote host debug platform.
100 
101 The SBPlatform class represents the current host, or a remote host.
102 It can be connected to a remote platform in order to provide ways
103 to remotely launch and attach to processes, upload/download files,
104 create directories, run remote shell commands, find locally cached
105 versions of files from the remote system, and much more.
106 
107 SBPlatform objects can be created and then used to connect to a remote
108 platform which allows the SBPlatform to be used to get a list of the
109 current processes on the remote host, attach to one of those processes,
110 install programs on the remote system, attach and launch processes,
111 and much more.
112 
113 Every :py:class:`SBTarget` has a corresponding SBPlatform. The platform can be
114 specified upon target creation, or the currently selected platform
115 will attempt to be used when creating the target automatically as long
116 as the currently selected platform matches the target architecture
117 and executable type. If the architecture or executable type do not match,
118 a suitable platform will be found automatically."
119 
120 ) SBPlatform;
121 class SBPlatform
122 {
123 public:
124 
125     SBPlatform ();
126 
127     SBPlatform (const char *);
128 
129     ~SBPlatform();
130 
131     static SBPlatform GetHostPlatform();
132 
133     bool
134     IsValid () const;
135 
136     explicit operator bool() const;
137 
138     void
139     Clear ();
140 
141     const char *
142     GetWorkingDirectory();
143 
144     bool
145     SetWorkingDirectory(const char *);
146 
147     const char *
148     GetName ();
149 
150     SBError
151     ConnectRemote (lldb::SBPlatformConnectOptions &connect_options);
152 
153     void
154     DisconnectRemote ();
155 
156     bool
157     IsConnected();
158 
159     const char *
160     GetTriple();
161 
162     const char *
163     GetHostname ();
164 
165     const char *
166     GetOSBuild ();
167 
168     const char *
169     GetOSDescription ();
170 
171     uint32_t
172     GetOSMajorVersion ();
173 
174     uint32_t
175     GetOSMinorVersion ();
176 
177     uint32_t
178     GetOSUpdateVersion ();
179 
180     lldb::SBError
181     Get (lldb::SBFileSpec &src, lldb::SBFileSpec &dst);
182 
183     lldb::SBError
184     Put (lldb::SBFileSpec &src, lldb::SBFileSpec &dst);
185 
186     lldb::SBError
187     Install (lldb::SBFileSpec &src, lldb::SBFileSpec &dst);
188 
189     lldb::SBError
190     Run (lldb::SBPlatformShellCommand &shell_command);
191 
192     lldb::SBError
193     Launch (lldb::SBLaunchInfo &launch_info);
194 
195     lldb::SBError
196     Kill (const lldb::pid_t pid);
197 
198     lldb::SBError
199     MakeDirectory (const char *path, uint32_t file_permissions = lldb::eFilePermissionsDirectoryDefault);
200 
201     uint32_t
202     GetFilePermissions (const char *path);
203 
204     lldb::SBError
205     SetFilePermissions (const char *path, uint32_t file_permissions);
206 
207     lldb::SBUnixSignals
208     GetUnixSignals();
209 
210     lldb::SBEnvironment
211     GetEnvironment();
212 
213 };
214 
215 } // namespace lldb
216