]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - contrib/llvm/tools/lldb/include/lldb/API/SBPlatform.h
Update llvm, clang and lldb to 3.7.0 release.
[FreeBSD/FreeBSD.git] / contrib / llvm / tools / lldb / include / lldb / API / SBPlatform.h
1 //===-- SBPlatform.h --------------------------------------------*- C++ -*-===//
2 //
3 //                     The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9
10 #ifndef LLDB_SBPlatform_h_
11 #define LLDB_SBPlatform_h_
12
13 #include "lldb/API/SBDefines.h"
14
15 #include <functional>
16
17 struct PlatformConnectOptions;
18 struct PlatformShellCommand;
19
20 namespace lldb {
21
22     class SBLaunchInfo;
23
24     class LLDB_API SBPlatformConnectOptions
25     {
26     public:
27         SBPlatformConnectOptions (const char *url);
28
29         SBPlatformConnectOptions (const SBPlatformConnectOptions &rhs);
30
31         ~SBPlatformConnectOptions ();
32         
33         void
34         operator=(const SBPlatformConnectOptions &rhs);
35
36         const char *
37         GetURL();
38         
39         void
40         SetURL(const char *url);
41         
42         bool
43         GetRsyncEnabled();
44         
45         void
46         EnableRsync (const char *options,
47                      const char *remote_path_prefix,
48                      bool omit_remote_hostname);
49                      
50         void
51         DisableRsync ();
52         
53         const char *
54         GetLocalCacheDirectory();
55
56         void
57         SetLocalCacheDirectory(const char *path);
58     protected:
59         PlatformConnectOptions *m_opaque_ptr;
60     };
61
62     class LLDB_API SBPlatformShellCommand
63     {
64     public:
65         SBPlatformShellCommand (const char *shell_command);
66         
67         SBPlatformShellCommand (const SBPlatformShellCommand &rhs);
68         
69         ~SBPlatformShellCommand();
70         
71         void
72         Clear();
73
74         const char *
75         GetCommand();
76
77         void
78         SetCommand(const char *shell_command);
79         
80         const char *
81         GetWorkingDirectory ();
82
83         void
84         SetWorkingDirectory (const char *path);
85
86         uint32_t
87         GetTimeoutSeconds ();
88         
89         void
90         SetTimeoutSeconds (uint32_t sec);
91         
92         int
93         GetSignal ();
94         
95         int
96         GetStatus ();
97         
98         const char *
99         GetOutput ();
100
101     protected:
102         friend class SBPlatform;
103
104         PlatformShellCommand *m_opaque_ptr;
105     };
106
107     class LLDB_API SBPlatform
108     {
109     public:
110         
111         SBPlatform ();
112         
113         SBPlatform (const char *platform_name);
114         
115         ~SBPlatform();
116         
117         bool
118         IsValid () const;
119         
120         void
121         Clear ();
122
123         const char *
124         GetWorkingDirectory();
125
126         bool
127         SetWorkingDirectory(const char *path);
128
129         const char *
130         GetName ();
131
132         SBError
133         ConnectRemote (SBPlatformConnectOptions &connect_options);
134
135         void
136         DisconnectRemote ();
137         
138         bool
139         IsConnected();
140
141         //----------------------------------------------------------------------
142         // The following functions will work if the platform is connected
143         //----------------------------------------------------------------------
144         const char *
145         GetTriple();
146
147         const char *
148         GetHostname ();
149         
150         const char *
151         GetOSBuild ();
152         
153         const char *
154         GetOSDescription ();
155
156         uint32_t
157         GetOSMajorVersion ();
158
159         uint32_t
160         GetOSMinorVersion ();
161
162         uint32_t
163         GetOSUpdateVersion ();
164
165         SBError
166         Put (SBFileSpec &src, SBFileSpec &dst);
167         
168         SBError
169         Get (SBFileSpec &src, SBFileSpec &dst);
170
171         SBError
172         Install (SBFileSpec& src, SBFileSpec& dst);
173
174         SBError
175         Run (SBPlatformShellCommand &shell_command);
176
177         SBError
178         Launch (SBLaunchInfo &launch_info);
179
180         SBError
181         Kill (const lldb::pid_t pid);
182
183         SBError
184         MakeDirectory (const char *path, uint32_t file_permissions = eFilePermissionsDirectoryDefault);
185
186         uint32_t
187         GetFilePermissions (const char *path);
188         
189         SBError
190         SetFilePermissions (const char *path, uint32_t file_permissions);
191
192         SBUnixSignals
193         GetUnixSignals() const;
194
195     protected:
196         
197         friend class SBDebugger;
198         friend class SBTarget;
199
200         lldb::PlatformSP
201         GetSP () const;
202         
203         void
204         SetSP (const lldb::PlatformSP& platform_sp);
205
206         SBError
207         ExecuteConnected (const std::function<lldb_private::Error(const lldb::PlatformSP&)>& func);
208
209         lldb::PlatformSP m_opaque_sp;
210     };
211
212 } // namespace lldb
213
214 #endif // LLDB_SBPlatform_h_