Author: jmolenda
Date: Thu Aug 4 19:44:34 2016
New Revision: 277789
URL: http://llvm.org/viewvc/llvm-project?rev=277789&view=rev
Log:
Change the indexing done for kernel/kext directories to be recursive.
Also re-write how most of the directory indexing is done - as it has
grown over the years, it has become a bit of a mess and was overdue
for a cleanup.
Most importantly, this allows you to specify a directory with the
platform.plugin.darwin-kernel.kext-directories setting and now lldb
will search for kexts and kernels in those directories recursively.
Modified:
lldb/trunk/source/Plugins/Platform/MacOSX/PlatformDarwinKernel.cpp
lldb/trunk/source/Plugins/Platform/MacOSX/PlatformDarwinKernel.h
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=277789&r1=277788&r2=277789&view=diff
==
--- lldb/trunk/source/Plugins/Platform/MacOSX/PlatformDarwinKernel.cpp
(original)
+++ lldb/trunk/source/Plugins/Platform/MacOSX/PlatformDarwinKernel.cpp Thu Aug
4 19:44:34 2016
@@ -288,6 +288,7 @@ PlatformDarwinKernel::PlatformDarwinKern
m_name_to_kext_path_map_with_dsyms(),
m_name_to_kext_path_map_without_dsyms(),
m_search_directories(),
+m_search_directories_no_recursing(),
m_kernel_binaries_with_dsyms(),
m_kernel_binaries_without_dsyms(),
m_ios_debug_session(is_ios_debug_session)
@@ -296,8 +297,7 @@ PlatformDarwinKernel::PlatformDarwinKern
if (GetGlobalProperties()->GetSearchForKexts())
{
CollectKextAndKernelDirectories ();
-IndexKextsInDirectories ();
-IndexKernelsInDirectories ();
+SearchForKextsAndKernelsRecursively ();
}
}
@@ -322,17 +322,53 @@ PlatformDarwinKernel::GetStatus (Stream
else if (m_ios_debug_session == eLazyBoolNo)
strm.Printf ("Mac OS X kernel debugging\n");
else
-strm.Printf ("unknown kernel debugging\n");
+strm.Printf ("unknown kernel debugging\n");
+
+strm.Printf ("Directories searched recursively:\n");
const uint32_t num_kext_dirs = m_search_directories.size();
for (uint32_t i=0; iPrintf("\nkexts with dSYMs");
+for (auto pos : m_name_to_kext_path_map_with_dsyms)
+{
+log->Printf ("%s", pos.second.GetPath().c_str());
+}
+log->Printf("\nkexts without dSYMs");
+
+for (auto pos : m_name_to_kext_path_map_without_dsyms)
+{
+log->Printf ("%s", pos.second.GetPath().c_str());
+}
+log->Printf("\nkernels with dSYMS");
+for (auto fs : m_kernel_binaries_with_dsyms)
+{
+log->Printf ("%s", fs.GetPath().c_str());
+}
+log->Printf("\nkernels without dSYMS");
+for (auto fs : m_kernel_binaries_without_dsyms)
+{
+log->Printf ("%s", fs.GetPath().c_str());
+}
+log->Printf("\n");
+}
}
// Populate the m_search_directories vector with directories we should search
@@ -345,367 +381,276 @@ PlatformDarwinKernel::CollectKextAndKern
// kext bundles that won't be used in this debug session. If this is an
ios kext debug
// session, looking in /System/Library/Extensions is a waste of stat()s,
for example.
-// Build up a list of all SDKs we'll be searching for directories of
kexts/kernels
-// e.g.
/Applications/Xcode.app//Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.8.Internal.sdk
-std::vector sdk_dirs;
+// DeveloperDirectory is something like
"/Applications/Xcode.app/Contents/Developer"
+std::string developer_dir = GetDeveloperDirectory();
+if (developer_dir.empty())
+developer_dir = "/Applications/Xcode.app/Contents/Developer";
+
if (m_ios_debug_session != eLazyBoolNo)
{
-GetiOSSDKDirectoriesToSearch (sdk_dirs);
-GetAppleTVOSSDKDirectoriesToSearch (sdk_dirs);
-GetWatchOSSDKDirectoriesToSearch (sdk_dirs);
+AddSDKSubdirsToSearchPaths (developer_dir +
"/Platforms/iPhoneOS.platform/Developer/SDKs");
+AddSDKSubdirsToSearchPaths (developer_dir +
"/Platforms/AppleTVOS.platform/Developer/SDKs");
+AddSDKSubdirsToSearchPaths (developer_dir +
"/Platforms/WatchOS.platform/Developer/SDKs");
}
if (m_ios_debug_session != eLazyBoolYes)
-GetMacSDKDirectoriesToSearch (sdk_dirs);
-
-GetGenericSDKDirectoriesToSearch (sdk_dirs);
-
-// Build up a list of directories that hold may kext bundles & kernels
-//
-// e.g. given
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/
-// find
-//
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.8.Internal.sdk/
-// and
-//
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.8.