[Lldb-commits] [lldb] r214391 - Add a new directory path to

Jason Molenda jmolenda at apple.com
Wed Jul 30 23:36:25 PDT 2014


Author: jmolenda
Date: Thu Jul 31 01:36:24 2014
New Revision: 214391

URL: http://llvm.org/viewvc/llvm-project?rev=214391&view=rev
Log:
Add a new directory path to 
PlatformDarwinKernel::GetGenericSDKDirectoriesToSearch
 - /Library/Developer/KDKs where users may store 
the kernel debug kits on their systems.

Change PlatformDarwinKernel::GetKextDirectoriesInSDK
to look in the root directory of places like
/Library/Developer/KDKs/KDK_10.10_14A298i.kdk
as well as the System/Library/Extensions subdir
in that directory (if it exists) and the
Library/Extensions subdir in that directory (if it
exists).
<rdar://problem/16568635> 

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=214391&r1=214390&r2=214391&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Platform/MacOSX/PlatformDarwinKernel.cpp (original)
+++ lldb/trunk/source/Plugins/Platform/MacOSX/PlatformDarwinKernel.cpp Thu Jul 31 01:36:24 2014
@@ -370,6 +370,16 @@ PlatformDarwinKernel::GetGenericSDKDirec
     {
         directories.push_back (generic_sdk);
     }
+
+    // The KDKs distributed from Apple installed on external
+    // developer systems may be in directories like
+    // /Library/Developer/KDKs/KDK_10.10_14A298i.kdk
+    FileSpec installed_kdks("/Library/Developer/KDKs", true);
+    if (installed_kdks.Exists() && installed_kdks.IsDirectory())
+    {
+        directories.push_back (installed_kdks);
+    }
+
 }
 
 void
@@ -487,12 +497,32 @@ PlatformDarwinKernel::GetKextDirectories
             || file_spec.GetFileNameExtension() == ConstString("kdk")))
     {
         std::string kext_directory_path = file_spec.GetPath();
-        kext_directory_path.append ("/System/Library/Extensions");
-        FileSpec kext_directory (kext_directory_path.c_str(), true);
-        if (kext_directory.Exists() && kext_directory.IsDirectory())
+
+        // Append the raw directory path, e.g. /Library/Developer/KDKs/KDK_10.10_14A298i.kdk
+        // to the directory search list -- there may be kexts sitting directly
+        // in that directory instead of being in a System/Library/Extensions subdir.
+        ((std::vector<lldb_private::FileSpec> *)baton)->push_back(file_spec);
+
+        // Check to see if there is a System/Library/Extensions subdir & add it if it exists
+
+        std::string sle_kext_directory_path (kext_directory_path);
+        sle_kext_directory_path.append ("/System/Library/Extensions");
+        FileSpec sle_kext_directory (sle_kext_directory_path.c_str(), true);
+        if (sle_kext_directory.Exists() && sle_kext_directory.IsDirectory())
         {
-            ((std::vector<lldb_private::FileSpec> *)baton)->push_back(kext_directory);
+            ((std::vector<lldb_private::FileSpec> *)baton)->push_back(sle_kext_directory);
         }
+
+        // Check to see if there is a Library/Extensions subdir & add it if it exists
+
+        std::string le_kext_directory_path (kext_directory_path);
+        le_kext_directory_path.append ("/Library/Extensions");
+        FileSpec le_kext_directory (le_kext_directory_path.c_str(), true);
+        if (le_kext_directory.Exists() && le_kext_directory.IsDirectory())
+        {
+            ((std::vector<lldb_private::FileSpec> *)baton)->push_back(le_kext_directory);
+        }
+
     }
     return FileSpec::eEnumerateDirectoryResultNext;
 }





More information about the lldb-commits mailing list