1 //===-- SBPlatform.h --------------------------------------------*- C++ -*-===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 #ifndef LLDB_SBPlatform_h_
11 #define LLDB_SBPlatform_h_
13 #include "lldb/API/SBDefines.h"
17 struct PlatformConnectOptions;
18 struct PlatformShellCommand;
24 class LLDB_API SBPlatformConnectOptions {
26 SBPlatformConnectOptions(const char *url);
28 SBPlatformConnectOptions(const SBPlatformConnectOptions &rhs);
30 ~SBPlatformConnectOptions();
32 void operator=(const SBPlatformConnectOptions &rhs);
36 void SetURL(const char *url);
38 bool GetRsyncEnabled();
40 void EnableRsync(const char *options, const char *remote_path_prefix,
41 bool omit_remote_hostname);
45 const char *GetLocalCacheDirectory();
47 void SetLocalCacheDirectory(const char *path);
50 PlatformConnectOptions *m_opaque_ptr;
53 class LLDB_API SBPlatformShellCommand {
55 SBPlatformShellCommand(const char *shell_command);
57 SBPlatformShellCommand(const SBPlatformShellCommand &rhs);
59 ~SBPlatformShellCommand();
63 const char *GetCommand();
65 void SetCommand(const char *shell_command);
67 const char *GetWorkingDirectory();
69 void SetWorkingDirectory(const char *path);
71 uint32_t GetTimeoutSeconds();
73 void SetTimeoutSeconds(uint32_t sec);
79 const char *GetOutput();
82 friend class SBPlatform;
84 PlatformShellCommand *m_opaque_ptr;
87 class LLDB_API SBPlatform {
91 SBPlatform(const char *platform_name);
99 const char *GetWorkingDirectory();
101 bool SetWorkingDirectory(const char *path);
103 const char *GetName();
105 SBError ConnectRemote(SBPlatformConnectOptions &connect_options);
107 void DisconnectRemote();
111 //----------------------------------------------------------------------
112 // The following functions will work if the platform is connected
113 //----------------------------------------------------------------------
114 const char *GetTriple();
116 const char *GetHostname();
118 const char *GetOSBuild();
120 const char *GetOSDescription();
122 uint32_t GetOSMajorVersion();
124 uint32_t GetOSMinorVersion();
126 uint32_t GetOSUpdateVersion();
128 SBError Put(SBFileSpec &src, SBFileSpec &dst);
130 SBError Get(SBFileSpec &src, SBFileSpec &dst);
132 SBError Install(SBFileSpec &src, SBFileSpec &dst);
134 SBError Run(SBPlatformShellCommand &shell_command);
136 SBError Launch(SBLaunchInfo &launch_info);
138 SBError Kill(const lldb::pid_t pid);
141 MakeDirectory(const char *path,
142 uint32_t file_permissions = eFilePermissionsDirectoryDefault);
144 uint32_t GetFilePermissions(const char *path);
146 SBError SetFilePermissions(const char *path, uint32_t file_permissions);
148 SBUnixSignals GetUnixSignals() const;
151 friend class SBDebugger;
152 friend class SBTarget;
154 lldb::PlatformSP GetSP() const;
156 void SetSP(const lldb::PlatformSP &platform_sp);
158 SBError ExecuteConnected(
159 const std::function<lldb_private::Status(const lldb::PlatformSP &)>
162 lldb::PlatformSP m_opaque_sp;
167 #endif // LLDB_SBPlatform_h_