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"
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 llvm::SmallVectorImpl<lldb::ModuleSP> *old_modules,
64 bool *did_create_ptr)
override;
67 GetSupportedArchitectures(
const ArchSpec &process_host_arch)
override;
69 bool SupportsModules()
override {
return false; }
71 void CalculateTrapHandlerSymbolNames()
override;
77 typedef std::multimap<ConstString, FileSpec> BundleIDToKextMap;
78 typedef BundleIDToKextMap::iterator BundleIDToKextIterator;
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 Status GetSharedModuleKext(
const ModuleSpec &module_spec,
Process *process,
144 llvm::SmallVectorImpl<lldb::ModuleSP> *old_modules,
145 bool *did_create_ptr);
148 GetSharedModuleKernel(
const ModuleSpec &module_spec,
Process *process,
150 llvm::SmallVectorImpl<lldb::ModuleSP> *old_modules,
151 bool *did_create_ptr);
153 Status ExamineKextForMatchingUUID(
const FileSpec &kext_bundle_path,
154 const UUID &uuid,
const ArchSpec &arch,
158 bool notify)
override;
160 void UpdateKextandKernelsLocalScan();
170 BundleIDToKextMap m_name_to_kext_path_map_with_dsyms;
174 BundleIDToKextMap m_name_to_kext_path_map_without_dsyms;
177 DirectoriesSearchedCollection m_search_directories;
180 DirectoriesSearchedCollection m_search_directories_no_recursing;
184 KernelBinaryCollection m_kernel_binaries_with_dsyms;
188 KernelBinaryCollection m_kernel_binaries_without_dsyms;
191 KernelBinaryCollection m_kernel_dsyms_no_binaries;
194 KernelBinaryCollection m_kernel_dsyms_yaas;
198 std::once_flag m_kext_scan_flag;
200 PlatformDarwinKernel(
const PlatformDarwinKernel &) =
delete;
201 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