Coverage Report

Created: 2022-01-18 06:27

/Users/buildslave/jenkins/workspace/coverage/llvm-project/lldb/source/Plugins/Platform/MacOSX/PlatformAppleSimulator.h
Line
Count
Source (jump to first uncovered line)
1
//===-- PlatformAppleSimulator.h --------------------------------*- C++ -*-===//
2
//
3
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4
// See https://llvm.org/LICENSE.txt for license information.
5
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6
//
7
//===----------------------------------------------------------------------===//
8
9
#ifndef LLDB_SOURCE_PLUGINS_PLATFORM_MACOSX_PLATFORMAPPLESIMULATOR_H
10
#define LLDB_SOURCE_PLUGINS_PLATFORM_MACOSX_PLATFORMAPPLESIMULATOR_H
11
12
#include <mutex>
13
14
#include "Plugins/Platform/MacOSX/PlatformDarwin.h"
15
#include "Plugins/Platform/MacOSX/objcxx/PlatformiOSSimulatorCoreSimulatorSupport.h"
16
#include "lldb/Utility/ConstString.h"
17
#include "lldb/Utility/FileSpec.h"
18
19
#include "llvm/ADT/Optional.h"
20
21
class PlatformAppleSimulator : public PlatformDarwin {
22
public:
23
  // Class Functions
24
  static void Initialize();
25
26
  static void Terminate();
27
28
  // Class Methods
29
  PlatformAppleSimulator(
30
      const char *class_name, const char *description,
31
      lldb_private::ConstString plugin_name, llvm::Triple::OSType preferred_os,
32
      llvm::SmallVector<llvm::StringRef, 4> supported_triples,
33
      llvm::StringRef sdk, lldb_private::XcodeSDK::Type sdk_type,
34
      CoreSimulatorSupport::DeviceType::ProductFamilyID kind);
35
36
  static lldb::PlatformSP
37
  CreateInstance(const char *class_name, const char *description,
38
                 lldb_private::ConstString plugin_name,
39
                 llvm::SmallVector<llvm::Triple::ArchType, 4> supported_arch,
40
                 llvm::Triple::OSType preferred_os,
41
                 llvm::SmallVector<llvm::Triple::OSType, 4> supported_os,
42
                 llvm::SmallVector<llvm::StringRef, 4> supported_triples,
43
                 llvm::StringRef sdk, lldb_private::XcodeSDK::Type sdk_type,
44
                 CoreSimulatorSupport::DeviceType::ProductFamilyID kind,
45
                 bool force, const lldb_private::ArchSpec *arch);
46
47
  virtual ~PlatformAppleSimulator();
48
49
12
  llvm::StringRef GetPluginName() override {
50
12
    return m_plugin_name.GetStringRef();
51
12
  }
52
0
  llvm::StringRef GetDescription() override { return m_description; }
53
54
  lldb_private::Status
55
  LaunchProcess(lldb_private::ProcessLaunchInfo &launch_info) override;
56
57
  void GetStatus(lldb_private::Stream &strm) override;
58
59
  lldb_private::Status ConnectRemote(lldb_private::Args &args) override;
60
61
  lldb_private::Status DisconnectRemote() override;
62
63
  lldb::ProcessSP DebugProcess(lldb_private::ProcessLaunchInfo &launch_info,
64
                               lldb_private::Debugger &debugger,
65
                               lldb_private::Target &target,
66
                               lldb_private::Status &error) override;
67
68
  std::vector<lldb_private::ArchSpec> GetSupportedArchitectures() override;
69
70
  lldb_private::Status ResolveExecutable(
71
      const lldb_private::ModuleSpec &module_spec, lldb::ModuleSP &module_sp,
72
      const lldb_private::FileSpecList *module_search_paths_ptr) override;
73
74
  lldb_private::Status
75
  GetSharedModule(const lldb_private::ModuleSpec &module_spec,
76
                  lldb_private::Process *process, lldb::ModuleSP &module_sp,
77
                  const lldb_private::FileSpecList *module_search_paths_ptr,
78
                  llvm::SmallVectorImpl<lldb::ModuleSP> *old_modules,
79
                  bool *did_create_ptr) override;
80
81
  uint32_t
82
  FindProcesses(const lldb_private::ProcessInstanceInfoMatch &match_info,
83
                lldb_private::ProcessInstanceInfoList &process_infos) override;
84
85
  void
86
  AddClangModuleCompilationOptions(lldb_private::Target *target,
87
0
                                   std::vector<std::string> &options) override {
88
0
    return PlatformDarwin::AddClangModuleCompilationOptionsForSDKType(
89
0
        target, options, m_sdk_type);
90
0
  }
91
92
protected:
93
  const char *m_class_name;
94
  const char *m_description;
95
  lldb_private::ConstString m_plugin_name;
96
  std::mutex m_core_sim_path_mutex;
97
  llvm::Optional<lldb_private::FileSpec> m_core_simulator_framework_path;
98
  llvm::Optional<CoreSimulatorSupport::Device> m_device;
99
  CoreSimulatorSupport::DeviceType::ProductFamilyID m_kind;
100
101
  lldb_private::FileSpec GetCoreSimulatorPath();
102
103
  llvm::Triple::OSType m_os_type = llvm::Triple::UnknownOS;
104
  llvm::SmallVector<llvm::StringRef, 4> m_supported_triples = {};
105
  llvm::StringRef m_sdk;
106
  lldb_private::XcodeSDK::Type m_sdk_type;
107
108
  void LoadCoreSimulator();
109
110
#if defined(__APPLE__)
111
  CoreSimulatorSupport::Device GetSimulatorDevice();
112
#endif
113
114
private:
115
  PlatformAppleSimulator(const PlatformAppleSimulator &) = delete;
116
  const PlatformAppleSimulator &
117
  operator=(const PlatformAppleSimulator &) = delete;
118
  lldb_private::Status
119
120
  GetSymbolFile(const lldb_private::FileSpec &platform_file,
121
                const lldb_private::UUID *uuid_ptr,
122
                lldb_private::FileSpec &local_file);
123
};
124
125
#endif // LLDB_SOURCE_PLUGINS_PLATFORM_MACOSX_PLATFORMAPPLESIMULATOR_H