@@ -234,12 +234,8 @@ PlatformDarwinKernel::PlatformDarwinKernel(
234
234
m_name_to_kext_path_map_without_dsyms(), m_search_directories(),
235
235
m_search_directories_no_recursing(), m_kernel_binaries_with_dsyms(),
236
236
m_kernel_binaries_without_dsyms(), m_kernel_dsyms_no_binaries(),
237
- m_kernel_dsyms_yaas(), m_ios_debug_session(is_ios_debug_session)
238
-
239
- {
240
- CollectKextAndKernelDirectories ();
241
- SearchForKextsAndKernelsRecursively ();
242
- }
237
+ m_kernel_dsyms_yaas(), m_ios_debug_session(is_ios_debug_session),
238
+ m_kext_scan_flag() {}
243
239
244
240
// / Destructor.
245
241
// /
@@ -248,6 +244,7 @@ PlatformDarwinKernel::PlatformDarwinKernel(
248
244
PlatformDarwinKernel::~PlatformDarwinKernel () = default ;
249
245
250
246
void PlatformDarwinKernel::GetStatus (Stream &strm) {
247
+ UpdateKextandKernelsLocalScan ();
251
248
Platform::GetStatus (strm);
252
249
strm.Printf (" Debug session type: " );
253
250
if (m_ios_debug_session == eLazyBoolYes)
@@ -716,6 +713,13 @@ PlatformDarwinKernel::GetDWARFBinaryInDSYMBundle(FileSpec dsym_bundle) {
716
713
return results;
717
714
}
718
715
716
+ void PlatformDarwinKernel::UpdateKextandKernelsLocalScan () {
717
+ std::call_once (m_kext_scan_flag, [this ]() {
718
+ CollectKextAndKernelDirectories ();
719
+ SearchForKextsAndKernelsRecursively ();
720
+ });
721
+ }
722
+
719
723
Status PlatformDarwinKernel::GetSharedModule (
720
724
const ModuleSpec &module_spec, Process *process, ModuleSP &module_sp,
721
725
const FileSpecList *module_search_paths_ptr,
@@ -796,6 +800,7 @@ Status PlatformDarwinKernel::GetSharedModuleKernel(
796
800
llvm::SmallVectorImpl<ModuleSP> *old_modules, bool *did_create_ptr) {
797
801
Status error;
798
802
module_sp.reset ();
803
+ UpdateKextandKernelsLocalScan ();
799
804
800
805
// First try all kernel binaries that have a dSYM next to them
801
806
for (auto possible_kernel : m_kernel_binaries_with_dsyms) {
0 commit comments