1 //===-- PlatformAppleSimulator.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 liblldb_PlatformAppleSimulator_h_
11 #define liblldb_PlatformAppleSimulator_h_
12 
13 // C Includes
14 // C++ Includes
15 #include <mutex>
16 
17 // Other libraries and framework includes
18 // Project includes
19 #include "PlatformDarwin.h"
20 #include "PlatformiOSSimulatorCoreSimulatorSupport.h"
21 #include "lldb/Utility/FileSpec.h"
22 
23 #include "llvm/ADT/Optional.h"
24 
25 class PlatformAppleSimulator : public PlatformDarwin {
26 public:
27   //------------------------------------------------------------
28   // Class Functions
29   //------------------------------------------------------------
30   static void Initialize();
31 
32   static void Terminate();
33 
34   //------------------------------------------------------------
35   // Class Methods
36   //------------------------------------------------------------
37   PlatformAppleSimulator();
38 
39   virtual ~PlatformAppleSimulator();
40 
41   lldb_private::Status
42   LaunchProcess(lldb_private::ProcessLaunchInfo &launch_info) override;
43 
44   void GetStatus(lldb_private::Stream &strm) override;
45 
46   lldb_private::Status ConnectRemote(lldb_private::Args &args) override;
47 
48   lldb_private::Status DisconnectRemote() override;
49 
50   lldb::ProcessSP DebugProcess(lldb_private::ProcessLaunchInfo &launch_info,
51                                lldb_private::Debugger &debugger,
52                                lldb_private::Target *target,
53                                lldb_private::Status &error) override;
54 
55 protected:
56   std::mutex m_core_sim_path_mutex;
57   llvm::Optional<lldb_private::FileSpec> m_core_simulator_framework_path;
58   llvm::Optional<CoreSimulatorSupport::Device> m_device;
59 
60   lldb_private::FileSpec GetCoreSimulatorPath();
61 
62   void LoadCoreSimulator();
63 
64 #if defined(__APPLE__)
65   CoreSimulatorSupport::Device GetSimulatorDevice();
66 #endif
67 
68 private:
69   DISALLOW_COPY_AND_ASSIGN(PlatformAppleSimulator);
70 };
71 
72 #endif // liblldb_PlatformAppleSimulator_h_
73