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 {
39 static lldb::PlatformSP CreateInstance(
bool force,
const ArchSpec *arch);
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,
62 lldb::ModuleSP &module_sp,
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> GetDWARFBinaryInDSYMBundle(FileSpec dsym_bundle);
142 Status GetSharedModuleKext(
const ModuleSpec &module_spec, Process *process,
143 lldb::ModuleSP &module_sp,
144 const FileSpecList *module_search_paths_ptr,
146 bool *did_create_ptr);
148 Status GetSharedModuleKernel(
149 const ModuleSpec &module_spec, Process *process,
150 lldb::ModuleSP &module_sp,
const FileSpecList *module_search_paths_ptr,
153 Status ExamineKextForMatchingUUID(
const FileSpec &kext_bundle_path,
154 const UUID &uuid,
const ArchSpec &arch,
155 lldb::ModuleSP &exe_module_sp);
157 bool LoadPlatformBinaryAndSetup(Process *process,
lldb::addr_t addr,
158 bool notify)
override;
168 BundleIDToKextMap m_name_to_kext_path_map_with_dsyms;
172 BundleIDToKextMap m_name_to_kext_path_map_without_dsyms;
175 DirectoriesSearchedCollection m_search_directories;
178 DirectoriesSearchedCollection m_search_directories_no_recursing;
182 KernelBinaryCollection m_kernel_binaries_with_dsyms;
186 KernelBinaryCollection m_kernel_binaries_without_dsyms;
189 KernelBinaryCollection m_kernel_dsyms_no_binaries;
192 KernelBinaryCollection m_kernel_dsyms_yaas;
196 PlatformDarwinKernel(
const PlatformDarwinKernel &) =
delete;
197 const PlatformDarwinKernel &operator=(
const PlatformDarwinKernel &) =
delete;
A class that represents a running process on the host machine.