LLDB  mainline
PlatformDarwin.h
Go to the documentation of this file.
1 //===-- PlatformDarwin.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 liblldb_PlatformDarwin_h_
10 #define liblldb_PlatformDarwin_h_
11 
12 
14 #include "lldb/Host/FileSystem.h"
15 #include "lldb/Utility/FileSpec.h"
16 #include "llvm/ADT/StringRef.h"
17 #include "llvm/Support/FileSystem.h"
18 
19 #include <string>
20 #include <tuple>
21 
22 class PlatformDarwin : public PlatformPOSIX {
23 public:
24  PlatformDarwin(bool is_host);
25 
26  ~PlatformDarwin() override;
27 
28  // lldb_private::Platform functions
31  const lldb_private::ModuleSpec &sym_spec,
32  lldb_private::FileSpec &sym_file) override;
33 
34  lldb_private::FileSpecList LocateExecutableScriptingResources(
36  lldb_private::Stream *feedback_stream) override;
37 
39  GetSharedModule(const lldb_private::ModuleSpec &module_spec,
40  lldb_private::Process *process, lldb::ModuleSP &module_sp,
41  const lldb_private::FileSpecList *module_search_paths_ptr,
42  lldb::ModuleSP *old_module_sp_ptr,
43  bool *did_create_ptr) override;
44 
46  lldb_private::Target &target,
47  lldb_private::BreakpointSite *bp_site) override;
48 
49  lldb::BreakpointSP
51 
53  lldb_private::Target &target, const lldb::ModuleSP &module_sp) override;
54 
57 
60 
62  lldb_private::ProcessLaunchInfo &launch_info) override;
63 
64  void CalculateTrapHandlerSymbolNames() override;
65 
66  llvm::VersionTuple
67  GetOSVersion(lldb_private::Process *process = nullptr) override;
68 
69  bool SupportsModules() override { return true; }
70 
73 
74  lldb_private::FileSpec LocateExecutable(const char *basename) override;
75 
77  LaunchProcess(lldb_private::ProcessLaunchInfo &launch_info) override;
78 
79  static std::tuple<llvm::VersionTuple, llvm::StringRef>
80  ParseVersionBuildDir(llvm::StringRef str);
81 
82  enum SDKType : unsigned {
83  MacOSX = 0,
86  };
87 
88 protected:
90 
92 
94  const lldb_private::ModuleSpec &module_spec, lldb::ModuleSP &module_sp,
95  const lldb_private::FileSpecList *module_search_paths_ptr,
96  lldb::ModuleSP *old_module_sp_ptr, bool *did_create_ptr);
97 
98  static bool SDKSupportsModules(SDKType sdk_type, llvm::VersionTuple version);
99 
100  static bool SDKSupportsModules(SDKType desired_type,
101  const lldb_private::FileSpec &sdk_path);
102 
106  };
107 
109  DirectoryEnumerator(void *baton, llvm::sys::fs::file_type file_type,
110  llvm::StringRef path);
111 
114  const lldb_private::FileSpec &sdks_spec);
115 
118 
119  void
121  std::vector<std::string> &options,
122  SDKType sdk_type);
123 
124  const char *GetDeveloperDirectory();
125 
128  lldb::ModuleSP &module_sp, const lldb_private::FileSpecList *module_search_paths_ptr,
129  lldb::ModuleSP *old_module_sp_ptr, bool *did_create_ptr);
130 
132 
133 
134 private:
135  DISALLOW_COPY_AND_ASSIGN(PlatformDarwin);
136 };
137 
138 #endif // liblldb_PlatformDarwin_h_
Class that manages the actual breakpoint that will be inserted into the running program.
PlatformDarwin(bool is_host)
Default Constructor.
A stream class that can stream formatted output to a file.
Definition: Stream.h:28
lldb::BreakpointSP SetThreadCreationBreakpoint(lldb_private::Target &target) override
lldb_private::FileSpecList LocateExecutableScriptingResources(lldb_private::Target *target, lldb_private::Module &module, lldb_private::Stream *feedback_stream) override
std::string m_developer_directory
lldb_private::Status FindBundleBinaryInExecSearchPaths(const lldb_private::ModuleSpec &module_spec, lldb_private::Process *process, lldb::ModuleSP &module_sp, const lldb_private::FileSpecList *module_search_paths_ptr, lldb::ModuleSP *old_module_sp_ptr, bool *did_create_ptr)
bool ARMGetSupportedArchitectureAtIndex(uint32_t idx, lldb_private::ArchSpec &arch)
A file utility class.
Definition: FileSpec.h:55
An architecture specification class.
Definition: ArchSpec.h:32
static lldb_private::FileSpec FindSDKInXcodeForModules(SDKType sdk_type, const lldb_private::FileSpec &sdks_spec)
lldb_private::Status GetSharedModule(const lldb_private::ModuleSpec &module_spec, lldb_private::Process *process, lldb::ModuleSP &module_sp, const lldb_private::FileSpecList *module_search_paths_ptr, lldb::ModuleSP *old_module_sp_ptr, bool *did_create_ptr) override
const char * GetDeveloperDirectory()
bool SupportsModules() override
size_t GetSoftwareBreakpointTrapOpcode(lldb_private::Target &target, lldb_private::BreakpointSite *bp_site) override
lldb_private::ConstString GetFullNameForDylib(lldb_private::ConstString basename) override
static lldb_private::FileSystem::EnumerateDirectoryResult DirectoryEnumerator(void *baton, llvm::sys::fs::file_type file_type, llvm::StringRef path)
void ReadLibdispatchOffsetsAddress(lldb_private::Process *process)
void ReadLibdispatchOffsets(lldb_private::Process *process)
lldb_private::Status LaunchProcess(lldb_private::ProcessLaunchInfo &launch_info) override
Launch a new process on a platform, not necessarily for debugging, it could be just for running the p...
A class that describes an executable image and its associated object and symbol files.
Definition: Module.h:109
lldb_private::FileSpec found_path
bool ModuleIsExcludedForUnconstrainedSearches(lldb_private::Target &target, const lldb::ModuleSP &module_sp) override
static bool SDKSupportsModules(SDKType sdk_type, llvm::VersionTuple version)
A plug-in interface definition class for debugging a process.
Definition: Process.h:353
lldb_private::Status ResolveSymbolFile(lldb_private::Target &target, const lldb_private::ModuleSpec &sym_spec, lldb_private::FileSpec &sym_file) override
Find a symbol file given a symbol file module specification.
llvm::VersionTuple GetOSVersion(lldb_private::Process *process=nullptr) override
Get the OS version from a connected platform.
bool x86GetSupportedArchitectureAtIndex(uint32_t idx, lldb_private::ArchSpec &arch)
~PlatformDarwin() override
Destructor.
A uniqued constant string class.
Definition: ConstString.h:38
void CalculateTrapHandlerSymbolNames() override
Ask the Platform subclass to fill in the list of trap handler names.
char * basename(char *path)
int32_t GetResumeCountForLaunchInfo(lldb_private::ProcessLaunchInfo &launch_info) override
static lldb_private::FileSpec GetSDKDirectoryForModules(PlatformDarwin::SDKType sdk_type)
virtual lldb_private::Status GetSharedModuleWithLocalCache(const lldb_private::ModuleSpec &module_spec, lldb::ModuleSP &module_sp, const lldb_private::FileSpecList *module_search_paths_ptr, lldb::ModuleSP *old_module_sp_ptr, bool *did_create_ptr)
void AddClangModuleCompilationOptionsForSDKType(lldb_private::Target *target, std::vector< std::string > &options, SDKType sdk_type)
static std::tuple< llvm::VersionTuple, llvm::StringRef > ParseVersionBuildDir(llvm::StringRef str)
lldb_private::FileSpec LocateExecutable(const char *basename) override
Find a support executable that may not live within in the standard locations related to LLDB...
An error handling class.
Definition: Status.h:44