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 GetSharedModule(const ModuleSpec &module_spec, Process *process,
91 lldb::ModuleSP &module_sp,
92 const FileSpecList *module_search_paths_ptr,
94 bool *did_create_ptr) override;
95
96 uint32_t FindProcesses(const ProcessInstanceInfoMatch &match_info,
97 ProcessInstanceInfoList &process_infos) override;
98
99 void
101 std::vector<std::string> &options) override {
103 target, options, m_sdk_type);
104 }
105
106protected:
107 const char *m_class_name;
108 const char *m_description;
111 std::optional<FileSpec> m_core_simulator_framework_path;
112 std::optional<CoreSimulatorSupport::Device> m_device;
114
116
117 llvm::StringRef GetSDKFilepath();
118
119 llvm::Triple::OSType m_os_type = llvm::Triple::UnknownOS;
120 llvm::SmallVector<llvm::StringRef, 4> m_supported_triples = {};
124 llvm::StringRef m_sdk;
126
127 void LoadCoreSimulator();
128
129#if defined(__APPLE__)
130 CoreSimulatorSupport::Device GetSimulatorDevice();
131#endif
132
133private:
137 Status
138
139 GetSymbolFile(const FileSpec &platform_file, const UUID *uuid_ptr,
140 FileSpec &local_file);
141};
142
143} // namespace lldb_private
144
145#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:80
A file collection class.
Definition: FileSpecList.h:91
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
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:341
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.
std::vector< ProcessInstanceInfo > ProcessInstanceInfoList
Definition: Host.h:32
std::shared_ptr< lldb_private::Platform > PlatformSP
Definition: lldb-forward.h:386
std::shared_ptr< lldb_private::Process > ProcessSP
Definition: lldb-forward.h:387
std::shared_ptr< lldb_private::Module > ModuleSP
Definition: lldb-forward.h:371