[NFC][AArch64] Explicitly define undefined bits for instructions (#122129)
[llvm-project.git] / lldb / source / Plugins / Platform / MacOSX / PlatformAppleSimulator.h
blob7fcf2c502ca6a583873ea66148334bc9029b24ea
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 //===----------------------------------------------------------------------===//
9 #ifndef LLDB_SOURCE_PLUGINS_PLATFORM_MACOSX_PLATFORMAPPLESIMULATOR_H
10 #define LLDB_SOURCE_PLUGINS_PLATFORM_MACOSX_PLATFORMAPPLESIMULATOR_H
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"
24 #include <mutex>
25 #include <optional>
26 #include <vector>
28 namespace lldb_private {
29 class ArchSpec;
30 class Args;
31 class Debugger;
32 class FileSpecList;
33 class ModuleSpec;
34 class Process;
35 class ProcessLaunchInfo;
36 class Stream;
37 class Target;
38 class UUID;
40 class PlatformAppleSimulator : public PlatformDarwin {
41 public:
42 // Class Functions
43 static void Initialize();
45 static void Terminate();
47 // Class Methods
48 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);
56 static lldb::PlatformSP
57 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);
68 ~PlatformAppleSimulator() override;
70 llvm::StringRef GetPluginName() override {
71 return m_plugin_name.GetStringRef();
73 llvm::StringRef GetDescription() override { return m_description; }
75 Status LaunchProcess(ProcessLaunchInfo &launch_info) override;
77 void GetStatus(Stream &strm) override;
79 Status ConnectRemote(Args &args) override;
81 Status DisconnectRemote() override;
83 lldb::ProcessSP DebugProcess(ProcessLaunchInfo &launch_info,
84 Debugger &debugger, Target &target,
85 Status &error) override;
87 std::vector<ArchSpec>
88 GetSupportedArchitectures(const ArchSpec &process_host_arch) override;
90 Status GetSharedModule(const ModuleSpec &module_spec, Process *process,
91 lldb::ModuleSP &module_sp,
92 const FileSpecList *module_search_paths_ptr,
93 llvm::SmallVectorImpl<lldb::ModuleSP> *old_modules,
94 bool *did_create_ptr) override;
96 uint32_t FindProcesses(const ProcessInstanceInfoMatch &match_info,
97 ProcessInstanceInfoList &process_infos) override;
99 void
100 AddClangModuleCompilationOptions(Target *target,
101 std::vector<std::string> &options) override {
102 return PlatformDarwin::AddClangModuleCompilationOptionsForSDKType(
103 target, options, m_sdk_type);
106 protected:
107 const char *m_class_name;
108 const char *m_description;
109 ConstString m_plugin_name;
110 std::mutex m_core_sim_path_mutex;
111 std::optional<FileSpec> m_core_simulator_framework_path;
112 std::optional<CoreSimulatorSupport::Device> m_device;
113 CoreSimulatorSupport::DeviceType::ProductFamilyID m_kind;
115 FileSpec GetCoreSimulatorPath();
117 llvm::StringRef GetSDKFilepath();
119 llvm::Triple::OSType m_os_type = llvm::Triple::UnknownOS;
120 llvm::SmallVector<llvm::StringRef, 4> m_supported_triples = {};
121 std::string m_sdk_name_primary;
122 std::string m_sdk_name_secondary;
123 bool m_have_searched_for_sdk = false;
124 llvm::StringRef m_sdk;
125 XcodeSDK::Type m_sdk_type;
127 void LoadCoreSimulator();
129 #if defined(__APPLE__)
130 CoreSimulatorSupport::Device GetSimulatorDevice();
131 #endif
133 private:
134 PlatformAppleSimulator(const PlatformAppleSimulator &) = delete;
135 const PlatformAppleSimulator &
136 operator=(const PlatformAppleSimulator &) = delete;
137 Status
139 GetSymbolFile(const FileSpec &platform_file, const UUID *uuid_ptr,
140 FileSpec &local_file);
143 } // namespace lldb_private
145 #endif // LLDB_SOURCE_PLUGINS_PLATFORM_MACOSX_PLATFORMAPPLESIMULATOR_H