diff options
author | Jason Molenda <jmolenda@apple.com> | 2013-04-05 01:03:25 +0000 |
---|---|---|
committer | Jason Molenda <jmolenda@apple.com> | 2013-04-05 01:03:25 +0000 |
commit | 1c627543f18df53ccab437a372c362aadadc2779 (patch) | |
tree | e41149c0d23d8ff603d8f476637a7e7e9c7ede83 /lldb/source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.cpp | |
parent | ece622ab4682fc484bbc652d15a96ab50fd348aa (diff) | |
download | bcm5719-llvm-1c627543f18df53ccab437a372c362aadadc2779.tar.gz bcm5719-llvm-1c627543f18df53ccab437a372c362aadadc2779.zip |
Add a new PlatformDarwinKernel for kernel debugging. This Platform
plugin will index the kext bundles on the local filesystem when
created. During a kernel debug session, when the DynamicLoader
plugin needs to locate a kext by name like
"com.apple.com.apple.filesystems.autofs", the Platform can quickly
look for a UUID match in those kernel debug kit directories it
previously indexed.
I'm still working on profiling the performance impact of the inital
kext bundle scan; there will likely need to be a switch to enable
or disable this plugin's scan.
This only affects Mac kernel debugging and the code is only built
on Apple systems because of some use of low-level CoreFoundation
to parse plists.
<rdar://problem/13503583>
llvm-svn: 178827
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 |