37#include "llvm/Support/FileSystem.h"
39#include <CoreFoundation/CoreFoundation.h>
54void PlatformDarwinKernel::Initialize() {
55 PlatformDarwin::Initialize();
58 PluginManager::RegisterPlugin(PlatformDarwinKernel::GetPluginNameStatic(),
59 PlatformDarwinKernel::GetDescriptionStatic(),
60 PlatformDarwinKernel::CreateInstance,
61 PlatformDarwinKernel::DebuggerInitialize);
65void PlatformDarwinKernel::Terminate() {
68 PluginManager::UnregisterPlugin(PlatformDarwinKernel::CreateInstance);
72 PlatformDarwin::Terminate();
75PlatformSP PlatformDarwinKernel::CreateInstance(
bool force,
79 const char *arch_name;
85 const char *triple_cstr =
86 arch ? arch->
GetTriple().getTriple().c_str() :
"<null>";
88 LLDB_LOGF(log,
"PlatformDarwinKernel::%s(force=%s, arch={%s,%s})",
89 __FUNCTION__, force ?
"true" :
"false", arch_name, triple_cstr);
98 "PlatformDarwinKernel::%s() aborting creation of platform "
99 "because force == false",
107 if (!create && arch && arch->
IsValid()) {
108 const llvm::Triple &triple = arch->
GetTriple();
109 switch (triple.getVendor()) {
110 case llvm::Triple::Apple:
116 case llvm::Triple::UnknownVendor:
124 switch (triple.getOS()) {
125 case llvm::Triple::Darwin:
126 case llvm::Triple::MacOSX:
127 case llvm::Triple::IOS:
128 case llvm::Triple::WatchOS:
129 case llvm::Triple::TvOS:
130 case llvm::Triple::BridgeOS:
134 case llvm::Triple::UnknownOS:
145 case llvm::Triple::x86:
146 case llvm::Triple::x86_64:
147 case llvm::Triple::ppc:
148 case llvm::Triple::ppc64:
151 case llvm::Triple::arm:
152 case llvm::Triple::aarch64:
153 case llvm::Triple::thumb:
162 LLDB_LOGF(log,
"PlatformDarwinKernel::%s() creating platform",
168 LLDB_LOGF(log,
"PlatformDarwinKernel::%s() aborting creation of platform",
174llvm::StringRef PlatformDarwinKernel::GetDescriptionStatic() {
175 return "Darwin Kernel platform plug-in.";
180#define LLDB_PROPERTIES_platformdarwinkernel
181#include "PlatformMacOSXProperties.inc"
184#define LLDB_PROPERTIES_platformdarwinkernel
185#include "PlatformMacOSXPropertiesEnum.inc"
188class PlatformDarwinKernelProperties :
public Properties {
190 static llvm::StringRef GetSettingName() {
191 static constexpr llvm::StringLiteral g_setting_name(
"darwin-kernel");
192 return g_setting_name;
195 PlatformDarwinKernelProperties() :
Properties() {
196 m_collection_sp = std::make_shared<OptionValueProperties>(GetSettingName());
197 m_collection_sp->Initialize(g_platformdarwinkernel_properties);
200 ~PlatformDarwinKernelProperties()
override =
default;
203 const uint32_t idx = ePropertyKextDirectories;
204 return GetPropertyAtIndexAs<FileSpecList>(idx, {});
209 static PlatformDarwinKernelProperties g_settings;
213void PlatformDarwinKernel::DebuggerInitialize(
215 if (!PluginManager::GetSettingForPlatformPlugin(
216 debugger, PlatformDarwinKernelProperties::GetSettingName())) {
217 const bool is_global_setting =
true;
218 PluginManager::CreateSettingForPlatformPlugin(
220 "Properties for the PlatformDarwinKernel plug-in.", is_global_setting);
225PlatformDarwinKernel::PlatformDarwinKernel(
228 m_name_to_kext_path_map_with_dsyms(),
229 m_name_to_kext_path_map_without_dsyms(), m_search_directories(),
230 m_search_directories_no_recursing(), m_kernel_binaries_with_dsyms(),
231 m_kernel_binaries_without_dsyms(), m_kernel_dsyms_no_binaries(),
232 m_kernel_dsyms_yaas(), m_ios_debug_session(is_ios_debug_session),
233 m_kext_scan_flag() {}
239PlatformDarwinKernel::~PlatformDarwinKernel() =
default;
241void PlatformDarwinKernel::GetStatus(
Stream &strm) {
242 UpdateKextandKernelsLocalScan();
243 Platform::GetStatus(strm);
244 strm.
Printf(
" Debug session type: ");
245 if (m_ios_debug_session == eLazyBoolYes)
246 strm.
Printf(
"iOS kernel debugging\n");
247 else if (m_ios_debug_session == eLazyBoolNo)
248 strm.
Printf(
"Mac OS X kernel debugging\n");
250 strm.
Printf(
"unknown kernel debugging\n");
252 strm.
Printf(
"Directories searched recursively:\n");
253 const uint32_t num_kext_dirs = m_search_directories.size();
254 for (uint32_t i = 0; i < num_kext_dirs; ++i) {
255 strm.
Printf(
"[%d] %s\n", i, m_search_directories[i].GetPath().c_str());
258 strm.
Printf(
"Directories not searched recursively:\n");
259 const uint32_t num_kext_dirs_no_recursion =
260 m_search_directories_no_recursing.size();
261 for (uint32_t i = 0; i < num_kext_dirs_no_recursion; i++) {
262 strm.
Printf(
"[%d] %s\n", i,
263 m_search_directories_no_recursing[i].GetPath().c_str());
266 strm.
Printf(
" Number of kexts with dSYMs indexed: %d\n",
267 (
int)m_name_to_kext_path_map_with_dsyms.size());
268 strm.
Printf(
" Number of kexts without dSYMs indexed: %d\n",
269 (
int)m_name_to_kext_path_map_without_dsyms.size());
270 strm.
Printf(
" Number of Kernel binaries with dSYMs indexed: %d\n",
271 (
int)m_kernel_binaries_with_dsyms.size());
272 strm.
Printf(
" Number of Kernel binaries without dSYMs indexed: %d\n",
273 (
int)m_kernel_binaries_without_dsyms.size());
274 strm.
Printf(
" Number of Kernel dSYMs with no binaries indexed: %d\n",
275 (
int)m_kernel_dsyms_no_binaries.size());
276 strm.
Printf(
" Number of Kernel dSYM.yaa's indexed: %d\n",
277 (
int)m_kernel_dsyms_yaas.size());
282 for (
auto pos : m_name_to_kext_path_map_with_dsyms) {
283 LLDB_LOGF(log,
"%s", pos.second.GetPath().c_str());
287 for (
auto pos : m_name_to_kext_path_map_without_dsyms) {
288 LLDB_LOGF(log,
"%s", pos.second.GetPath().c_str());
290 LLDB_LOGF(log,
"\nkernel binaries with dSYMS");
291 for (
auto fs : m_kernel_binaries_with_dsyms) {
292 LLDB_LOGF(log,
"%s", fs.GetPath().c_str());
294 LLDB_LOGF(log,
"\nkernel binaries without dSYMS");
295 for (
auto fs : m_kernel_binaries_without_dsyms) {
296 LLDB_LOGF(log,
"%s", fs.GetPath().c_str());
298 LLDB_LOGF(log,
"\nkernel dSYMS with no binaries");
299 for (
auto fs : m_kernel_dsyms_no_binaries) {
300 LLDB_LOGF(log,
"%s", fs.GetPath().c_str());
303 for (
auto fs : m_kernel_dsyms_yaas) {
304 LLDB_LOGF(log,
"%s", fs.GetPath().c_str());
313void PlatformDarwinKernel::CollectKextAndKernelDirectories() {
321 std::string developer_dir = HostInfo::GetXcodeDeveloperDirectory().GetPath();
322 if (developer_dir.empty())
323 developer_dir =
"/Applications/Xcode.app/Contents/Developer";
325 if (m_ios_debug_session != eLazyBoolNo) {
326 AddSDKSubdirsToSearchPaths(developer_dir +
327 "/Platforms/iPhoneOS.platform/Developer/SDKs");
328 AddSDKSubdirsToSearchPaths(developer_dir +
329 "/Platforms/AppleTVOS.platform/Developer/SDKs");
330 AddSDKSubdirsToSearchPaths(developer_dir +
331 "/Platforms/WatchOS.platform/Developer/SDKs");
332 AddSDKSubdirsToSearchPaths(developer_dir +
333 "/Platforms/BridgeOS.platform/Developer/SDKs");
335 if (m_ios_debug_session != eLazyBoolYes) {
336 AddSDKSubdirsToSearchPaths(developer_dir +
337 "/Platforms/MacOSX.platform/Developer/SDKs");
340 AddSDKSubdirsToSearchPaths(
"/Volumes/KernelDebugKit");
341 AddSDKSubdirsToSearchPaths(
"/AppleInternal/Developer/KDKs");
344 AddSDKSubdirsToSearchPaths(
"/Library/Developer/KDKs");
346 if (m_ios_debug_session != eLazyBoolNo) {
348 if (m_ios_debug_session != eLazyBoolYes) {
349 AddRootSubdirsToSearchPaths(
this,
"/");
352 GetUserSpecifiedDirectoriesToSearch();
355 FileSpec possible_dir(developer_dir +
"/../Symbols");
356 FileSystem::Instance().Resolve(possible_dir);
357 if (FileSystem::Instance().IsDirectory(possible_dir))
358 m_search_directories.push_back(possible_dir);
362 FileSystem::Instance().Resolve(cwd);
363 m_search_directories_no_recursing.push_back(cwd);
366void PlatformDarwinKernel::GetUserSpecifiedDirectoriesToSearch() {
368 std::vector<FileSpec> possible_sdk_dirs;
370 const uint32_t user_dirs_count = user_dirs.GetSize();
371 for (uint32_t i = 0; i < user_dirs_count; i++) {
372 FileSpec dir = user_dirs.GetFileSpecAtIndex(i);
373 FileSystem::Instance().Resolve(dir);
374 if (FileSystem::Instance().IsDirectory(dir)) {
375 m_search_directories.push_back(dir);
380void PlatformDarwinKernel::AddRootSubdirsToSearchPaths(
382 const char *subdirs[] = {
383 "/System/Library/Extensions",
"/Library/Extensions",
384 "/System/Library/Kernels",
385 "/System/Library/Extensions/KDK",
388 for (
int i = 0; subdirs[i] !=
nullptr; i++) {
390 FileSystem::Instance().Resolve(testdir);
391 if (FileSystem::Instance().IsDirectory(testdir))
392 thisp->m_search_directories.push_back(testdir);
396 thisp->m_search_directories_no_recursing.push_back(
FileSpec(dir +
"/"));
400void PlatformDarwinKernel::AddSDKSubdirsToSearchPaths(
const std::string &dir) {
402 const bool find_directories =
true;
403 const bool find_files =
false;
404 const bool find_other =
false;
405 FileSystem::Instance().EnumerateDirectory(
406 dir.c_str(), find_directories, find_files, find_other,
407 FindKDKandSDKDirectoriesInDirectory,
this);
412PlatformDarwinKernel::FindKDKandSDKDirectoriesInDirectory(
413 void *baton, llvm::sys::fs::file_type ft, llvm::StringRef path) {
414 static constexpr llvm::StringLiteral g_sdk_suffix =
".sdk";
415 static constexpr llvm::StringLiteral g_kdk_suffix =
".kdk";
419 if (ft == llvm::sys::fs::file_type::directory_file &&
420 (file_spec.GetFileNameExtension() == g_sdk_suffix ||
421 file_spec.GetFileNameExtension() == g_kdk_suffix)) {
422 AddRootSubdirsToSearchPaths(thisp, file_spec.GetPath());
424 return FileSystem::eEnumerateDirectoryResultNext;
429void PlatformDarwinKernel::SearchForKextsAndKernelsRecursively() {
430 const uint32_t num_dirs = m_search_directories.size();
431 for (uint32_t i = 0; i < num_dirs; i++) {
432 const FileSpec &dir = m_search_directories[i];
433 const bool find_directories =
true;
434 const bool find_files =
true;
435 const bool find_other =
true;
436 FileSystem::Instance().EnumerateDirectory(
437 dir.
GetPath().c_str(), find_directories, find_files, find_other,
438 GetKernelsAndKextsInDirectoryWithRecursion,
this);
440 const uint32_t num_dirs_no_recurse = m_search_directories_no_recursing.size();
441 for (uint32_t i = 0; i < num_dirs_no_recurse; i++) {
442 const FileSpec &dir = m_search_directories_no_recursing[i];
443 const bool find_directories =
true;
444 const bool find_files =
true;
445 const bool find_other =
true;
446 FileSystem::Instance().EnumerateDirectory(
447 dir.
GetPath().c_str(), find_directories, find_files, find_other,
448 GetKernelsAndKextsInDirectoryNoRecursion,
this);
461PlatformDarwinKernel::GetKernelsAndKextsInDirectoryWithRecursion(
462 void *baton, llvm::sys::fs::file_type ft, llvm::StringRef path) {
463 return GetKernelsAndKextsInDirectoryHelper(baton, ft, path,
true);
467PlatformDarwinKernel::GetKernelsAndKextsInDirectoryNoRecursion(
468 void *baton, llvm::sys::fs::file_type ft, llvm::StringRef path) {
469 return GetKernelsAndKextsInDirectoryHelper(baton, ft, path,
false);
473PlatformDarwinKernel::GetKernelsAndKextsInDirectoryHelper(
474 void *baton, llvm::sys::fs::file_type ft, llvm::StringRef path,
476 static constexpr llvm::StringLiteral g_kext_suffix =
".kext";
477 static constexpr llvm::StringLiteral g_dsym_suffix =
".dSYM";
480 llvm::StringRef file_spec_extension = file_spec.GetFileNameExtension();
484 LLDB_LOGV(log,
"PlatformDarwinKernel examining '{0}'", file_spec);
488 llvm::StringRef filename = file_spec.GetFilename().GetStringRef();
489 bool is_kernel_filename =
490 filename.starts_with(
"kernel") || filename.starts_with(
"mach");
491 bool is_dsym_yaa = filename.ends_with(
".dSYM.yaa");
493 if (ft == llvm::sys::fs::file_type::regular_file ||
494 ft == llvm::sys::fs::file_type::symlink_file) {
495 if (is_kernel_filename) {
496 if (file_spec_extension != g_dsym_suffix && !is_dsym_yaa) {
497 if (KernelHasdSYMSibling(file_spec)) {
499 "PlatformDarwinKernel registering kernel binary '%s' with "
501 file_spec.GetPath().c_str());
502 thisp->m_kernel_binaries_with_dsyms.push_back(file_spec);
506 "PlatformDarwinKernel registering kernel binary '%s', no dSYM",
507 file_spec.GetPath().c_str());
508 thisp->m_kernel_binaries_without_dsyms.push_back(file_spec);
512 LLDB_LOGF(log,
"PlatformDarwinKernel registering kernel .dSYM.yaa '%s'",
513 file_spec.GetPath().c_str());
514 thisp->m_kernel_dsyms_yaas.push_back(file_spec);
516 return FileSystem::eEnumerateDirectoryResultNext;
519 if (ft == llvm::sys::fs::file_type::directory_file) {
520 if (file_spec_extension == g_kext_suffix) {
521 AddKextToMap(thisp, file_spec);
523 FileSpec contents_plugins(file_spec.GetPath() +
"/Contents/PlugIns");
524 std::string search_here_too;
525 if (FileSystem::Instance().IsDirectory(contents_plugins)) {
526 search_here_too = contents_plugins.GetPath();
528 FileSpec plugins(file_spec.GetPath() +
"/PlugIns");
529 if (FileSystem::Instance().IsDirectory(plugins)) {
530 search_here_too = plugins.GetPath();
534 if (!search_here_too.empty()) {
535 const bool find_directories =
true;
536 const bool find_files =
false;
537 const bool find_other =
true;
538 FileSystem::Instance().EnumerateDirectory(
539 search_here_too.c_str(), find_directories, find_files, find_other,
540 recurse ? GetKernelsAndKextsInDirectoryWithRecursion
541 : GetKernelsAndKextsInDirectoryNoRecursion,
544 return FileSystem::eEnumerateDirectoryResultNext;
547 if (is_kernel_filename && file_spec_extension == g_dsym_suffix) {
548 if (KerneldSYMHasNoSiblingBinary(file_spec)) {
550 "PlatformDarwinKernel registering kernel dSYM '%s' with "
552 file_spec.GetPath().c_str());
553 thisp->m_kernel_dsyms_no_binaries.push_back(file_spec);
554 return FileSystem::eEnumerateDirectoryResultNext;
561 if (recurse && file_spec_extension != g_dsym_suffix &&
562 file_spec_extension != g_kext_suffix) {
563 LLDB_LOGV(log,
"PlatformDarwinKernel descending into directory '{0}'",
565 return FileSystem::eEnumerateDirectoryResultEnter;
567 return FileSystem::eEnumerateDirectoryResultNext;
576 if (bundle_id && CFGetTypeID(bundle_id) == CFStringGetTypeID()) {
578 if (CFStringGetCString(bundle_id, bundle_id_buf,
sizeof(bundle_id_buf),
579 kCFStringEncodingUTF8)) {
581 if (KextHasdSYMSibling(file_spec))
584 "PlatformDarwinKernel registering kext binary '%s' with dSYM "
587 thisp->m_name_to_kext_path_map_with_dsyms.insert(
588 std::pair<ConstString, FileSpec>(bundle_conststr, file_spec));
593 "PlatformDarwinKernel registering kext binary '%s', no dSYM",
595 thisp->m_name_to_kext_path_map_without_dsyms.insert(
596 std::pair<ConstString, FileSpec>(bundle_conststr, file_spec));
607bool PlatformDarwinKernel::KextHasdSYMSibling(
608 const FileSpec &kext_bundle_filepath) {
609 FileSpec dsym_fspec = kext_bundle_filepath;
613 if (FileSystem::Instance().IsDirectory(dsym_fspec)) {
622 std::string deep_bundle_str =
623 kext_bundle_filepath.
GetPath() +
"/Contents/MacOS/";
624 deep_bundle_str += executable_name.
AsCString();
625 deep_bundle_str +=
".dSYM";
626 dsym_fspec.
SetFile(deep_bundle_str, FileSpec::Style::native);
627 FileSystem::Instance().Resolve(dsym_fspec);
628 if (FileSystem::Instance().IsDirectory(dsym_fspec)) {
634 std::string shallow_bundle_str = kext_bundle_filepath.
GetPath() +
"/";
635 shallow_bundle_str += executable_name.
AsCString();
636 shallow_bundle_str +=
".dSYM";
637 dsym_fspec.
SetFile(shallow_bundle_str, FileSpec::Style::native);
638 FileSystem::Instance().Resolve(dsym_fspec);
639 return FileSystem::Instance().IsDirectory(dsym_fspec);
645bool PlatformDarwinKernel::KernelHasdSYMSibling(
const FileSpec &kernel_binary) {
646 FileSpec kernel_dsym = kernel_binary;
650 return FileSystem::Instance().IsDirectory(kernel_dsym);
658bool PlatformDarwinKernel::KerneldSYMHasNoSiblingBinary(
660 static constexpr llvm::StringLiteral g_dsym_suffix =
".dSYM";
661 std::string possible_path = kernel_dsym.
GetPath();
665 FileSpec binary_filespec = kernel_dsym;
670 if (FileSystem::Instance().Exists(binary_filespec))
676 if (GetDWARFBinaryInDSYMBundle(kernel_dsym).size() > 0)
688PlatformDarwinKernel::GetDWARFBinaryInDSYMBundle(
const FileSpec &dsym_bundle) {
689 std::vector<FileSpec> results;
690 static constexpr llvm::StringLiteral g_dsym_suffix =
".dSYM";
695 std::string filename =
699 std::string binary_filepath = dsym_bundle.
GetPath();
700 binary_filepath +=
"/Contents/Resources/DWARF/";
701 binary_filepath += filename;
703 FileSpec binary_fspec(binary_filepath);
704 if (FileSystem::Instance().Exists(binary_fspec))
705 results.push_back(binary_fspec);
709void PlatformDarwinKernel::UpdateKextandKernelsLocalScan() {
710 std::call_once(m_kext_scan_flag, [
this]() {
711 CollectKextAndKernelDirectories();
712 SearchForKextsAndKernelsRecursively();
716Status PlatformDarwinKernel::GetSharedModule(
726 std::string kext_bundle_id = platform_file.
GetPath();
731 if (kext_bundle_id ==
"mach_kernel" || kext_bundle_id.empty()) {
732 error = GetSharedModuleKernel(module_spec, process, module_sp,
733 module_search_paths_ptr, old_modules,
735 if (
error.Success() && module_sp) {
739 return GetSharedModuleKext(module_spec, process, module_sp,
740 module_search_paths_ptr, old_modules,
747 return PlatformDarwin::GetSharedModule(module_spec, process, module_sp,
748 module_search_paths_ptr, old_modules,
752Status PlatformDarwinKernel::GetSharedModuleKext(
764 if (m_name_to_kext_path_map_with_dsyms.count(kext_bundle) > 0) {
765 for (BundleIDToKextIterator it = m_name_to_kext_path_map_with_dsyms.begin();
766 it != m_name_to_kext_path_map_with_dsyms.end(); ++it) {
767 if (it->first == kext_bundle) {
768 error = ExamineKextForMatchingUUID(it->second, module_spec.
GetUUID(),
771 if (module_sp.get()) {
780 error = PlatformDarwin::GetSharedModule(module_spec, process, module_sp,
781 module_search_paths_ptr, old_modules,
783 if (
error.Success() && module_sp.get()) {
790Status PlatformDarwinKernel::GetSharedModuleKernel(
794 assert(module_sp.get() ==
nullptr);
795 UpdateKextandKernelsLocalScan();
797 *did_create_ptr =
false;
800 for (
auto possible_kernel : m_kernel_binaries_with_dsyms) {
801 if (FileSystem::Instance().Exists(possible_kernel)) {
803 kern_spec.GetUUID() = module_spec.
GetUUID();
804 module_sp.reset(
new Module(kern_spec));
805 if (module_sp && module_sp->GetObjectFile() &&
806 module_sp->MatchesModuleSpec(kern_spec)) {
814 PluginManager::LocateExecutableSymbolFile(kern_spec, search_paths);
815 if (FileSystem::Instance().Exists(dsym_fspec))
816 module_sp->SetSymbolFileFileSpec(dsym_fspec);
818 *did_create_ptr =
true;
826 for (
auto possible_kernel_dsym : m_kernel_dsyms_no_binaries) {
827 std::vector<FileSpec> objfile_names =
828 GetDWARFBinaryInDSYMBundle(possible_kernel_dsym);
829 for (
FileSpec objfile : objfile_names) {
831 kern_spec.GetUUID() = module_spec.
GetUUID();
832 kern_spec.GetSymbolFileSpec() = possible_kernel_dsym;
834 module_sp.reset(
new Module(kern_spec));
835 if (module_sp && module_sp->GetObjectFile() &&
836 module_sp->MatchesModuleSpec(kern_spec)) {
838 *did_create_ptr =
true;
846 return PlatformDarwin::GetSharedModule(module_spec, process, module_sp,
847 module_search_paths_ptr, old_modules,
851std::vector<lldb_private::FileSpec>
852PlatformDarwinKernel::SearchForExecutablesRecursively(
const std::string &dir) {
853 std::vector<FileSpec> executables;
855 for (llvm::sys::fs::recursive_directory_iterator it(dir.c_str(), EC),
857 it != end && !EC; it.increment(EC)) {
858 auto status = it->status();
861 if (llvm::sys::fs::is_regular_file(*status) &&
862 llvm::sys::fs::can_execute(it->path()))
863 executables.emplace_back(it->path());
868Status PlatformDarwinKernel::ExamineKextForMatchingUUID(
871 for (
const auto &exe_file :
872 SearchForExecutablesRecursively(kext_bundle_path.
GetPath())) {
873 if (FileSystem::Instance().Exists(exe_file)) {
875 exe_spec.GetUUID() = uuid;
877 exe_spec.GetArchitecture() = arch;
885 if (module_sp && module_sp->GetObjectFile() &&
886 module_sp->MatchesModuleSpec(exe_spec)) {
887 Status error = ModuleList::GetSharedModule(exe_spec, exe_module_sp,
889 if (exe_module_sp && exe_module_sp->GetObjectFile()) {
893 exe_module_sp.reset();
904 if (!process->
ReadMemory(input_addr, header_data->GetBytes(),
905 header_data->GetByteSize(),
error) ||
910 ObjectContainerMachOFileset::CreateMemoryInstance(
911 module_sp, header_data, process->shared_from_this(), input_addr));
918 fileset_container->
FindEntry(
"com.apple.kernel");
924bool PlatformDarwinKernel::LoadPlatformBinaryAndSetup(
Process *process,
928 GetLog(LLDBLog::Platform | LLDBLog::DynamicLoader | LLDBLog::Process);
933 addr_t actual_address = find_kernel_in_macho_fileset(process, input_addr);
939 "PlatformDarwinKernel::%s check address 0x%" PRIx64
" for "
940 "a macho fileset, got back kernel address 0x%" PRIx64,
941 __FUNCTION__, input_addr, actual_address);
949 PlatformDarwinKernel::GetPluginNameStatic());
954 std::make_unique<DynamicLoaderDarwinKernel>(process, actual_address);
964std::vector<ArchSpec> PlatformDarwinKernel::GetSupportedArchitectures(
965 const ArchSpec &process_host_arch) {
966 std::vector<ArchSpec> result;
967 ARMGetSupportedArchitectures(result);
968 x86GetSupportedArchitectures(result);
972void PlatformDarwinKernel::CalculateTrapHandlerSymbolNames() {
973 m_trap_handlers.push_back(
ConstString(
"trap_from_kernel"));
974 m_trap_handlers.push_back(
ConstString(
"hndl_machine_check"));
975 m_trap_handlers.push_back(
ConstString(
"hndl_double_fault"));
976 m_trap_handlers.push_back(
ConstString(
"hndl_allintrs"));
977 m_trap_handlers.push_back(
ConstString(
"hndl_alltraps"));
978 m_trap_handlers.push_back(
ConstString(
"interrupt"));
979 m_trap_handlers.push_back(
ConstString(
"fleh_prefabt"));
980 m_trap_handlers.push_back(
ConstString(
"ExceptionVectorsBase"));
981 m_trap_handlers.push_back(
ConstString(
"ExceptionVectorsTable"));
982 m_trap_handlers.push_back(
ConstString(
"fleh_undef"));
983 m_trap_handlers.push_back(
ConstString(
"fleh_dataabt"));
984 m_trap_handlers.push_back(
ConstString(
"fleh_irq"));
985 m_trap_handlers.push_back(
ConstString(
"fleh_decirq"));
986 m_trap_handlers.push_back(
ConstString(
"fleh_fiq_generic"));
987 m_trap_handlers.push_back(
ConstString(
"fleh_dec"));
static llvm::raw_ostream & error(Stream &strm)
static DynamicLoaderDarwinKernelProperties & GetGlobalProperties()
#define LLDB_LOGF(log,...)
#define LLDB_LOGV(log,...)
An architecture specification class.
bool IsValid() const
Tests if this ArchSpec is valid.
llvm::Triple & GetTriple()
Architecture triple accessor.
llvm::Triple::ArchType GetMachine() const
Returns a machine family for the current architecture.
bool TripleVendorWasSpecified() const
bool TripleOSWasSpecified() const
const char * GetArchitectureName() const
Returns a static string representing the current architecture.
A uniqued constant string class.
const char * AsCString(const char *value_if_empty=nullptr) const
Get the string value as a C string.
const char * GetCString() const
Get the string value as a C string.
A subclass of DataBuffer that stores a data buffer on the heap.
A class to manage flag bits.
PlatformList & GetPlatformList()
void SetFile(llvm::StringRef path, Style style)
Change the file specified with a new path.
const ConstString & GetFilename() const
Filename string const get accessor.
const ConstString & GetDirectory() const
Directory string const get accessor.
ConstString GetFileNameStrippingExtension() const
Return the filename without the extension part.
size_t GetPath(char *path, size_t max_path_length, bool denormalize=true) const
Extract the full path to the file.
llvm::StringRef GetFileNameExtension() const
Extract the extension of the file.
void SetFilename(ConstString filename)
Filename string set accessor.
ArchSpec & GetArchitecture()
A class that describes an executable image and its associated object and symbol files.
Entry * FindEntry(llvm::StringRef id)
A plug-in interface definition class for debugging a process.
virtual size_t ReadMemory(lldb::addr_t vm_addr, void *buf, size_t size, Status &error)
Read of memory from a process.
void SetDynamicLoader(lldb::DynamicLoaderUP dyld)
Target & GetTarget()
Get the target object pointer for this module.
A stream class that can stream formatted output to a file.
size_t Printf(const char *format,...) __attribute__((format(printf
Output printf formatted output to the stream.
FileSpecList GetDebugFileSearchPaths()
void SetPlatform(const lldb::PlatformSP &platform_sp)
#define LLDB_INVALID_ADDRESS
A class that represents a running process on the host machine.
Log * GetLog(Cat mask)
Retrieve the Log object for the channel associated with the given log enum.
std::shared_ptr< lldb_private::ObjectContainer > ObjectContainerSP
std::shared_ptr< lldb_private::Platform > PlatformSP
std::unique_ptr< lldb_private::DynamicLoader > DynamicLoaderUP
std::shared_ptr< lldb_private::WritableDataBuffer > WritableDataBufferSP
std::shared_ptr< lldb_private::Module > ModuleSP