From a1bce2ef1a2007c608d4a6948dd9aa991fd155df Mon Sep 17 00:00:00 2001 From: Greg Clayton Date: Wed, 16 Jul 2014 21:16:27 +0000 Subject: [PATCH] Modify the EFI KDP debugging to not use any dynamic loader since it does manual dynamic loading itself via python modules. Also track down the required binary by trying to locate the main executable module through LLDB's symbol and executable file locating code. llvm-svn: 213199 --- .../Plugins/Process/MacOSX-Kernel/ProcessKDP.cpp | 36 +++++++++++++++++++++- 1 file changed, 35 insertions(+), 1 deletion(-) diff --git a/lldb/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.cpp b/lldb/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.cpp index c2ae2b9..8ed106a 100644 --- a/lldb/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.cpp +++ b/lldb/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.cpp @@ -297,7 +297,41 @@ ProcessKDP::DoConnectRemote (Stream *strm, const char *remote_url) if (m_comm.RemoteIsEFI ()) { - m_dyld_plugin_name = DynamicLoaderStatic::GetPluginNameStatic(); + // Select an invalid plugin name for the dynamic loader so one doesn't get used + // since EFI does its own manual loading via python scripting + static ConstString g_none_dynamic_loader("none"); + m_dyld_plugin_name = g_none_dynamic_loader; + + if (kernel_uuid.IsValid()) { + // If EFI passed in a UUID= try to lookup UUID + // The slide will not be provided. But the UUID + // lookup will be used to launch EFI debug scripts + // from the dSYM, that can load all of the symbols. + ModuleSpec module_spec; + module_spec.GetUUID() = kernel_uuid; + module_spec.GetArchitecture() = m_target.GetArchitecture(); + + // Lookup UUID locally, before attempting dsymForUUID like action + module_spec.GetSymbolFileSpec() = Symbols::LocateExecutableSymbolFile(module_spec); + if (module_spec.GetSymbolFileSpec()) + module_spec.GetFileSpec() = Symbols::LocateExecutableObjectFile (module_spec); + if (!module_spec.GetSymbolFileSpec() || !module_spec.GetSymbolFileSpec()) + Symbols::DownloadObjectAndSymbolFile (module_spec, true); + + if (module_spec.GetFileSpec().Exists()) + { + ModuleSP module_sp(new Module (module_spec.GetFileSpec(), m_target.GetArchitecture())); + if (module_sp.get() && module_sp->MatchesModuleSpec (module_spec)) + { + // Get the current target executable + ModuleSP exe_module_sp (m_target.GetExecutableModule ()); + + // Make sure you don't already have the right module loaded and they will be uniqued + if (exe_module_sp.get() != module_sp.get()) + m_target.SetExecutableModule (module_sp, false); + } + } + } } else if (m_comm.RemoteIsDarwinKernel ()) { -- 2.7.4