diff options
author | Jason Molenda <jmolenda@apple.com> | 2013-02-27 03:07:49 +0000 |
---|---|---|
committer | Jason Molenda <jmolenda@apple.com> | 2013-02-27 03:07:49 +0000 |
commit | 38e70d11c305c8b6bcb019c5da38a39774b91669 (patch) | |
tree | 49033654447fcc674091bb4586909c1522d1ac43 /lldb/source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.cpp | |
parent | 4a5da44b34afe0c0f43d5b3af78888b175583aa9 (diff) | |
download | bcm5719-llvm-38e70d11c305c8b6bcb019c5da38a39774b91669.tar.gz bcm5719-llvm-38e70d11c305c8b6bcb019c5da38a39774b91669.zip |
When starting a kernel debug session, if the user specified an executable
binary to lldb already check that the UUID of that binary and the UUID of
the kernel binary in memory match. Warn if they don't.
<rdar://problem/13184784>
llvm-svn: 176160
Diffstat (limited to 'lldb/source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.cpp')
-rw-r--r-- | lldb/source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.cpp | 28 |
1 files changed, 24 insertions, 4 deletions
diff --git a/lldb/source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.cpp b/lldb/source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.cpp index d2fa3cc3360..9f7b1347412 100644 --- a/lldb/source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.cpp +++ b/lldb/source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.cpp @@ -668,9 +668,9 @@ DynamicLoaderDarwinKernel::KextImageInfo::ReadMemoryModule (Process *process) } } - // If the kernel specified what UUID we should find at this load address, - // require that the memory module have a matching UUID or something has gone - // wrong and we should discard it. + // If this is a kext, and the kernel specified what UUID we should find at this + // load address, require that the memory module have a matching UUID or something + // has gone wrong and we should discard it. if (m_uuid.IsValid()) { if (m_uuid != memory_module_sp->GetUUID()) @@ -689,10 +689,30 @@ DynamicLoaderDarwinKernel::KextImageInfo::ReadMemoryModule (Process *process) m_kernel_image = is_kernel; if (is_kernel) { - if (memory_module_sp->GetArchitecture().IsValid()) + if (memory_module_sp->GetArchitecture().IsValid()) { process->GetTarget().SetArchitecture(memory_module_sp->GetArchitecture()); } + if (m_uuid.IsValid()) + { + Module* exe_module = process->GetTarget().GetExecutableModulePointer(); + if (exe_module && exe_module->GetUUID().IsValid()) + { + if (m_uuid != exe_module->GetUUID()) + { + Stream *s = &process->GetTarget().GetDebugger().GetOutputStream(); + if (s) + { + char memory_module_uuidbuf[64]; + char exe_module_uuidbuf[64]; + s->Printf ("warning: Host-side kernel file has Mach-O UUID of %s but remote kernel has a UUID of %s -- a mismatched kernel file will result in a poor debugger experience.\n", + exe_module->GetUUID().GetAsCString(exe_module_uuidbuf, sizeof (exe_module_uuidbuf)), + m_uuid.GetAsCString(memory_module_uuidbuf, sizeof (memory_module_uuidbuf))); + s->Flush (); + } + } + } + } } return true; |