[Lldb-commits] [lldb] r213199 - Modify the EFI KDP debugging to not use any dynamic loader since it does manual dynamic loading itself via python modules.

Greg Clayton gclayton at apple.com
Wed Jul 16 14:16:27 PDT 2014


Author: gclayton
Date: Wed Jul 16 16:16:27 2014
New Revision: 213199

URL: http://llvm.org/viewvc/llvm-project?rev=213199&view=rev
Log:
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.

<rdar://problem/16570258>

Modified:
    lldb/trunk/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.cpp

Modified: lldb/trunk/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.cpp?rev=213199&r1=213198&r2=213199&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.cpp (original)
+++ lldb/trunk/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.cpp Wed Jul 16 16:16:27 2014
@@ -297,7 +297,41 @@ ProcessKDP::DoConnectRemote (Stream *str
 
                     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 ())
                     {





More information about the lldb-commits mailing list