[Lldb-commits] [lldb] r175495 - Change the order that the DarwinKernel DynamicLoader plugin uses

Jason Molenda jmolenda at apple.com
Mon Feb 18 23:16:22 PST 2013


Author: jmolenda
Date: Tue Feb 19 01:16:22 2013
New Revision: 175495

URL: http://llvm.org/viewvc/llvm-project?rev=175495&view=rev
Log:
Change the order that the DarwinKernel DynamicLoader plugin uses
to search for kexts on the local system -- the ModuleList FindModule()
method is the best first attempt, only call
Symbols::DownloadObjectAndSymbolFile() if that has failed and this
is the kernel binary which really needs to have its symbols located.

<rdar://problem/13241893> 


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

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=175495&r1=175494&r2=175495&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.cpp (original)
+++ lldb/trunk/source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.cpp Tue Feb 19 01:16:22 2013
@@ -758,28 +758,26 @@ DynamicLoaderDarwinKernel::KextImageInfo
             module_spec.GetUUID() = m_uuid;
             module_spec.GetArchitecture() = target.GetArchitecture();
 
-            // For the kernel, we really do need an on-disk file copy of the binary.
-            bool force_symbols_search = false;
+            // For the kernel, we really do need an on-disk file copy of the binary to do anything useful.
+            // This will force a clal to 
             if (IsKernel())
             {
-                force_symbols_search = true;
-            }
-
-            if (Symbols::DownloadObjectAndSymbolFile (module_spec, force_symbols_search))
-            {
-                if (module_spec.GetFileSpec().Exists())
+                if (Symbols::DownloadObjectAndSymbolFile (module_spec, true))
                 {
-                    m_module_sp.reset(new Module (module_spec.GetFileSpec(), target.GetArchitecture()));
-                    if (m_module_sp.get() && m_module_sp->MatchesModuleSpec (module_spec))
+                    if (module_spec.GetFileSpec().Exists())
                     {
-                        ModuleList loaded_module_list;
-                        loaded_module_list.Append (m_module_sp);
-                        target.ModulesDidLoad (loaded_module_list);
+                        m_module_sp.reset(new Module (module_spec.GetFileSpec(), target.GetArchitecture()));
+                        if (m_module_sp.get() && m_module_sp->MatchesModuleSpec (module_spec))
+                        {
+                            ModuleList loaded_module_list;
+                            loaded_module_list.Append (m_module_sp);
+                            target.ModulesDidLoad (loaded_module_list);
+                        }
                     }
                 }
             }
-        
-            // Failing that, ask the Target to find this file on the local system, if possible.
+
+            // Ask the Target to find this file on the local system, if possible.
             // This will search in the list of currently-loaded files, look in the 
             // standard search paths on the system, and on a Mac it will try calling
             // the DebugSymbols framework with the UUID to find the binary via its
@@ -789,7 +787,7 @@ DynamicLoaderDarwinKernel::KextImageInfo
                 m_module_sp = target.GetSharedModule (module_spec);
             }
 
-            if (force_symbols_search && !m_module_sp)
+            if (IsKernel() && !m_module_sp)
             {
                 Stream *s = &target.GetDebugger().GetOutputStream();
                 if (s)
@@ -1284,28 +1282,6 @@ DynamicLoaderDarwinKernel::ParseKextSumm
     return true;
 }
 
-// Adds the modules in image_infos to m_known_kexts.  
-
-bool
-DynamicLoaderDarwinKernel::AddModulesUsingImageInfos (KextImageInfo::collection &image_infos)
-{
-    // Now add these images to the main list.
-    ModuleList loaded_module_list;
-    
-    for (uint32_t idx = 0; idx < image_infos.size(); ++idx)
-    {
-        KextImageInfo &image_info = image_infos[idx];
-        m_known_kexts.push_back(image_info);
-        
-        if (image_info.GetModule() && m_process->GetStopID() == image_info.GetProcessStopId())
-            loaded_module_list.AppendIfNeeded (image_infos[idx].GetModule());
-    }
-    
-    m_process->GetTarget().ModulesDidLoad (loaded_module_list);
-    return true;
-}
-
-
 uint32_t
 DynamicLoaderDarwinKernel::ReadKextSummaries (const Address &kext_summary_addr,
                                               uint32_t image_infos_count, 

Modified: lldb/trunk/source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.h?rev=175495&r1=175494&r2=175495&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.h (original)
+++ lldb/trunk/source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.h Tue Feb 19 01:16:22 2013
@@ -333,9 +333,6 @@ protected:
     ParseKextSummaries (const lldb_private::Address &kext_summary_addr,
                         uint32_t count);
 
-    bool
-    AddModulesUsingImageInfos (KextImageInfo::collection &image_infos);
-
     void
     UpdateImageInfosHeaderAndLoadCommands(KextImageInfo::collection &image_infos,
                                           uint32_t infos_count,





More information about the lldb-commits mailing list