LLDB mainline
PlatformAppleSimulator.h
Go to the documentation of this file.
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
17#include "lldb/Utility/Status.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
41public:
42 // Class Functions
43 static void Initialize();
44
45 static void Terminate();
46
47 // Class Methods
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,
55
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,
66 bool force, const ArchSpec *arch);
67
69
70 llvm::StringRef GetPluginName() override {
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
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
91 ResolveExecutable(const ModuleSpec &module_spec, lldb::ModuleSP &module_sp,
92 const FileSpecList *module_search_paths_ptr) override;
93
94 Status GetSharedModule(const ModuleSpec &module_spec, Process *process,
95 lldb::ModuleSP &module_sp,
96 const FileSpecList *module_search_paths_ptr,
98 bool *did_create_ptr) override;
99
100 uint32_t FindProcesses(const ProcessInstanceInfoMatch &match_info,
101 ProcessInstanceInfoList &process_infos) override;
102
103 void
105 std::vector<std::string> &options) override {
107 target, options, m_sdk_type);
108 }
109
110protected:
111 const char *m_class_name;
112 const char *m_description;
115 std::optional<FileSpec> m_core_simulator_framework_path;
116 std::optional<CoreSimulatorSupport::Device> m_device;
118
120
121 llvm::StringRef GetSDKFilepath();
122
123 llvm::Triple::OSType m_os_type = llvm::Triple::UnknownOS;
124 llvm::SmallVector<llvm::StringRef, 4> m_supported_triples = {};
128 llvm::StringRef m_sdk;
130
131 void LoadCoreSimulator();
132
133#if defined(__APPLE__)
134 CoreSimulatorSupport::Device GetSimulatorDevice();
135#endif
136
137private:
141 Status
142
143 GetSymbolFile(const FileSpec &platform_file, const UUID *uuid_ptr,
144 FileSpec &local_file);
145};
146
147} // namespace lldb_private
148
149#endif // LLDB_SOURCE_PLUGINS_PLATFORM_MACOSX_PLATFORMAPPLESIMULATOR_H
static llvm::raw_ostream & error(Stream &strm)
An architecture specification class.
Definition: ArchSpec.h:31
A command line argument class.
Definition: Args.h:33
A uniqued constant string class.
Definition: ConstString.h:40
llvm::StringRef GetStringRef() const
Get the string value as a llvm::StringRef.
Definition: ConstString.h:197
A class to manage flag bits.
Definition: Debugger.h:79
A file collection class.
Definition: FileSpecList.h:85
A file utility class.
Definition: FileSpec.h:56
std::optional< FileSpec > m_core_simulator_framework_path
llvm::StringRef GetPluginName() override
Status LaunchProcess(ProcessLaunchInfo &launch_info) override
Launch a new process on a platform, not necessarily for debugging, it could be just for running the p...
void AddClangModuleCompilationOptions(Target *target, std::vector< std::string > &options) override
~PlatformAppleSimulator() override
Destructor.
CoreSimulatorSupport::DeviceType::ProductFamilyID m_kind
llvm::SmallVector< llvm::StringRef, 4 > m_supported_triples
PlatformAppleSimulator(const PlatformAppleSimulator &)=delete
Status GetSharedModule(const ModuleSpec &module_spec, Process *process, lldb::ModuleSP &module_sp, const FileSpecList *module_search_paths_ptr, llvm::SmallVectorImpl< lldb::ModuleSP > *old_modules, bool *did_create_ptr) override
static lldb::PlatformSP CreateInstance(const char *class_name, const char *description, ConstString plugin_name, llvm::SmallVector< llvm::Triple::ArchType, 4 > supported_arch, llvm::Triple::OSType preferred_os, llvm::SmallVector< llvm::Triple::OSType, 4 > supported_os, llvm::SmallVector< llvm::StringRef, 4 > supported_triples, std::string sdk_name_primary, std::string sdk_name_secondary, XcodeSDK::Type sdk_type, CoreSimulatorSupport::DeviceType::ProductFamilyID kind, bool force, const ArchSpec *arch)
lldb::ProcessSP DebugProcess(ProcessLaunchInfo &launch_info, Debugger &debugger, Target &target, Status &error) override
Subclasses do not need to implement this function as it uses the Platform::LaunchProcess() followed b...
std::optional< CoreSimulatorSupport::Device > m_device
uint32_t FindProcesses(const ProcessInstanceInfoMatch &match_info, ProcessInstanceInfoList &process_infos) override
Attach to an existing process by process name.
llvm::StringRef GetDescription() override
const PlatformAppleSimulator & operator=(const PlatformAppleSimulator &)=delete
Status ResolveExecutable(const ModuleSpec &module_spec, lldb::ModuleSP &module_sp, const FileSpecList *module_search_paths_ptr) override
Find a platform plugin for a given process.
void GetStatus(Stream &strm) override
Report the current status for this platform.
std::vector< ArchSpec > GetSupportedArchitectures(const ArchSpec &process_host_arch) override
Get the platform's supported architectures in the order in which they should be searched.
Status GetSymbolFile(const FileSpec &platform_file, const UUID *uuid_ptr, FileSpec &local_file)
void AddClangModuleCompilationOptionsForSDKType(Target *target, std::vector< std::string > &options, XcodeSDK::Type sdk_type)
A plug-in interface definition class for debugging a process.
Definition: Process.h:340
An error handling class.
Definition: Status.h:44
A stream class that can stream formatted output to a file.
Definition: Stream.h:28
Type
Different types of Xcode SDKs.
Definition: XcodeSDK.h:29
A class that represents a running process on the host machine.
Definition: SBAttachInfo.h:14
std::vector< ProcessInstanceInfo > ProcessInstanceInfoList
Definition: Host.h:32
std::shared_ptr< lldb_private::Platform > PlatformSP
Definition: lldb-forward.h:380
std::shared_ptr< lldb_private::Process > ProcessSP
Definition: lldb-forward.h:381
std::shared_ptr< lldb_private::Module > ModuleSP
Definition: lldb-forward.h:365