Identify a kdp session that is connecting to an EFI monitor,

use a DynamicLoaderStatic dynamic loader for the session
instead of a kernel or user dynamic loader.

llvm-svn: 166652
This commit is contained in:
Jason Molenda 2012-10-25 00:25:13 +00:00
parent ade609770e
commit 840f12cf6b
3 changed files with 23 additions and 3 deletions

View File

@ -525,6 +525,17 @@ CommunicationKDP::GetUUID ()
return uuid; return uuid;
} }
bool
CommunicationKDP::RemoteIsEFI ()
{
if (GetKernelVersion() == NULL)
return false;
if (strncmp (m_kernel_version.c_str(), "EFI", 3) == 0)
return true;
else
return false;
}
lldb::addr_t lldb::addr_t
CommunicationKDP::GetLoadAddress () CommunicationKDP::GetLoadAddress ()
{ {

View File

@ -223,6 +223,9 @@ public:
lldb_private::UUID lldb_private::UUID
GetUUID (); GetUUID ();
bool
RemoteIsEFI ();
lldb::addr_t lldb::addr_t
GetLoadAddress (); GetLoadAddress ();

View File

@ -38,6 +38,7 @@
#include "ProcessKDPLog.h" #include "ProcessKDPLog.h"
#include "ThreadKDP.h" #include "ThreadKDP.h"
#include "Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.h" #include "Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.h"
#include "Plugins/DynamicLoader/Static/DynamicLoaderStatic.h"
#include "Utility/StringExtractor.h" #include "Utility/StringExtractor.h"
using namespace lldb; using namespace lldb;
@ -229,12 +230,17 @@ ProcessKDP::DoConnectRemote (Stream *strm, const char *remote_url)
kernel_arch.SetArchitecture(eArchTypeMachO, cpu, sub); kernel_arch.SetArchitecture(eArchTypeMachO, cpu, sub);
m_target.SetArchitecture(kernel_arch); m_target.SetArchitecture(kernel_arch);
/* Get the kernel's UUID and load address via kdp-kernelversion packet. */ /* Get the kernel's UUID and load address via KDP_KERNELVERSION packet. */
/* An EFI kdp session has neither UUID nor load address. */
UUID kernel_uuid = m_comm.GetUUID (); UUID kernel_uuid = m_comm.GetUUID ();
addr_t kernel_load_addr = m_comm.GetLoadAddress (); addr_t kernel_load_addr = m_comm.GetLoadAddress ();
if (kernel_load_addr != LLDB_INVALID_ADDRESS) if (m_comm.RemoteIsEFI ())
{
m_dyld_plugin_name = DynamicLoaderStatic::GetPluginNameStatic();
}
else if (kernel_load_addr != LLDB_INVALID_ADDRESS)
{ {
m_kernel_load_addr = kernel_load_addr; m_kernel_load_addr = kernel_load_addr;
m_dyld_plugin_name = DynamicLoaderDarwinKernel::GetPluginNameStatic(); m_dyld_plugin_name = DynamicLoaderDarwinKernel::GetPluginNameStatic();