In DynamicLoaderDarwinKernel::OSKextLoadedKextSummary::LoadImageUsingMemoryModule(),
if we have a kernel binary, set the target's architecture to match.

Include the target's architecture in the ModuleSpec when we're searching for the 
kext binaries on the local system -- otherwise we won't get a specific slice of
a fat file picked out for us and we won't use the returned Module correctly.

Remove the redundant attempt to find a file on the local filesystem from this method.


In ProcessGDBRemote::CheckForKernel(), if we have a kernel binary in memory, mark
the canJIT as false.  There is no jitting code in kernel debug sessions.



git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@165357 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp b/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
index 494785e..1cc1009 100644
--- a/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
+++ b/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
@@ -511,6 +511,7 @@
         {
             m_kernel_load_addr = exe_objfile->GetHeaderAddress().GetFileAddress();
             m_dyld_plugin_name = DynamicLoaderDarwinKernel::GetPluginNameStatic();
+            SetCanJIT(false);
             return;
         }
     }
@@ -569,6 +570,7 @@
     {
         m_kernel_load_addr = kernel_addr;
         m_dyld_plugin_name = DynamicLoaderDarwinKernel::GetPluginNameStatic();
+        SetCanJIT(false);
         return;
     }
 }
@@ -1981,6 +1983,9 @@
     return m_gdb_comm.IsConnected() && m_private_state.GetValue() != eStateExited;
 }
 
+// For kernel debugging, we return the load address of the kernel binary as the
+// ImageInfoAddress and we return the DynamicLoaderDarwinKernel as the GetDynamicLoader()
+// name so the correct DynamicLoader plugin is chosen.
 addr_t
 ProcessGDBRemote::GetImageInfoAddress()
 {