[Lldb-commits] [lldb] r300810 - Add extra logging for when lldb is looking for kernels and kexts.

Jason Molenda via lldb-commits lldb-commits at lists.llvm.org
Wed Apr 19 19:02:25 PDT 2017


Author: jmolenda
Date: Wed Apr 19 21:02:25 2017
New Revision: 300810

URL: http://llvm.org/viewvc/llvm-project?rev=300810&view=rev
Log:
Add extra logging for when lldb is looking for kernels and kexts.
<rdar://problem/26863256> 

Modified:
    lldb/trunk/source/Plugins/Platform/MacOSX/PlatformDarwinKernel.cpp

Modified: lldb/trunk/source/Plugins/Platform/MacOSX/PlatformDarwinKernel.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Platform/MacOSX/PlatformDarwinKernel.cpp?rev=300810&r1=300809&r2=300810&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Platform/MacOSX/PlatformDarwinKernel.cpp (original)
+++ lldb/trunk/source/Plugins/Platform/MacOSX/PlatformDarwinKernel.cpp Wed Apr 19 21:02:25 2017
@@ -508,9 +508,10 @@ PlatformDarwinKernel::GetKernelsAndKexts
   ConstString file_spec_extension = file_spec.GetFileNameExtension();
 
   Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_PLATFORM));
-  if (log)
-    log->Printf("PlatformDarwinKernel examining %s",
-                file_spec.GetPath().c_str());
+  Log *log_verbose(GetLogIfAllCategoriesSet(LIBLLDB_LOG_PLATFORM | LLDB_LOG_OPTION_VERBOSE));
+
+  if (log_verbose)
+      log_verbose->Printf ("PlatformDarwinKernel examining '%s'", file_spec.GetPath().c_str());
 
   PlatformDarwinKernel *thisp = (PlatformDarwinKernel *)baton;
   if (ft == llvm::sys::fs::file_type::regular_file ||
@@ -520,9 +521,21 @@ PlatformDarwinKernel::GetKernelsAndKexts
          strncmp(filename.GetCString(), "mach", 4) == 0) &&
         file_spec_extension != g_dsym_suffix) {
       if (KernelHasdSYMSibling(file_spec))
+      {
+        if (log)
+        {
+            log->Printf ("PlatformDarwinKernel registering kernel binary '%s' with dSYM sibling", file_spec.GetPath().c_str());
+        }
         thisp->m_kernel_binaries_with_dsyms.push_back(file_spec);
+      }
       else
+      {
+        if (log)
+        {
+            log->Printf ("PlatformDarwinKernel registering kernel binary '%s', no dSYM", file_spec.GetPath().c_str());
+        }
         thisp->m_kernel_binaries_without_dsyms.push_back(file_spec);
+      }
       return FileSpec::eEnumerateDirectoryResultNext;
     }
   } else if (ft == llvm::sys::fs::file_type::directory_file &&
@@ -556,6 +569,8 @@ PlatformDarwinKernel::GetKernelsAndKexts
   if (recurse && file_spec_extension != g_dsym_suffix &&
       file_spec_extension != g_kext_suffix &&
       file_spec_extension != g_bundle_suffix) {
+    if (log_verbose)
+        log_verbose->Printf ("PlatformDarwinKernel descending into directory '%s'", file_spec.GetPath().c_str());
     return FileSpec::eEnumerateDirectoryResultEnter;
   } else {
     return FileSpec::eEnumerateDirectoryResultNext;
@@ -564,6 +579,7 @@ PlatformDarwinKernel::GetKernelsAndKexts
 
 void PlatformDarwinKernel::AddKextToMap(PlatformDarwinKernel *thisp,
                                         const FileSpec &file_spec) {
+  Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_PLATFORM));
   CFCBundle bundle(file_spec.GetPath().c_str());
   CFStringRef bundle_id(bundle.GetIdentifier());
   if (bundle_id && CFGetTypeID(bundle_id) == CFStringGetTypeID()) {
@@ -572,11 +588,23 @@ void PlatformDarwinKernel::AddKextToMap(
                            kCFStringEncodingUTF8)) {
       ConstString bundle_conststr(bundle_id_buf);
       if (KextHasdSYMSibling(file_spec))
+      {
+        if (log)
+        {
+            log->Printf ("PlatformDarwinKernel registering kext binary '%s' with dSYM sibling", file_spec.GetPath().c_str());
+        }
         thisp->m_name_to_kext_path_map_with_dsyms.insert(
             std::pair<ConstString, FileSpec>(bundle_conststr, file_spec));
+      }
       else
+      {
+        if (log)
+        {
+            log->Printf ("PlatformDarwinKernel registering kext binary '%s', no dSYM", file_spec.GetPath().c_str());
+        }
         thisp->m_name_to_kext_path_map_without_dsyms.insert(
             std::pair<ConstString, FileSpec>(bundle_conststr, file_spec));
+      }
     }
   }
 }




More information about the lldb-commits mailing list