9#ifndef LLDB_SOURCE_PLUGINS_PLATFORM_MACOSX_PLATFORMDARWINKERNEL_H
10#define LLDB_SOURCE_PLUGINS_PLATFORM_MACOSX_PLATFORMDARWINKERNEL_H
20#include "llvm/ADT/SmallVector.h"
21#include "llvm/ADT/StringRef.h"
22#include "llvm/Support/Error.h"
23#include "llvm/Support/FileSystem.h"
42 static void DebuggerInitialize(Debugger &debugger);
44 static void Initialize();
46 static void Terminate();
50 static llvm::StringRef GetDescriptionStatic();
52 PlatformDarwinKernel(
LazyBool is_ios_debug_session);
54 ~PlatformDarwinKernel()
override;
58 llvm::StringRef GetDescription()
override {
return GetDescriptionStatic(); }
60 void GetStatus(Stream &strm)
override;
62 Status GetSharedModule(
const ModuleSpec &module_spec,
Target &target,
64 llvm::SmallVectorImpl<lldb::ModuleSP> *old_modules,
65 bool *did_create_ptr)
override;
68 GetSupportedArchitectures(
const ArchSpec &process_host_arch)
override;
70 bool SupportsModules()
override {
return false; }
72 void CalculateTrapHandlerSymbolNames()
override;
78 typedef std::multimap<ConstString, FileSpec> BundleIDToKextMap;
80 typedef std::vector<FileSpec> KernelBinaryCollection;
84 typedef std::vector<FileSpec> DirectoriesSearchedCollection;
85 typedef DirectoriesSearchedCollection::iterator DirectoriesSearchedIterator;
89 void CollectKextAndKernelDirectories();
91 void GetUserSpecifiedDirectoriesToSearch();
93 static void AddRootSubdirsToSearchPaths(PlatformDarwinKernel *thisp,
94 const std::string &dir);
96 void AddSDKSubdirsToSearchPaths(
const std::string &dir);
99 FindKDKandSDKDirectoriesInDirectory(
void *baton, llvm::sys::fs::file_type ft,
100 llvm::StringRef path);
102 void SearchForKextsAndKernelsRecursively();
105 GetKernelsAndKextsInDirectoryWithRecursion(
void *baton,
106 llvm::sys::fs::file_type ft,
107 llvm::StringRef path);
110 GetKernelsAndKextsInDirectoryNoRecursion(
void *baton,
111 llvm::sys::fs::file_type ft,
112 llvm::StringRef path);
115 GetKernelsAndKextsInDirectoryHelper(
void *baton, llvm::sys::fs::file_type ft,
116 llvm::StringRef path,
bool recurse);
118 static std::vector<FileSpec>
119 SearchForExecutablesRecursively(
const std::string &dir);
121 static void AddKextToMap(PlatformDarwinKernel *thisp,
122 const FileSpec &file_spec);
126 static bool KextHasdSYMSibling(
const FileSpec &kext_bundle_filepath);
129 static bool KernelHasdSYMSibling(
const FileSpec &kernel_filepath);
133 KerneldSYMHasNoSiblingBinary(
const FileSpec &kernel_dsym_filepath);
139 static std::vector<FileSpec>
140 GetDWARFBinaryInDSYMBundle(
const FileSpec &dsym_bundle);
142 llvm::Expected<lldb::ModuleSP>
143 GetSharedModuleKext(
const ModuleSpec &module_spec,
Target &target,
144 llvm::SmallVectorImpl<lldb::ModuleSP> *old_modules,
145 bool *did_create_ptr);
147 llvm::Expected<lldb::ModuleSP>
148 GetSharedModuleKernel(
const ModuleSpec &module_spec,
Target &target,
149 llvm::SmallVectorImpl<lldb::ModuleSP> *old_modules,
150 bool *did_create_ptr);
158 const FileSpecList &search_paths);
160 lldb::ModuleSP ExamineKextForMatchingUUID(
const FileSpec &kext_bundle_path,
162 const ArchSpec &arch);
165 bool notify)
override;
167 void UpdateKextandKernelsLocalScan();
177 BundleIDToKextMap m_name_to_kext_path_map_with_dsyms;
181 BundleIDToKextMap m_name_to_kext_path_map_without_dsyms;
184 DirectoriesSearchedCollection m_search_directories;
187 DirectoriesSearchedCollection m_search_directories_no_recursing;
191 KernelBinaryCollection m_kernel_binaries_with_dsyms;
195 KernelBinaryCollection m_kernel_binaries_without_dsyms;
198 KernelBinaryCollection m_kernel_dsyms_no_binaries;
201 KernelBinaryCollection m_kernel_dsyms_yaas;
205 std::once_flag m_kext_scan_flag;
207 PlatformDarwinKernel(
const PlatformDarwinKernel &) =
delete;
208 const PlatformDarwinKernel &operator=(
const PlatformDarwinKernel &) =
delete;
An architecture specification class.
A class to manage flag bits.
A plug-in interface definition class for debugging a process.
A stream class that can stream formatted output to a file.
A class that represents a running process on the host machine.
std::shared_ptr< lldb_private::Platform > PlatformSP
std::shared_ptr< lldb_private::Module > ModuleSP