Author: jmolenda
Date: Tue Mar 10 18:34:52 2015
New Revision: 231885

URL: http://llvm.org/viewvc/llvm-project?rev=231885&view=rev
Log:
If the user specifies a kernel binary that isn't correct for the current
kernel debug session, instead of issuing a warning (which on one ever
sees), drop the user-specified kernel binary Module from the target and
try to discover the correct one dynamically.
<rdar://problem/19450329> 

Modified:
    
lldb/trunk/source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.cpp

Modified: 
lldb/trunk/source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.cpp?rev=231885&r1=231884&r2=231885&view=diff
==============================================================================
--- 
lldb/trunk/source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.cpp
 (original)
+++ 
lldb/trunk/source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.cpp
 Tue Mar 10 18:34:52 2015
@@ -724,19 +724,20 @@ DynamicLoaderDarwinKernel::KextImageInfo
         }
         if (m_uuid.IsValid())
         {
-            Module* exe_module = 
process->GetTarget().GetExecutableModulePointer();
-            if (exe_module && exe_module->GetUUID().IsValid())
+            ModuleSP exe_module_sp = 
process->GetTarget().GetExecutableModule();
+            if (exe_module_sp.get() && exe_module_sp->GetUUID().IsValid())
             {
-                if (m_uuid != exe_module->GetUUID())
+                if (m_uuid != exe_module_sp->GetUUID())
                 {
-                    Stream *s = 
process->GetTarget().GetDebugger().GetOutputFile().get();
-                    if (s)
-                    {
-                        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().GetAsString().c_str(),
-                                   m_uuid.GetAsString().c_str());
-                        s->Flush ();
-                    }
+                    // The user specified a kernel binary that has a different 
UUID than
+                    // the kernel actually running in memory.  This never ends 
well; 
+                    // clear the user specified kernel binary from the Target.
+
+                    m_module_sp.reset();
+
+                    ModuleList user_specified_kernel_list;
+                    user_specified_kernel_list.Append (exe_module_sp);
+                    process->GetTarget().GetImages().Remove 
(user_specified_kernel_list);
                 }
             }
         }


_______________________________________________
lldb-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits

Reply via email to