brintos

brintos / llvm-project-archived public Read only

0
0
Text · 4.8 KiB · 77d2a3b Raw
145 lines · c
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-exception6//7//===----------------------------------------------------------------------===//8 9#ifndef LLDB_SOURCE_PLUGINS_PLATFORM_MACOSX_PLATFORMAPPLESIMULATOR_H10#define LLDB_SOURCE_PLUGINS_PLATFORM_MACOSX_PLATFORMAPPLESIMULATOR_H11 12#include "Plugins/Platform/MacOSX/PlatformDarwin.h"13#include "Plugins/Platform/MacOSX/objcxx/PlatformiOSSimulatorCoreSimulatorSupport.h"14#include "lldb/Utility/ConstString.h"15#include "lldb/Utility/FileSpec.h"16#include "lldb/Utility/ProcessInfo.h"17#include "lldb/Utility/Status.h"18#include "lldb/Utility/XcodeSDK.h"19#include "lldb/lldb-forward.h"20#include "llvm/ADT/SmallVector.h"21#include "llvm/ADT/StringRef.h"22#include "llvm/TargetParser/Triple.h"23 24#include <mutex>25#include <optional>26#include <vector>27 28namespace lldb_private {29class ArchSpec;30class Args;31class Debugger;32class FileSpecList;33class ModuleSpec;34class Process;35class ProcessLaunchInfo;36class Stream;37class Target;38class UUID;39 40class PlatformAppleSimulator : public PlatformDarwin {41public:42  // Class Functions43  static void Initialize();44 45  static void Terminate();46 47  // Class Methods48  PlatformAppleSimulator(49      const char *class_name, const char *description, ConstString plugin_name,50      llvm::Triple::OSType preferred_os,51      llvm::SmallVector<llvm::StringRef, 4> supported_triples,52      std::string sdk_name_primary, std::string sdk_name_secondary,53      XcodeSDK::Type sdk_type,54      CoreSimulatorSupport::DeviceType::ProductFamilyID kind);55 56  static lldb::PlatformSP57  CreateInstance(const char *class_name, const char *description,58                 ConstString plugin_name,59                 llvm::SmallVector<llvm::Triple::ArchType, 4> supported_arch,60                 llvm::Triple::OSType preferred_os,61                 llvm::SmallVector<llvm::Triple::OSType, 4> supported_os,62                 llvm::SmallVector<llvm::StringRef, 4> supported_triples,63                 std::string sdk_name_primary, std::string sdk_name_secondary,64                 XcodeSDK::Type sdk_type,65                 CoreSimulatorSupport::DeviceType::ProductFamilyID kind,66                 bool force, const ArchSpec *arch);67 68  ~PlatformAppleSimulator() override;69 70  llvm::StringRef GetPluginName() override {71    return m_plugin_name.GetStringRef();72  }73  llvm::StringRef GetDescription() override { return m_description; }74 75  Status LaunchProcess(ProcessLaunchInfo &launch_info) override;76 77  void GetStatus(Stream &strm) override;78 79  Status ConnectRemote(Args &args) override;80 81  Status DisconnectRemote() override;82 83  lldb::ProcessSP DebugProcess(ProcessLaunchInfo &launch_info,84                               Debugger &debugger, Target &target,85                               Status &error) override;86 87  std::vector<ArchSpec>88  GetSupportedArchitectures(const ArchSpec &process_host_arch) override;89 90  Status GetSharedModule(const ModuleSpec &module_spec, Process *process,91                         lldb::ModuleSP &module_sp,92                         llvm::SmallVectorImpl<lldb::ModuleSP> *old_modules,93                         bool *did_create_ptr) override;94 95  uint32_t FindProcesses(const ProcessInstanceInfoMatch &match_info,96                         ProcessInstanceInfoList &process_infos) override;97 98  void99  AddClangModuleCompilationOptions(Target *target,100                                   std::vector<std::string> &options) override {101    return PlatformDarwin::AddClangModuleCompilationOptionsForSDKType(102        target, options, m_sdk_type);103  }104 105protected:106  const char *m_class_name;107  const char *m_description;108  ConstString m_plugin_name;109  std::mutex m_core_sim_path_mutex;110  std::optional<FileSpec> m_core_simulator_framework_path;111  std::optional<CoreSimulatorSupport::Device> m_device;112  CoreSimulatorSupport::DeviceType::ProductFamilyID m_kind;113 114  FileSpec GetCoreSimulatorPath();115 116  llvm::StringRef GetSDKFilepath();117 118  llvm::Triple::OSType m_os_type = llvm::Triple::UnknownOS;119  llvm::SmallVector<llvm::StringRef, 4> m_supported_triples = {};120  std::string m_sdk_name_primary;121  std::string m_sdk_name_secondary;122  bool m_have_searched_for_sdk = false;123  llvm::StringRef m_sdk;124  XcodeSDK::Type m_sdk_type;125 126  void LoadCoreSimulator();127 128#if defined(__APPLE__)129  CoreSimulatorSupport::Device GetSimulatorDevice();130#endif131 132private:133  PlatformAppleSimulator(const PlatformAppleSimulator &) = delete;134  const PlatformAppleSimulator &135  operator=(const PlatformAppleSimulator &) = delete;136  Status137 138  GetSymbolFile(const FileSpec &platform_file, const UUID *uuid_ptr,139                FileSpec &local_file);140};141 142} // namespace lldb_private143 144#endif // LLDB_SOURCE_PLUGINS_PLATFORM_MACOSX_PLATFORMAPPLESIMULATOR_H145