[Lldb-commits] [lldb] r165061 - in /lldb/trunk/source: Host/macosx/Symbols.cpp Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.cpp

Jason Molenda jmolenda at apple.com
Tue Oct 2 15:23:42 PDT 2012


Author: jmolenda
Date: Tue Oct  2 17:23:42 2012
New Revision: 165061

URL: http://llvm.org/viewvc/llvm-project?rev=165061&view=rev
Log:
Change DynamicLoaderDarwinKernel::OSKextLoadedKextSummary to use
the Symbols::LocateExecutableObjectFile method to locate kexts and
kernels instead of copying them out of the memory of the remote
system.  This is the fix for <rdar://problem/12416384>.

Fix a variable shadowing problem in
Symbols::LocateMacOSXFilesUsingDebugSymbols which caused the symbol
rich executable binaries to not be found even if they were listed
in the dSYM Info.plist.

Change Symbols::DownloadObjectAndSymbolFile to ignore dsymForUUID's
negative cache - this is typically being called by the user and we
should try even if there's a incorrect entry in the negative cache.


Modified:
    lldb/trunk/source/Host/macosx/Symbols.cpp
    lldb/trunk/source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.cpp

Modified: lldb/trunk/source/Host/macosx/Symbols.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/macosx/Symbols.cpp?rev=165061&r1=165060&r2=165061&view=diff
==============================================================================
--- lldb/trunk/source/Host/macosx/Symbols.cpp (original)
+++ lldb/trunk/source/Host/macosx/Symbols.cpp Tue Oct  2 17:23:42 2012
@@ -378,7 +378,7 @@
                         char uuid_cstr_buf[64];
                         const char *uuid_cstr = uuid->GetAsCString (uuid_cstr_buf, sizeof(uuid_cstr_buf));
                         CFCString uuid_cfstr (uuid_cstr);
-                        CFDictionaryRef uuid_dict = static_cast<CFDictionaryRef>(::CFDictionaryGetValue (dict.get(), uuid_cfstr.get()));
+                        uuid_dict = static_cast<CFDictionaryRef>(::CFDictionaryGetValue (dict.get(), uuid_cfstr.get()));
                         if (uuid_dict)
                         {
 
@@ -693,9 +693,9 @@
             
             StreamString command;
             if (uuid_cstr)
-                command.Printf("%s --copyExecutable %s", g_dsym_for_uuid_exe_path, uuid_cstr);
+                command.Printf("%s --ignoreNegativeCache --copyExecutable %s", g_dsym_for_uuid_exe_path, uuid_cstr);
             else if (file_path && file_path[0])
-                command.Printf("%s --copyExecutable %s", g_dsym_for_uuid_exe_path, file_path);
+                command.Printf("%s --ignoreNegativeCache --copyExecutable %s", g_dsym_for_uuid_exe_path, file_path);
             
             if (!command.GetString().empty())
             {

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=165061&r1=165060&r2=165061&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.cpp (original)
+++ lldb/trunk/source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.cpp Tue Oct  2 17:23:42 2012
@@ -289,16 +289,15 @@
                 module_sp.reset(); // UUID mismatch
         }
         
-        // If this is the kernel, see if we can locate a copy of the binary based on the UUID (and maybe even debug info)
-        // FIXME: Symbols::DownloadObjectAndSymbolFile is forcing the download of the binaries via dsymForUUID regardless
-        // of the current pref settings; don't want to do this for all the kexts unless the user has enabled it..
-        if (!module_sp && memory_module_is_kernel)
+        // Try to locate the kext/kernel binary on the local filesystem, maybe with additional 
+        // debug info/symbols still present, before we resort to copying it out of memory.
+        if (!module_sp)
         {
             ModuleSpec sym_spec;
             sym_spec.GetUUID() = memory_module_sp->GetUUID();
-            if (Symbols::DownloadObjectAndSymbolFile (sym_spec) 
-                && sym_spec.GetArchitecture().IsValid() 
-                && sym_spec.GetSymbolFileSpec().Exists())
+            if (Symbols::LocateExecutableObjectFile (sym_spec) 
+                && sym_spec.GetArchitecture().IsValid()
+                && sym_spec.GetFileSpec().Exists())
             {
                 module_sp = target.GetSharedModule (sym_spec);
                 if (module_sp.get ())
@@ -354,9 +353,16 @@
             char uuidbuf[64];
             s->Printf ("Kernel UUID: %s\n", module_sp->GetUUID().GetAsCString(uuidbuf, sizeof (uuidbuf)));
             s->Printf ("Load Address: 0x%llx\n", address);
-            s->Printf ("Loaded kernel file %s/%s\n",
-                          module_sp->GetFileSpec().GetDirectory().AsCString(),
-                          module_sp->GetFileSpec().GetFilename().AsCString());
+            if (module_sp->GetFileSpec().GetDirectory().IsEmpty())
+            {
+                s->Printf ("Loaded kernel file %s\n", module_sp->GetFileSpec().GetFilename().AsCString());
+            }
+            else
+            {
+                s->Printf ("Loaded kernel file %s/%s\n",
+                              module_sp->GetFileSpec().GetDirectory().AsCString(),
+                              module_sp->GetFileSpec().GetFilename().AsCString());
+            }
             s->Flush ();
         }
     }





More information about the lldb-commits mailing list