diff options
Diffstat (limited to 'lldb/source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.cpp')
-rw-r--r-- | lldb/source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.cpp | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/lldb/source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.cpp b/lldb/source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.cpp index 0552d7fbf31..cef06b52694 100644 --- a/lldb/source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.cpp +++ b/lldb/source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.cpp @@ -457,6 +457,15 @@ DynamicLoaderDarwinKernel::DynamicLoaderDarwinKernel (Process* process, lldb::ad m_mutex(Mutex::eMutexTypeRecursive), m_break_id (LLDB_INVALID_BREAK_ID) { + PlatformSP platform_sp(Platform::FindPlugin (process, "darwin-kernel")); + // Only select the darwin-kernel Platform if we've been asked to load kexts. + // It can take some time to scan over all of the kext info.plists and that + // shouldn't be done if kext loading is explicitly disabled. + if (platform_sp.get() && GetGlobalProperties()->GetLoadKexts()) + { + process->GetTarget().SetPlatform (platform_sp); + process->GetTarget().GetDebugger().GetPlatformList().SetSelectedPlatform (platform_sp); + } } //---------------------------------------------------------------------- @@ -797,6 +806,22 @@ DynamicLoaderDarwinKernel::KextImageInfo::LoadImageUsingMemoryModule (Process *p } } + // If the current platform is PlatformDarwinKernel, create a ModuleSpec with the filename set + // to be the bundle ID for this kext, e.g. "com.apple.filesystems.msdosfs", and ask the platform + // to find it. + PlatformSP platform_sp (target.GetPlatform()); + if (platform_sp) + { + const char *pname = platform_sp->GetShortPluginName(); + if (pname && strcmp (pname, "darwin-kernel") == 0) + { + ModuleSpec kext_bundle_module_spec(module_spec); + FileSpec kext_filespec(m_name.c_str(), false); + kext_bundle_module_spec.GetFileSpec() = kext_filespec; + platform_sp->GetSharedModule (kext_bundle_module_spec, m_module_sp, &target.GetExecutableSearchPaths(), NULL, NULL); + } + } + // Ask the Target to find this file on the local system, if possible. // This will search in the list of currently-loaded files, look in the // standard search paths on the system, and on a Mac it will try calling |