1 //===-- PlatformiOSSimulatorCoreSimulatorSupport.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 liblldb_PlatformiOSSimulatorCoreSimulatorSupport_h_
11 #define liblldb_PlatformiOSSimulatorCoreSimulatorSupport_h_
19 // Other libraries and framework includes
21 #include <objc/objc.h>
26 #include "lldb/Core/ConstString.h"
27 #include "lldb/Core/Error.h"
28 #include "lldb/Interpreter/Args.h"
29 #include "lldb/Target/ProcessLaunchInfo.h"
31 #include "llvm/ADT/Optional.h"
33 // And now the actual magic
34 namespace CoreSimulatorSupport
45 explicit operator bool ()
47 return m_pid != LLDB_INVALID_PROCESS_ID;
57 Process (lldb::pid_t p);
59 Process(lldb_private::Error error);
61 Process (lldb::pid_t p, lldb_private::Error error);
64 lldb_private::Error m_error;
69 class ModelIdentifier {
71 ModelIdentifier (const std::string& mi);
74 explicit operator bool () const
76 return !m_versions.empty();
80 GetNumVersions () const
82 return m_versions.size();
86 GetVersionAtIndex (size_t idx) const
88 return m_versions[idx];
94 return m_family.c_str();
99 std::vector<unsigned int> m_versions;
105 enum class ProductFamilyID : int32_t
117 explicit operator bool ();
122 lldb_private::ConstString
126 GetModelIdentifier ();
128 lldb_private::ConstString
132 GetProductFamilyID ();
136 llvm::Optional<ModelIdentifier> m_model_identifier;
141 OSVersion (const std::string& ver,
142 const std::string& build);
146 explicit operator bool () const
148 return !m_versions.empty();
152 GetNumVersions () const
154 return m_versions.size();
158 GetVersionAtIndex (size_t idx) const
160 return m_versions[idx];
166 return m_build.c_str();
170 std::vector<unsigned int> m_versions;
179 DeviceRuntime (id d);
181 explicit operator bool ();
191 llvm::Optional<OSVersion> m_os_version;
197 typedef unsigned long int NSUInteger;
200 enum class State : NSUInteger
213 explicit operator bool ();
228 Boot (lldb_private::Error &err);
231 Shutdown (lldb_private::Error &err);
237 Spawn (lldb_private::ProcessLaunchInfo& launch_info);
241 llvm::Optional<DeviceType> m_dev_type;
242 llvm::Optional<DeviceRuntime> m_dev_runtime;
244 friend class DeviceSet;
248 operator > (const OSVersion& lhs,
249 const OSVersion& rhs);
252 operator > (const ModelIdentifier& lhs,
253 const ModelIdentifier& rhs);
256 operator < (const OSVersion& lhs,
257 const OSVersion& rhs);
260 operator < (const ModelIdentifier& lhs,
261 const ModelIdentifier& rhs);
264 operator == (const OSVersion& lhs,
265 const OSVersion& rhs);
268 operator == (const ModelIdentifier& lhs,
269 const ModelIdentifier& rhs);
272 operator != (const OSVersion& lhs,
273 const OSVersion& rhs);
276 operator != (const ModelIdentifier& lhs,
277 const ModelIdentifier& rhs);
286 GetAvailableDevices ();
292 GetDeviceAtIndex (size_t idx);
295 ForEach (std::function<bool(const Device &)> f);
298 GetDevicesIf (std::function<bool(Device)> f);
301 GetDevices (DeviceType::ProductFamilyID dev_id);
304 GetFanciest (DeviceType::ProductFamilyID dev_id);
307 DeviceSet (id arr) : m_dev(arr)
315 #endif // liblldb_PlatformiOSSimulatorCoreSimulatorSupport_h_