[Lldb-commits] [lldb] r284900 - Add some additional logging to

Jason Molenda via lldb-commits lldb-commits at lists.llvm.org
Fri Oct 21 16:45:08 PDT 2016


Author: jmolenda
Date: Fri Oct 21 18:45:07 2016
New Revision: 284900

URL: http://llvm.org/viewvc/llvm-project?rev=284900&view=rev
Log:
Add some additional logging to 
DynamicLoaderDarwinKernel::CheckForKernelImageAtAddress to debug
corefiles that may not be correctly formed.

<rdar://problem/28884846> 

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

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=284900&r1=284899&r2=284900&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.cpp (original)
+++ lldb/trunk/source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.cpp Fri Oct 21 18:45:07 2016
@@ -415,8 +415,14 @@ DynamicLoaderDarwinKernel::CheckForKerne
       return UUID();
 
     ObjectFile *exe_objfile = memory_module_sp->GetObjectFile();
-    if (exe_objfile == NULL)
+    if (exe_objfile == NULL) {
+      if (log)
+        log->Printf("DynamicLoaderDarwinKernel::CheckForKernelImageAtAddress "
+                    "found a binary at 0x%" PRIx64
+                    " but could not create an object file from memory",
+                    addr);
       return UUID();
+    }
 
     if (exe_objfile->GetType() == ObjectFile::eTypeExecutable &&
         exe_objfile->GetStrata() == ObjectFile::eStrataKernel) {
@@ -425,10 +431,19 @@ DynamicLoaderDarwinKernel::CheckForKerne
               kernel_arch)) {
         process->GetTarget().SetArchitecture(kernel_arch);
       }
-      if (log)
-        log->Printf("DynamicLoaderDarwinKernel::CheckForKernelImageAtAddress: "
-                    "kernel binary image found at 0x%" PRIx64,
-                    addr);
+      if (log) {
+        std::string uuid_str;
+        if (memory_module_sp->GetUUID().IsValid()) {
+          uuid_str = "with UUID ";
+          uuid_str += memory_module_sp->GetUUID().GetAsString();
+        } else {
+          uuid_str = "and no LC_UUID found in load commands ";
+        }
+        log->Printf(
+            "DynamicLoaderDarwinKernel::CheckForKernelImageAtAddress: "
+            "kernel binary image found at 0x%" PRIx64 " with arch '%s' %s",
+            addr, kernel_arch.GetTriple().str().c_str(), uuid_str.c_str());
+      }
       return memory_module_sp->GetUUID();
     }
   }




More information about the lldb-commits mailing list