diff options
| author | Jason Molenda <jmolenda@apple.com> | 2015-01-29 06:20:05 +0000 |
|---|---|---|
| committer | Jason Molenda <jmolenda@apple.com> | 2015-01-29 06:20:05 +0000 |
| commit | 9a435729b4b7d94a8c126f4c186da1a202f05b9a (patch) | |
| tree | fe0f20902e6674b3d8a23ec47b52330bca4ad688 /lldb/source/Plugins/Platform/MacOSX/PlatformDarwinKernel.h | |
| parent | 8cafefaef223367dbb5e913488c17baafceb9bbf (diff) | |
| download | bcm5719-llvm-9a435729b4b7d94a8c126f4c186da1a202f05b9a.tar.gz bcm5719-llvm-9a435729b4b7d94a8c126f4c186da1a202f05b9a.zip | |
When starting a kernel debug session (PlatformDarwinKernel), scan
for executable binaries on the local filesystem so the user doesn't
need to provide the path to the correct binary manually.
Also have lldb search for kexts/the kernel in the current working
directory in addition to all the usual places.
<rdar://problem/18126501>
llvm-svn: 227419
Diffstat (limited to 'lldb/source/Plugins/Platform/MacOSX/PlatformDarwinKernel.h')
| -rw-r--r-- | lldb/source/Plugins/Platform/MacOSX/PlatformDarwinKernel.h | 36 |
1 files changed, 28 insertions, 8 deletions
diff --git a/lldb/source/Plugins/Platform/MacOSX/PlatformDarwinKernel.h b/lldb/source/Plugins/Platform/MacOSX/PlatformDarwinKernel.h index 1ba26803ce6..ad0bc6205b8 100644 --- a/lldb/source/Plugins/Platform/MacOSX/PlatformDarwinKernel.h +++ b/lldb/source/Plugins/Platform/MacOSX/PlatformDarwinKernel.h @@ -66,7 +66,7 @@ public: } virtual uint32_t - GetPluginVersion() override + GetPluginVersion() override { return 1; } @@ -88,7 +88,7 @@ public: lldb::ModuleSP &module_sp, const lldb_private::FileSpecList *module_search_paths_ptr, lldb::ModuleSP *old_module_sp_ptr, - bool *did_create_ptr) override; + bool *did_create_ptr) override; bool GetSupportedArchitectureAtIndex (uint32_t idx, @@ -100,7 +100,6 @@ public: void CalculateTrapHandlerSymbolNames () override; - protected: // Map from kext bundle ID ("com.apple.filesystems.exfat") to FileSpec for the kext bundle on @@ -108,6 +107,7 @@ protected: typedef std::multimap<lldb_private::ConstString, lldb_private::FileSpec> BundleIDToKextMap; typedef BundleIDToKextMap::iterator BundleIDToKextIterator; + typedef std::vector<lldb_private::FileSpec> KernelBinaryCollection; // Array of directories that were searched for kext bundles (used only for reporting to user) typedef std::vector<lldb_private::FileSpec> DirectoriesSearchedCollection; @@ -124,8 +124,9 @@ protected: lldb_private::FileSpec::FileType file_type, const lldb_private::FileSpec &file_spec); + // Populate m_search_directories vector of directories void - SearchForKexts(); + CollectKextAndKernelDirectories (); // Directories where we may find iOS SDKs with kext bundles in them void @@ -155,6 +156,13 @@ protected: void GetUserSpecifiedDirectoriesToSearch (std::vector<lldb_private::FileSpec> &directories); + void + GetCurrentDirectoryToSearch (std::vector<lldb_private::FileSpec> &directories); + + // Directories where we may find kernels exclusively + void + GetKernelDirectoriesToSearch (std::vector<lldb_private::FileSpec> &directories); + // Search through a vector of SDK FileSpecs, add any directories that may contain kexts // to the vector of kext dir FileSpecs void @@ -163,16 +171,28 @@ protected: // Search through all of the directories passed in, find all .kext bundles in those directories, // get the CFBundleIDs out of the Info.plists and add the bundle ID and kext path to m_name_to_kext_path_map. void - IndexKextsInDirectories (std::vector<lldb_private::FileSpec> kext_dirs); + IndexKextsInDirectories (); + + // Search through all of the directories passed in, find all kernel binaries in those directories + // (look for "kernel*", "mach.*", assume those are kernels. False positives aren't a huge problem.) + void + IndexKernelsInDirectories (); + + // Callback which iterates over all the files in a given directory, looking for kernel binaries + static lldb_private::FileSpec::EnumerateDirectoryResult + GetKernelsInDirectory (void *baton, + lldb_private::FileSpec::FileType file_type, + const lldb_private::FileSpec &file_spec); lldb_private::Error ExamineKextForMatchingUUID (const lldb_private::FileSpec &kext_bundle_path, const lldb_private::UUID &uuid, const lldb_private::ArchSpec &arch, lldb::ModuleSP &exe_module_sp); private: - BundleIDToKextMap m_name_to_kext_path_map; - DirectoriesSearchedCollection m_directories_searched; - lldb_private::LazyBool m_ios_debug_session; + BundleIDToKextMap m_name_to_kext_path_map; // multimap of CFBundleID to FileSpec on local filesystem + DirectoriesSearchedCollection m_search_directories; // list of directories we search for kexts/kernels + KernelBinaryCollection m_kernel_binaries; // list of kernel binaries we found on local filesystem + lldb_private::LazyBool m_ios_debug_session; DISALLOW_COPY_AND_ASSIGN (PlatformDarwinKernel); |

