]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - include/lldb/API/SBPlatform.h
Vendor import of lldb trunk r290819:
[FreeBSD/FreeBSD.git] / 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 public:
26   SBPlatformConnectOptions(const char *url);
27
28   SBPlatformConnectOptions(const SBPlatformConnectOptions &rhs);
29
30   ~SBPlatformConnectOptions();
31
32   void operator=(const SBPlatformConnectOptions &rhs);
33
34   const char *GetURL();
35
36   void SetURL(const char *url);
37
38   bool GetRsyncEnabled();
39
40   void EnableRsync(const char *options, const char *remote_path_prefix,
41                    bool omit_remote_hostname);
42
43   void DisableRsync();
44
45   const char *GetLocalCacheDirectory();
46
47   void SetLocalCacheDirectory(const char *path);
48
49 protected:
50   PlatformConnectOptions *m_opaque_ptr;
51 };
52
53 class LLDB_API SBPlatformShellCommand {
54 public:
55   SBPlatformShellCommand(const char *shell_command);
56
57   SBPlatformShellCommand(const SBPlatformShellCommand &rhs);
58
59   ~SBPlatformShellCommand();
60
61   void Clear();
62
63   const char *GetCommand();
64
65   void SetCommand(const char *shell_command);
66
67   const char *GetWorkingDirectory();
68
69   void SetWorkingDirectory(const char *path);
70
71   uint32_t GetTimeoutSeconds();
72
73   void SetTimeoutSeconds(uint32_t sec);
74
75   int GetSignal();
76
77   int GetStatus();
78
79   const char *GetOutput();
80
81 protected:
82   friend class SBPlatform;
83
84   PlatformShellCommand *m_opaque_ptr;
85 };
86
87 class LLDB_API SBPlatform {
88 public:
89   SBPlatform();
90
91   SBPlatform(const char *platform_name);
92
93   ~SBPlatform();
94
95   bool IsValid() const;
96
97   void Clear();
98
99   const char *GetWorkingDirectory();
100
101   bool SetWorkingDirectory(const char *path);
102
103   const char *GetName();
104
105   SBError ConnectRemote(SBPlatformConnectOptions &connect_options);
106
107   void DisconnectRemote();
108
109   bool IsConnected();
110
111   //----------------------------------------------------------------------
112   // The following functions will work if the platform is connected
113   //----------------------------------------------------------------------
114   const char *GetTriple();
115
116   const char *GetHostname();
117
118   const char *GetOSBuild();
119
120   const char *GetOSDescription();
121
122   uint32_t GetOSMajorVersion();
123
124   uint32_t GetOSMinorVersion();
125
126   uint32_t GetOSUpdateVersion();
127
128   SBError Put(SBFileSpec &src, SBFileSpec &dst);
129
130   SBError Get(SBFileSpec &src, SBFileSpec &dst);
131
132   SBError Install(SBFileSpec &src, SBFileSpec &dst);
133
134   SBError Run(SBPlatformShellCommand &shell_command);
135
136   SBError Launch(SBLaunchInfo &launch_info);
137
138   SBError Kill(const lldb::pid_t pid);
139
140   SBError
141   MakeDirectory(const char *path,
142                 uint32_t file_permissions = eFilePermissionsDirectoryDefault);
143
144   uint32_t GetFilePermissions(const char *path);
145
146   SBError SetFilePermissions(const char *path, uint32_t file_permissions);
147
148   SBUnixSignals GetUnixSignals() const;
149
150 protected:
151   friend class SBDebugger;
152   friend class SBTarget;
153
154   lldb::PlatformSP GetSP() const;
155
156   void SetSP(const lldb::PlatformSP &platform_sp);
157
158   SBError ExecuteConnected(
159       const std::function<lldb_private::Error(const lldb::PlatformSP &)> &func);
160
161   lldb::PlatformSP m_opaque_sp;
162 };
163
164 } // namespace lldb
165
166 #endif // LLDB_SBPlatform_h_