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/FileSystem.h"
37class PlatformDarwinKernel :
public PlatformDarwin {
41 static void DebuggerInitialize(Debugger &debugger);
43 static void Initialize();
45 static void Terminate();
49 static llvm::StringRef GetDescriptionStatic();
51 PlatformDarwinKernel(
LazyBool is_ios_debug_session);
53 ~PlatformDarwinKernel()
override;
57 llvm::StringRef GetDescription()
override {
return GetDescriptionStatic(); }
59 void GetStatus(Stream &strm)
override;
61 Status GetSharedModule(
const ModuleSpec &module_spec, Process *process,
63 const FileSpecList *module_search_paths_ptr,
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;
79 typedef BundleIDToKextMap::iterator BundleIDToKextIterator;
81 typedef std::vector<FileSpec> KernelBinaryCollection;
85 typedef std::vector<FileSpec> DirectoriesSearchedCollection;
86 typedef DirectoriesSearchedCollection::iterator DirectoriesSearchedIterator;
90 void CollectKextAndKernelDirectories();
92 void GetUserSpecifiedDirectoriesToSearch();
94 static void AddRootSubdirsToSearchPaths(PlatformDarwinKernel *thisp,
95 const std::string &dir);
97 void AddSDKSubdirsToSearchPaths(
const std::string &dir);
100 FindKDKandSDKDirectoriesInDirectory(
void *baton, llvm::sys::fs::file_type ft,
101 llvm::StringRef path);
103 void SearchForKextsAndKernelsRecursively();
106 GetKernelsAndKextsInDirectoryWithRecursion(
void *baton,
107 llvm::sys::fs::file_type ft,
108 llvm::StringRef path);
111 GetKernelsAndKextsInDirectoryNoRecursion(
void *baton,
112 llvm::sys::fs::file_type ft,
113 llvm::StringRef path);
116 GetKernelsAndKextsInDirectoryHelper(
void *baton, llvm::sys::fs::file_type ft,
117 llvm::StringRef path,
bool recurse);
119 static std::vector<FileSpec>
120 SearchForExecutablesRecursively(
const std::string &dir);
122 static void AddKextToMap(PlatformDarwinKernel *thisp,
123 const FileSpec &file_spec);
127 static bool KextHasdSYMSibling(
const FileSpec &kext_bundle_filepath);
130 static bool KernelHasdSYMSibling(
const FileSpec &kernel_filepath);
134 KerneldSYMHasNoSiblingBinary(
const FileSpec &kernel_dsym_filepath);
140 static std::vector<FileSpec>
141 GetDWARFBinaryInDSYMBundle(
const FileSpec &dsym_bundle);
143 Status GetSharedModuleKext(
const ModuleSpec &module_spec, Process *process,
145 const FileSpecList *module_search_paths_ptr,
147 bool *did_create_ptr);
149 Status GetSharedModuleKernel(
150 const ModuleSpec &module_spec, Process *process,
151 lldb::ModuleSP &module_sp,
const FileSpecList *module_search_paths_ptr,
154 Status ExamineKextForMatchingUUID(
const FileSpec &kext_bundle_path,
155 const UUID &uuid,
const ArchSpec &arch,
158 bool LoadPlatformBinaryAndSetup(Process *process,
lldb::addr_t addr,
159 bool notify)
override;
161 void UpdateKextandKernelsLocalScan();
171 BundleIDToKextMap m_name_to_kext_path_map_with_dsyms;
175 BundleIDToKextMap m_name_to_kext_path_map_without_dsyms;
178 DirectoriesSearchedCollection m_search_directories;
181 DirectoriesSearchedCollection m_search_directories_no_recursing;
185 KernelBinaryCollection m_kernel_binaries_with_dsyms;
189 KernelBinaryCollection m_kernel_binaries_without_dsyms;
192 KernelBinaryCollection m_kernel_dsyms_no_binaries;
195 KernelBinaryCollection m_kernel_dsyms_yaas;
199 std::once_flag m_kext_scan_flag;
201 PlatformDarwinKernel(
const PlatformDarwinKernel &) =
delete;
202 const PlatformDarwinKernel &operator=(
const PlatformDarwinKernel &) =
delete;
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