]> CyberLeo.Net >> Repos - FreeBSD/releng/10.2.git/blob - contrib/llvm/tools/lldb/include/lldb/API/SBPlatform.h
- Copy stable/10@285827 to releng/10.2 in preparation for 10.2-RC1
[FreeBSD/releng/10.2.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 struct PlatformConnectOptions;
16 struct PlatformShellCommand;
17
18 namespace lldb {
19
20     class SBPlatformConnectOptions
21     {
22     public:
23         SBPlatformConnectOptions (const char *url);
24
25         SBPlatformConnectOptions (const SBPlatformConnectOptions &rhs);
26
27         ~SBPlatformConnectOptions ();
28         
29         void
30         operator=(const SBPlatformConnectOptions &rhs);
31
32         const char *
33         GetURL();
34         
35         void
36         SetURL(const char *url);
37         
38         bool
39         GetRsyncEnabled();
40         
41         void
42         EnableRsync (const char *options,
43                      const char *remote_path_prefix,
44                      bool omit_remote_hostname);
45                      
46         void
47         DisableRsync ();
48         
49         const char *
50         GetLocalCacheDirectory();
51
52         void
53         SetLocalCacheDirectory(const char *path);
54     protected:
55         PlatformConnectOptions *m_opaque_ptr;
56     };
57
58     class SBPlatformShellCommand
59     {
60     public:
61         SBPlatformShellCommand (const char *shell_command);
62         
63         SBPlatformShellCommand (const SBPlatformShellCommand &rhs);
64         
65         ~SBPlatformShellCommand();
66         
67         void
68         Clear();
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     protected:
98         friend class SBPlatform;
99
100         PlatformShellCommand *m_opaque_ptr;
101     };
102
103     class SBPlatform
104     {
105     public:
106         
107         SBPlatform ();
108         
109         SBPlatform (const char *platform_name);
110         
111         ~SBPlatform();
112         
113         bool
114         IsValid () const;
115         
116         void
117         Clear ();
118
119         const char *
120         GetWorkingDirectory();
121
122         bool
123         SetWorkingDirectory(const char *path);
124
125         const char *
126         GetName ();
127
128         SBError
129         ConnectRemote (SBPlatformConnectOptions &connect_options);
130
131         void
132         DisconnectRemote ();
133         
134         bool
135         IsConnected();
136
137         //----------------------------------------------------------------------
138         // The following functions will work if the platform is connected
139         //----------------------------------------------------------------------
140         const char *
141         GetTriple();
142
143         const char *
144         GetHostname ();
145         
146         const char *
147         GetOSBuild ();
148         
149         const char *
150         GetOSDescription ();
151
152         uint32_t
153         GetOSMajorVersion ();
154
155         uint32_t
156         GetOSMinorVersion ();
157
158         uint32_t
159         GetOSUpdateVersion ();
160
161         SBError
162         Put (SBFileSpec &src, SBFileSpec &dst);
163         
164         SBError
165         Get (SBFileSpec &src, SBFileSpec &dst);
166
167         SBError
168         Install (SBFileSpec& src, SBFileSpec& dst);
169
170         SBError
171         Run (SBPlatformShellCommand &shell_command);
172
173         SBError
174         MakeDirectory (const char *path, uint32_t file_permissions = eFilePermissionsDirectoryDefault);
175
176         uint32_t
177         GetFilePermissions (const char *path);
178         
179         SBError
180         SetFilePermissions (const char *path, uint32_t file_permissions);
181
182     protected:
183         
184         friend class SBDebugger;
185         friend class SBTarget;
186
187         lldb::PlatformSP
188         GetSP () const;
189         
190         void
191         SetSP (const lldb::PlatformSP& platform_sp);
192
193         lldb::PlatformSP m_opaque_sp;
194     };
195
196 } // namespace lldb
197
198 #endif // LLDB_SBPlatform_h_